From 07e4858544ef9ce608a722714e677d5f9b4a0e70 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Mon, 27 May 2024 12:39:18 +0700 Subject: [PATCH] save --- .../snapshotsync/freezeblocks/bor_snapshots.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/turbo/snapshotsync/freezeblocks/bor_snapshots.go b/turbo/snapshotsync/freezeblocks/bor_snapshots.go index 178471742c0..6d74b6dc4e7 100644 --- a/turbo/snapshotsync/freezeblocks/bor_snapshots.go +++ b/turbo/snapshotsync/freezeblocks/bor_snapshots.go @@ -102,10 +102,21 @@ func (br *BlockRetire) retireBorBlocks(ctx context.Context, minBlockNum uint64, } err := merger.Merge(ctx, &snapshots.RoSnapshots, borsnaptype.BorSnapshotTypes(), rangesToMerge, snapshots.Dir(), true /* doIndex */, onMerge, onDelete) - if err != nil { return blocksRetired, err } + + { + files, _, err := typedSegments(br.borSnapshots().dir, br.borSnapshots().segmentsMin.Load(), borsnaptype.BorSnapshotTypes(), false) + if err != nil { + return blocksRetired, err + } + + // this is one off code to fix an issue in 2.49.x->2.52.x which missed + // removal of intermediate segments after a merge operation + removeBorOverlaps(br.borSnapshots().dir, files, br.borSnapshots().BlocksAvailable()) + } + return blocksRetired, nil } @@ -204,10 +215,6 @@ func (s *BorRoSnapshots) ReopenFolder() error { return err } - // this is one off code to fix an issue in 2.49.x->2.52.x which missed - // removal of intermediate segments after a merge operation - removeBorOverlaps(s.dir, files, s.BlocksAvailable()) - list := make([]string, 0, len(files)) for _, f := range files { _, fName := filepath.Split(f.Path)