enhance: make delegator lock critical smaller (#36997)

issue: #36804

Signed-off-by: chyezh <chyezh@outlook.com>
pull/36993/head
Zhen Ye 2024-10-21 11:33:25 +08:00 committed by GitHub
parent 70339820fa
commit ac178eeea5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 3 deletions

View File

@ -878,6 +878,9 @@ func (sd *shardDelegator) ReleaseSegments(ctx context.Context, req *querypb.Rele
case querypb.DataScope_Historical:
sealed = lo.Map(req.GetSegmentIDs(), convertSealed)
}
signal := sd.distribution.RemoveDistributions(sealed, growing)
// wait cleared signal
<-signal
if len(growing) > 0 {
sd.growingSegmentLock.Lock()
@ -893,9 +896,6 @@ func (sd *shardDelegator) ReleaseSegments(ctx context.Context, req *querypb.Rele
})
sd.AddExcludedSegments(droppedInfos)
signal := sd.distribution.RemoveDistributions(sealed, growing)
// wait cleared signal
<-signal
if len(sealed) > 0 {
sd.pkOracle.Remove(
pkoracle.WithSegmentIDs(lo.Map(sealed, func(entry SegmentEntry, _ int) int64 { return entry.SegmentID })...),