未验证 提交 3d8871b3 编写于 作者: Y yah01 提交者: GitHub

Fix data race while updating segment version (#26387)

Signed-off-by: Nyah01 <yah2er0ne@outlook.com>
上级 19f21097
......@@ -79,7 +79,7 @@ type baseSegment struct {
shard string
collectionID int64
typ SegmentType
version int64
version *atomic.Int64
startPosition *msgpb.MsgPosition // for growing segment release
bloomFilterSet *pkoracle.BloomFilterSet
}
......@@ -91,7 +91,7 @@ func newBaseSegment(id, partitionID, collectionID int64, shard string, typ Segme
collectionID: collectionID,
shard: shard,
typ: typ,
version: version,
version: atomic.NewInt64(version),
startPosition: startPosition,
bloomFilterSet: pkoracle.NewBloomFilterSet(id, partitionID, typ),
}
......@@ -123,11 +123,11 @@ func (s *baseSegment) StartPosition() *msgpb.MsgPosition {
}
func (s *baseSegment) Version() int64 {
return s.version
return s.version.Load()
}
func (s *baseSegment) UpdateVersion(version int64) {
s.version = version
s.version.Store(version)
}
func (s *baseSegment) UpdateBloomFilter(pks []storage.PrimaryKey) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册