Skip to content

Commit

Permalink
enhance: Remove legacy L0 segment if watch failed (#32725)
Browse files Browse the repository at this point in the history
Like growing segments, legacy l0 segments shall be removed if watch dml
channel execution fails as well.

Signed-off-by: Congqi Xia <[email protected]>
  • Loading branch information
congqixia committed May 7, 2024
1 parent 83ce352 commit 53b5f1b
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions internal/querynodev2/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,22 @@ func (node *QueryNode) WatchDmChannels(ctx context.Context, req *querypb.WatchDm
})
delegator.AddExcludedSegments(growingInfo)

err = loadL0Segments(ctx, delegator, req)
if err != nil {
log.Warn("failed to load l0 segments", zap.Error(err))
return merr.Status(err), nil
}
defer func() {
if err != nil {
// remove legacy growing
node.manager.Segment.RemoveBy(ctx, segments.WithChannel(channel.GetChannelName()),
segments.WithType(segments.SegmentTypeGrowing))
// remove legacy l0 segments
node.manager.Segment.RemoveBy(segments.WithChannel(channel.GetChannelName()),
segments.WithLevel(datapb.SegmentLevel_L0))
}
}()

err = loadL0Segments(ctx, delegator, req)
if err != nil {
log.Warn("failed to load l0 segments", zap.Error(err))
return merr.Status(err), nil
}
err = loadGrowingSegments(ctx, delegator, req)
if err != nil {
msg := "failed to load growing segments"
Expand Down

0 comments on commit 53b5f1b

Please sign in to comment.