github-vet / github-vet/rangeloop-pointer-findings
pingcap/tidb-operator: pkg/manager/member/dm_master_failover.go; 7 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [pingcap/tidb-operator](https://www.github.com/pingcap/tidb-operator) at [pkg/manager/member/dm_master_failover.go](https://github.com/pingcap/tidb-operator/blob/7236eaba7d5924f47ae0cd3b0bf928886ca8cfc3/pkg/manager/member/dm_master_failover.go#L160-L166)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to masterMember is reassigned at line 162
[Click here to see the code in its original context.](https://github.com/pingcap/tidb-operator/blob/7236eaba7d5924f47ae0cd3b0bf928886ca8cfc3/pkg/manager/member/dm_master_failover.go#L160-L166)
Click here to show the 7 line(s) of Go which triggered the analyzer.
```go
for podName, masterMember := range dc.Status.Master.FailureMembers {
if !masterMember.MemberDeleted {
failureMember = &masterMember
failurePodName = podName
break
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 7236eaba7d5924f47ae0cd3b0bf928886ca8cfc3
Contributor guide
No contributing guide indexed for this repository
Research direction
Read pkg/manager/member/dm_master_failover.go around lines 160-166 and inspect the surrounding failover logic. Check whether taking a reference to the range variable can affect the selected failure member, then classify the finding with a reaction as Bug, Mitigated, or Desirable Behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100