Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Chunk Data Pack] Refactor Chunk data packs modules to use generic storage interface #6892

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

zhangchiqing
Copy link
Member

@zhangchiqing zhangchiqing commented Jan 15, 2025

This PR refactors the chunk data packs modules to use the generic storage interfaces. This allows us to reuse functions that made for the generic storage interface to be used on chunk data packs when implementing chunk data pack pruner.

Since chunk data packs are stored in pebble now, this PR also fixed some test cases and tools that was still dealing with chunk data packs stored in badger.

@@ -60,18 +69,28 @@ func run(*cobra.Command, []string) {
metrics := &metrics.NoopCollector{}
transactionResults := badger.NewTransactionResults(metrics, db, badger.DefaultCacheSize)
commits := badger.NewCommits(metrics, db)
chunkDataPacks := badger.NewChunkDataPacks(metrics, db, badger.NewCollections(db, badger.NewTransactions(metrics, db)), badger.DefaultCacheSize)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous implementation was wrong. Since we have moved chunk data packs to pebble, we should use pebble based chunk data packs module for rolling executed height.

headers := bstorage.NewHeaders(metrics, db)
txResults := bstorage.NewTransactionResults(metrics, db, bstorage.DefaultCacheSize)
commits := bstorage.NewCommits(metrics, db)
chunkDataPacks := store.NewChunkDataPacks(metrics, pebbleimpl.ToDB(pdb), bstorage.NewCollections(db, bstorage.NewTransactions(metrics, db)), bstorage.DefaultCacheSize)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change.

Comment on lines +118 to +120
require.NoError(t, err)
require.NoError(t, chunkBatch.Commit())
err2 := batch.Flush()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change.

Comment on lines +242 to +245
require.NoError(t, err)
require.NoError(t, chunkBatch.Commit())
err2 := batch.Flush()
require.NoError(t, err2)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual change.

@@ -0,0 +1,24 @@
package operation
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from storage/pebble/operation/chunk_data_packs.go

@@ -0,0 +1,133 @@
package store_test
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved from storage/pebble/chunk_data_packs_test.go

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 37.76824% with 145 lines in your changes missing coverage. Please review.

Project coverage is 41.12%. Comparing base (0d2b34f) to head (c2cd930).

Files with missing lines Patch % Lines
storage/mock/batch.go 0.00% 46 Missing ⚠️
storage/mock/db.go 0.00% 44 Missing ⚠️
storage/store/cache.go 70.27% 21 Missing and 1 partial ⚠️
...ck-executed-height/cmd/rollback_executed_height.go 21.73% 18 Missing ⚠️
storage/store/chunk_data_packs.go 75.75% 5 Missing and 3 partials ⚠️
cmd/execution_builder.go 0.00% 2 Missing ⚠️
engine/verification/verifier/verifiers.go 0.00% 2 Missing ⚠️
storage/mock/chunk_data_packs.go 0.00% 2 Missing ⚠️
engine/testutil/nodes.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6892   +/-   ##
=======================================
  Coverage   41.11%   41.12%           
=======================================
  Files        2116     2116           
  Lines      185737   185709   -28     
=======================================
+ Hits        76368    76369    +1     
+ Misses     102952   102942   -10     
+ Partials     6417     6398   -19     
Flag Coverage Δ
unittests 41.12% <37.76%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zhangchiqing zhangchiqing marked this pull request as ready for review January 15, 2025 21:24
@zhangchiqing zhangchiqing requested a review from a team as a code owner January 15, 2025 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants