未验证 提交 63230f02 编写于 作者: C congqixia 提交者: GitHub

Fix data race in ShardCluster.SyncReplicas (#18054)

Signed-off-by: NCongqi Xia <congqi.xia@zilliz.com>
上级 d652fa56
......@@ -301,6 +301,8 @@ func (sc *ShardCluster) SyncSegments(distribution []*querypb.ReplicaSegmentsInfo
})
}
}
allocations := sc.segments.Clone(filterNothing)
sc.mut.Unlock()
// notify handoff wait online if any
......@@ -310,7 +312,7 @@ func (sc *ShardCluster) SyncSegments(distribution []*querypb.ReplicaSegmentsInfo
sc.mutVersion.Lock()
defer sc.mutVersion.Unlock()
version := NewShardClusterVersion(sc.nextVersionID.Inc(), sc.segments.Clone(filterNothing))
version := NewShardClusterVersion(sc.nextVersionID.Inc(), allocations)
sc.versions.Store(version.versionID, version)
sc.currentVersion = version
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册