github-vet / github-vet/rangeloop-pointer-findings
youzan/nsq: consistence/nsqlookup_coordinator.go; 46 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [youzan/nsq](https://www.github.com/youzan/nsq) at [consistence/nsqlookup_coordinator.go](https://github.com/youzan/nsq/blob/18884a6505fb6ab8cfe9d496f3d3e2081e26d201/consistence/nsqlookup_coordinator.go#L541-L586)
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.
>
[Click here to see the code in its original context.](https://github.com/youzan/nsq/blob/18884a6505fb6ab8cfe9d496f3d3e2081e26d201/consistence/nsqlookup_coordinator.go#L541-L586)
Click here to show the 46 line(s) of Go which triggered the analyzer.
```go
for _, topicInfo := range allTopics {
if FindSlice(topicInfo.ISR, nid) == -1 {
if FindSlice(topicInfo.CatchupList, nid) != -1 {
topicInfo.CatchupList = FilterList(topicInfo.CatchupList, []string{nid})
nlcoord.notifyOldNsqdsForTopicMetaInfo(&topicInfo, []string{nid})
err := nlcoord.leadership.UpdateTopicNodeInfo(topicInfo.Name, topicInfo.Partition,
&topicInfo.TopicPartitionReplicaInfo, topicInfo.Epoch)
if err != nil {
anyPending = true
} else {
nlcoord.notifyTopicMetaInfo(&topicInfo)
}
}
continue
}
if len(topicInfo.ISR) <= topicInfo.Replica {
anyPending = true
// find new catchup and wait isr ready
removingNodes[nid] = "pending"
err := nlcoord.dpm.addToCatchupAndWaitISRReady(monitorChan, true, nid, topicInfo.Name, topicInfo.Partition,
nil, getNodeNameList(nodeTopicStats), true)
if err != nil {
coordLog.Infof("topic %v data on node %v transferred failed: %v, waiting next time", topicInfo.GetTopicDesp(), nid, err.Error())
continue
}
coordLog.Infof("topic %v data on node %v transferred success", topicInfo.GetTopicDesp(), nid)
anyStateChanged = true
} else {
nlcoord.handleRemoveTopicNodeOrMoveLeader(topicInfo.Leader == nid, topicInfo.Name, topicInfo.Partition, nid)
anyPending = true
}
moved++
if moved%16 == 0 {
// recompute the load factor after moved some topics
nodeTopicStats = nodeTopicStats[:0]
for nodeID, nodeInfo := range currentNodes {
topicStat, err := nlcoord.getNsqdTopicStat(nodeInfo)
if err != nil {
coordLog.Infof("failed to get node topic status : %v", nodeID)
continue
}
nodeTopicStats = append(nodeTopicStats, *topicStat)
}
By(leaderSort).Sort(nodeTopicStats)
}
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {notifyTopicMetaInfo 1} was not found in the callgraph; reference was passed directly to third-party code
```
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: 18884a6505fb6ab8cfe9d496f3d3e2081e26d201
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.