Narrow the scope of deleteMut lock in loadStreamDelete (#25436)

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Zhihong Yu 2023-07-16 18:30:34 -07:00 committed by GitHub
parent 51c348158b
commit a7023ab3cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -375,13 +375,13 @@ func (sd *shardDelegator) loadStreamDelete(ctx context.Context,
deltaPositions []*msgpb.MsgPosition,
targetNodeID int64, worker cluster.Worker) error {
log := sd.getLogger(ctx)
sd.deleteMut.Lock()
defer sd.deleteMut.Unlock()
idCandidates := lo.SliceToMap(candidates, func(candidate *pkoracle.BloomFilterSet) (int64, *pkoracle.BloomFilterSet) {
return candidate.ID(), candidate
})
sd.deleteMut.Lock()
defer sd.deleteMut.Unlock()
// apply buffered delete for new segments
// no goroutines here since qnv2 has no load merging logic
for i, info := range infos {