From 4c91379fe5b9605bab8ef766a9bd2f3ef26505cb Mon Sep 17 00:00:00 2001 From: "Leo Zhang (zhangchiqing)" Date: Fri, 7 Feb 2025 16:07:37 -0800 Subject: [PATCH] address review comments --- engine/execution/pruner/core.go | 4 ++-- engine/execution/pruner/core_test.go | 2 +- engine/execution/pruner/engine.go | 4 ++-- engine/execution/pruner/executor.go | 2 +- module/block_iterator/executor/executor.go | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/engine/execution/pruner/core.go b/engine/execution/pruner/core.go index 2cf792578a9..32a782956b4 100644 --- a/engine/execution/pruner/core.go +++ b/engine/execution/pruner/core.go @@ -22,9 +22,9 @@ import ( const NextHeightForUnprunedExecutionDataPackKey = "NextHeightForUnprunedExecutionDataPackKey" func LoopPruneExecutionDataFromRootToLatestSealed( + ctx context.Context, log zerolog.Logger, metrics module.ExecutionMetrics, - ctx context.Context, state protocol.State, badgerDB *badger.DB, headers storage.Headers, @@ -49,7 +49,7 @@ func LoopPruneExecutionDataFromRootToLatestSealed( ctx, // for cancelling the iteration when the context is done config, chunksDB, - NewChunKDataPackPruner(chunkDataPacks, results), + NewChunkDataPackPruner(chunkDataPacks, results), ) for { diff --git a/engine/execution/pruner/core_test.go b/engine/execution/pruner/core_test.go index 236f4864026..105d562990f 100644 --- a/engine/execution/pruner/core_test.go +++ b/engine/execution/pruner/core_test.go @@ -96,7 +96,7 @@ func TestLoopPruneExecutionDataFromRootToLatestSealed(t *testing.T) { })(cancel) require.NoError(t, LoopPruneExecutionDataFromRootToLatestSealed( - unittest.Logger(), metrics, ctx, ps, bdb, headers, chunkDataPacks, results, pdb, cfg, + ctx, unittest.Logger(), metrics, ps, bdb, headers, chunkDataPacks, results, pdb, cfg, )) // verify the chunk data packs beyond the threshold are pruned diff --git a/engine/execution/pruner/engine.go b/engine/execution/pruner/engine.go index b871cfdcc4f..4b347dd043f 100644 --- a/engine/execution/pruner/engine.go +++ b/engine/execution/pruner/engine.go @@ -30,8 +30,8 @@ func NewChunkDataPackPruningEngine( ready() err := LoopPruneExecutionDataFromRootToLatestSealed( - log.With().Str("component", "CDP-pruner").Logger(), metrics, - ctx, state, badgerDB, headers, chunkDataPacks, results, chunkDataPacksDB, config) + ctx, log.With().Str("component", "CDP-pruner").Logger(), metrics, + state, badgerDB, headers, chunkDataPacks, results, chunkDataPacksDB, config) if err != nil { ctx.Throw(err) } diff --git a/engine/execution/pruner/executor.go b/engine/execution/pruner/executor.go index 754133c6739..3460ef8e98c 100644 --- a/engine/execution/pruner/executor.go +++ b/engine/execution/pruner/executor.go @@ -13,7 +13,7 @@ type ChunkDataPackPruner struct { var _ executor.IterationExecutor = (*ChunkDataPackPruner)(nil) -func NewChunKDataPackPruner(chunkDataPacks storage.ChunkDataPacks, results storage.ExecutionResults) *ChunkDataPackPruner { +func NewChunkDataPackPruner(chunkDataPacks storage.ChunkDataPacks, results storage.ExecutionResults) *ChunkDataPackPruner { return &ChunkDataPackPruner{ ChunkDataPackPruner: pruners.NewChunkDataPackPruner(chunkDataPacks, results), } diff --git a/module/block_iterator/executor/executor.go b/module/block_iterator/executor/executor.go index b6082d0e755..87ac8a0e876 100644 --- a/module/block_iterator/executor/executor.go +++ b/module/block_iterator/executor/executor.go @@ -57,8 +57,8 @@ func IterateExecuteAndCommitInBatch( total := 0 defer func() { log.Info().Str("duration", time.Since(startTime).String()). - Int("total_block_pruned", total). - Msg("pruning completed") + Int("total_block_executed", total). + Msg("block iteration and execution completed") }() for { @@ -94,10 +94,10 @@ func IterateExecuteAndCommitInBatch( break } - // prune all the data indexed by the block + // execute all the data indexed by the block err = executor.ExecuteByBlockID(blockID, batch) if err != nil { - return fmt.Errorf("failed to prune by block ID %v: %w", blockID, err) + return fmt.Errorf("failed to execute by block ID %v: %w", blockID, err) } iteratedCountInCurrentBatch++ total++