Properly remove borspans snapshots after merges (#8647)

This commit is contained in:
ledgerwatch 2023-11-04 09:58:56 +00:00 committed by GitHub
parent 2aab8f496c
commit 1ffa3fcf94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,7 +374,7 @@ func DumpBorEvents(ctx context.Context, db kv.RoDB, blockFrom, blockTo uint64, w
return nil
}
// DumpBorEvents - [from, to)
// DumpBorSpans - [from, to)
func DumpBorSpans(ctx context.Context, db kv.RoDB, blockFrom, blockTo uint64, workers int, lvl log.Lvl, logger log.Logger, collect func([]byte) error) error {
logEvery := time.NewTicker(20 * time.Second)
defer logEvery.Stop()
@ -1163,8 +1163,7 @@ func (m *BorMerger) Merge(ctx context.Context, snapshots *BorRoSnapshots, mergeR
return err
}
}
time.Sleep(1 * time.Second) // i working on blocking API - to ensure client does not use old snapsthos - and then delete them
for _, t := range snaptype.BlockSnapshotTypes {
for _, t := range []snaptype.Type{snaptype.BorEvents, snaptype.BorSpans} {
m.removeOldFiles(toMerge[t], snapDir)
}
}