Skip to content

Commit

Permalink
fix: fix bug if datacoord restart when l0 compaction saveSegmentMeta (#…
Browse files Browse the repository at this point in the history
…34679)

#34681

Signed-off-by: wayblink <[email protected]>
  • Loading branch information
wayblink authored Jul 17, 2024
1 parent 17c96e1 commit 90e765d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions internal/datacoord/compaction_task_l0.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,22 +384,17 @@ func (t *l0CompactionTask) SaveTaskMeta() error {

func (t *l0CompactionTask) saveSegmentMeta() error {
result := t.result
plan := t.GetPlan()
var operators []UpdateOperator
for _, seg := range result.GetSegments() {
operators = append(operators, AddBinlogsOperator(seg.GetSegmentID(), nil, nil, seg.GetDeltalogs()))
}

levelZeroSegments := lo.Filter(plan.GetSegmentBinlogs(), func(b *datapb.CompactionSegmentBinlogs, _ int) bool {
return b.GetLevel() == datapb.SegmentLevel_L0
})

for _, seg := range levelZeroSegments {
operators = append(operators, UpdateStatusOperator(seg.GetSegmentID(), commonpb.SegmentState_Dropped), UpdateCompactedOperator(seg.GetSegmentID()))
for _, segID := range t.InputSegments {
operators = append(operators, UpdateStatusOperator(segID, commonpb.SegmentState_Dropped), UpdateCompactedOperator(segID))
}

log.Info("meta update: update segments info for level zero compaction",
zap.Int64("planID", plan.GetPlanID()),
zap.Int64("planID", t.GetPlanID()),
)

return t.meta.UpdateSegmentsInfo(operators...)
Expand Down

0 comments on commit 90e765d

Please sign in to comment.