From b029d0a8ca62312201eeb791379a7e47e19db22e Mon Sep 17 00:00:00 2001 From: Congqi Xia Date: Thu, 31 Oct 2024 19:25:22 +0800 Subject: [PATCH] enhance: Move forward l0 logic out of delta lock 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 --- internal/querynodev2/delegator/delegator_data.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/internal/querynodev2/delegator/delegator_data.go b/internal/querynodev2/delegator/delegator_data.go index 745db68618824..2b34300346116 100644 --- a/internal/querynodev2/delegator/delegator_data.go +++ b/internal/querynodev2/delegator/delegator_data.go @@ -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 @@ -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