Skip to content

Commit

Permalink
e3: remove overlapped files only after merge save (#10488)
Browse files Browse the repository at this point in the history
for: #10485
  • Loading branch information
AskAlexSharov authored and yperbasis committed May 27, 2024
1 parent d3af203 commit 1130944
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions turbo/snapshotsync/freezeblocks/bor_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1130944

Please sign in to comment.