mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
bor snaps: "erigon snapshots retire" to build bor files (#8912)
This commit is contained in:
parent
c477281362
commit
754276909b
@ -470,12 +470,15 @@ func doRetireCommand(cliCtx *cli.Context) error {
|
||||
if err := br.RetireBlocks(ctx, i, i+every, log.LvlInfo, nil, nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := br.RetireBorBlocks(ctx, i, i+every, log.LvlInfo, nil, nil); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := db.Update(ctx, func(tx kv.RwTx) error {
|
||||
if err := rawdb.WriteSnapshots(tx, blockReader.FrozenFiles(), agg.Files()); err != nil {
|
||||
return err
|
||||
}
|
||||
for j := 0; j < 10_000; j++ { // prune happens by small steps, so need many runs
|
||||
if err := br.PruneAncientBlocks(tx, 100, false /* includeBor */); err != nil {
|
||||
if err := br.PruneAncientBlocks(tx, 100, true /* includeBor */); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -1352,7 +1352,7 @@ func (br *BlockRetire) RetireBlocksInBackground(ctx context.Context, forwardProg
|
||||
if includeBor {
|
||||
blockFrom, blockTo, ok = CanRetire(forwardProgress, br.blockReader.FrozenBorBlocks())
|
||||
if ok {
|
||||
if err := br.RetireBorBlocks(ctx, blockFrom, blockTo, lvl, seedNewSnapshots); err != nil {
|
||||
if err := br.RetireBorBlocks(ctx, blockFrom, blockTo, lvl, seedNewSnapshots, onDeleteSnapshots); err != nil {
|
||||
br.logger.Warn("[bor snapshots] retire blocks", "err", err, "fromBlock", blockFrom, "toBlock", blockTo)
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ type borSpanSegments struct {
|
||||
segments []*BorSpanSegment
|
||||
}
|
||||
|
||||
func (br *BlockRetire) RetireBorBlocks(ctx context.Context, blockFrom, blockTo uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []services.DownloadRequest) error) error {
|
||||
func (br *BlockRetire) RetireBorBlocks(ctx context.Context, blockFrom, blockTo uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []services.DownloadRequest) error, onDelete func(l []string) error) error {
|
||||
chainConfig := fromdb.ChainConfig(br.db)
|
||||
notifier, logger, blockReader, tmpDir, db, workers := br.notifier, br.logger, br.blockReader, br.tmpDir, br.db, br.workers
|
||||
logger.Log(lvl, "[bor snapshots] Retire Bor Blocks", "range", fmt.Sprintf("%dk-%dk", blockFrom/1000, blockTo/1000))
|
||||
@ -211,10 +211,6 @@ func (br *BlockRetire) RetireBorBlocks(ctx context.Context, blockFrom, blockTo u
|
||||
}
|
||||
return nil
|
||||
}
|
||||
onDelete := func(files []string) error {
|
||||
//TODO: add Downloader API to delete files
|
||||
return nil
|
||||
}
|
||||
err := merger.Merge(ctx, snapshots, rangesToMerge, snapshots.Dir(), true /* doIndex */, onMerge, onDelete)
|
||||
if err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user