Skip to content

Commit

Permalink
on chain-tip: if batch is full - stop execution stage - to allow comm…
Browse files Browse the repository at this point in the history
…it and reduce db size (erigontech#11287)
  • Loading branch information
AskAlexSharov authored Jul 23, 2024
1 parent 6892e4e commit 6df3f87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eth/stagedsync/exec3.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ Loop:

tt = time.Now()
applyTx.CollectMetrics()

if !useExternalTx {
tt = time.Now()
if err = applyTx.Commit(); err != nil {
Expand Down Expand Up @@ -951,6 +952,11 @@ Loop:
}(); err != nil {
return err
}

// on chain-tip: if batch is full then stop execution - to allow stages commit
if !execStage.CurrentSyncCycle.IsInitialCycle {
break Loop
}
logger.Info("Committed", "time", time.Since(commitStart),
"block", doms.BlockNum(), "txNum", doms.TxNum(),
"step", fmt.Sprintf("%.1f", float64(doms.TxNum())/float64(agg.StepSize())),
Expand Down

0 comments on commit 6df3f87

Please sign in to comment.