Skip to content

Commit

Permalink
enhance: Move forward l0 logic out of delta lock (#37337)
Browse files Browse the repository at this point in the history
Related to #35303

`deleteMut` shall be protecting streaming delete buffer, forward l0
could be move out of the rlock section to reduce tsafe impact from
loading segments.

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia authored Nov 4, 2024
1 parent 51cb2fb commit f54cf41
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions internal/querynodev2/delegator/delegator_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,15 @@ func (sd *shardDelegator) loadStreamDelete(ctx context.Context,
})
deltaPositions := req.GetDeltaPositions()

for _, info := range infos {
candidate := idCandidates[info.GetSegmentID()]
// forward l0 deletion
err := sd.forwardL0Deletion(ctx, info, req, candidate, targetNodeID, worker)
if err != nil {
return err
}
}

sd.deleteMut.RLock()
defer sd.deleteMut.RUnlock()
// apply buffered delete for new segments
Expand Down Expand Up @@ -628,12 +637,6 @@ func (sd *shardDelegator) loadStreamDelete(ctx context.Context,
deleteScope = querypb.DataScope_Streaming
}

// forward l0 deletion
err := sd.forwardL0Deletion(ctx, info, req, candidate, targetNodeID, worker)
if err != nil {
return err
}

deleteData := &storage.DeleteData{}
// start position is dml position for segment
// if this position is before deleteBuffer's safe ts, it means some delete shall be read from msgstream
Expand Down

0 comments on commit f54cf41

Please sign in to comment.