From 03dc697109ce998bd33fe48e008808e5de614e08 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 28 May 2024 08:28:32 +0700 Subject: [PATCH 1/4] save --- eth/stagedsync/exec3.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 5b9b51f93d1..217013bf87a 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -295,6 +295,10 @@ func ExecV3(ctx context.Context, "from", blockNum, "to", maxBlockNum, "fromTxNum", doms.TxNum(), "offsetFromBlockBeginning", offsetFromBlockBeginning, "initialCycle", initialCycle, "useExternalTx", useExternalTx) } + if useExternalTx && blockNum < cfg.blockReader.FrozenBlocks() { + defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) + } + if blocksFreezeCfg.Produce { //log.Info(fmt.Sprintf("[snapshots] db has steps amount: %s", agg.StepsRangeInDBAsStr(applyTx))) agg.BuildFilesInBackground(outputTxNum.Load()) @@ -561,10 +565,6 @@ func ExecV3(ctx context.Context, }) } - if useExternalTx && blockNum < cfg.blockReader.FrozenBlocks() { - defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 2) - } - getHeaderFunc := func(hash common.Hash, number uint64) (h *types.Header) { var err error if parallel { From ff051ce44262e7faff76895c748d39bd8754f184 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 28 May 2024 08:29:56 +0700 Subject: [PATCH 2/4] save --- eth/stagedsync/exec3.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 217013bf87a..946d12c3658 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -295,7 +295,7 @@ func ExecV3(ctx context.Context, "from", blockNum, "to", maxBlockNum, "fromTxNum", doms.TxNum(), "offsetFromBlockBeginning", offsetFromBlockBeginning, "initialCycle", initialCycle, "useExternalTx", useExternalTx) } - if useExternalTx && blockNum < cfg.blockReader.FrozenBlocks() { + if initialCycle && blockNum < cfg.blockReader.FrozenBlocks() { defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) } From 0d85b0909ffddb7df3f061debec8ce0857742907 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 28 May 2024 08:31:28 +0700 Subject: [PATCH 3/4] save --- eth/stagedsync/exec3.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index 946d12c3658..ad769c50a38 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -160,6 +160,7 @@ func ExecV3(ctx context.Context, agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) defer agg.DiscardHistory(kv.CommitmentDomain).EnableHistory(kv.CommitmentDomain) + defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) } else { agg.SetCompressWorkers(1) agg.SetCollateAndBuildWorkers(1) @@ -295,10 +296,6 @@ func ExecV3(ctx context.Context, "from", blockNum, "to", maxBlockNum, "fromTxNum", doms.TxNum(), "offsetFromBlockBeginning", offsetFromBlockBeginning, "initialCycle", initialCycle, "useExternalTx", useExternalTx) } - if initialCycle && blockNum < cfg.blockReader.FrozenBlocks() { - defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) - } - if blocksFreezeCfg.Produce { //log.Info(fmt.Sprintf("[snapshots] db has steps amount: %s", agg.StepsRangeInDBAsStr(applyTx))) agg.BuildFilesInBackground(outputTxNum.Load()) From f93813b9e31cc9ada0fa7364bd63752c9669ff45 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Tue, 28 May 2024 08:35:05 +0700 Subject: [PATCH 4/4] save --- eth/stagedsync/exec3.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/eth/stagedsync/exec3.go b/eth/stagedsync/exec3.go index ad769c50a38..ac478a3a342 100644 --- a/eth/stagedsync/exec3.go +++ b/eth/stagedsync/exec3.go @@ -156,16 +156,6 @@ func ExecV3(ctx context.Context, chainConfig, genesis := cfg.chainConfig, cfg.genesis blocksFreezeCfg := cfg.blockReader.FreezingCfg() - if initialCycle { - agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) - agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) - defer agg.DiscardHistory(kv.CommitmentDomain).EnableHistory(kv.CommitmentDomain) - defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) - } else { - agg.SetCompressWorkers(1) - agg.SetCollateAndBuildWorkers(1) - } - applyTx := txc.Tx useExternalTx := applyTx != nil if !useExternalTx { @@ -296,6 +286,18 @@ func ExecV3(ctx context.Context, "from", blockNum, "to", maxBlockNum, "fromTxNum", doms.TxNum(), "offsetFromBlockBeginning", offsetFromBlockBeginning, "initialCycle", initialCycle, "useExternalTx", useExternalTx) } + if initialCycle { + agg.SetCollateAndBuildWorkers(min(2, estimate.StateV3Collate.Workers())) + agg.SetCompressWorkers(estimate.CompressSnapshot.Workers()) + if blockNum < cfg.blockReader.FrozenBlocks() { + defer agg.DiscardHistory(kv.CommitmentDomain).EnableHistory(kv.CommitmentDomain) + defer agg.LimitRecentHistoryWithoutFiles(0).LimitRecentHistoryWithoutFiles(agg.StepSize() / 10) + } + } else { + agg.SetCompressWorkers(1) + agg.SetCollateAndBuildWorkers(1) + } + if blocksFreezeCfg.Produce { //log.Info(fmt.Sprintf("[snapshots] db has steps amount: %s", agg.StepsRangeInDBAsStr(applyTx))) agg.BuildFilesInBackground(outputTxNum.Load())