-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat(store/v2): pruning manager #20430
Conversation
Warning Rate Limit Exceeded@cool-develope has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 43 minutes and 27 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe changes introduce a new Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant PruningManager
participant CommitStore
participant IavlTree
User->>CommitStore: Commit()
CommitStore->>PruningManager: Signal Commit
PruningManager->>IavlTree: PausePruning()
IavlTree->>PruningManager: Pruning Paused
PruningManager-->>CommitStore: Commit Signal Processed
CommitStore-->>User: Commit Complete
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@cool-develope your pull request is missing a changelog! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (2)
store/v2/go.mod
is excluded by!**/*.mod
store/v2/go.sum
is excluded by!**/*.sum
Files selected for processing (15)
- store/v2/commitment/iavl/tree.go (2 hunks)
- store/v2/commitment/iavl/tree_test.go (1 hunks)
- store/v2/commitment/store.go (5 hunks)
- store/v2/commitment/store_test_suite.go (4 hunks)
- store/v2/migration/manager_test.go (3 hunks)
- store/v2/pruning/manager.go (1 hunks)
- store/v2/root/factory.go (4 hunks)
- store/v2/root/migrate_test.go (4 hunks)
- store/v2/root/store.go (6 hunks)
- store/v2/root/store_test.go (2 hunks)
- store/v2/storage/pebbledb/db_test.go (1 hunks)
- store/v2/storage/rocksdb/db_test.go (1 hunks)
- store/v2/storage/sqlite/db_test.go (1 hunks)
- store/v2/storage/store.go (2 hunks)
- store/v2/store.go (2 hunks)
Additional Context Used
Path-based Instructions (15)
store/v2/storage/pebbledb/db_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/pruning/manager.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/storage/rocksdb/db_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/root/factory.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/commitment/iavl/tree_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/commitment/iavl/tree.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/storage/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/migration/manager_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/storage/sqlite/db_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/commitment/store_test_suite.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/root/migrate_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/root/store_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/commitment/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/root/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (19)
store/v2/pruning/manager.go (1)
1-67
: LGTM! Ensure theManager
struct and its methods are integrated correctly with other components.store/v2/root/factory.go (1)
Line range hint
15-106
: LGTM! Ensure theCreateRootStore
function integrates correctly with other components.Verification successful
The
CreateRootStore
function is correctly integrated inruntime/v2/builder.go
to initialize the root store and set up the application manager. The context and usage align with the intended functionality.
runtime/v2/builder.go
: Correctly initializesa.app.db
usingCreateRootStore
.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `CreateRootStore` function with other components. # Test: Search for the usage of `CreateRootStore` function. Expect: Correct integration points. rg --type go $'CreateRootStore'Length of output: 307
Script:
#!/bin/bash # Description: Inspect the usage of `CreateRootStore` in `runtime/v2/builder.go`. # Extract the lines around the usage of `CreateRootStore` to understand its context. rg --type go -A 10 -B 10 $'CreateRootStore' runtime/v2/builder.goLength of output: 634
store/v2/commitment/iavl/tree_test.go (1)
17-24
: LGTM! Ensure theNewCommitStore
integrates correctly with the new pruning manager.Verification successful
To ensure the
NewCommitStore
integrates correctly with the new pruning manager, we need to review its implementation instore/v2/commitment/store.go
and check for references to the pruning manager.
The
NewCommitStore
function implementation does not directly reference the pruning manager. However, there are references to the pruning manager instore/v2/root/store.go
. We need to review these references to understand if the pruning manager is integrated withNewCommitStore
indirectly through other components.
The
NewCommitStore
function does not directly reference the pruning manager. However, the pruning manager is integrated within thestore/v2/root/store.go
file, where it handles signaling commits. This suggests that the pruning manager's integration is managed at a higher level in the codebase, ensuring that theNewCommitStore
function operates correctly within this context.
store/v2/root/store.go
: Contains references to the pruning manager, indicating its role in signaling commits.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `NewCommitStore` with the new pruning manager. # Test: Search for the function usage. Expect: Only occurances of the new signature. rg --type go $'NewCommitStore'Length of output: 1095
Script:
#!/bin/bash # Description: Review the implementation of `NewCommitStore` and check for references to the pruning manager. # Extract the implementation of `NewCommitStore` function. ast-grep --lang go --pattern $'func NewCommitStore(trees map[string]Tree, db corestore.KVStoreWithBatch, logger log.Logger) (*CommitStore, error) { $$$ }' # Search for references to the pruning manager in the codebase. rg --type go 'pruning manager'Length of output: 1132
Script:
#!/bin/bash # Description: Review the references to the pruning manager in `store/v2/root/store.go`. # Extract lines around the references to the pruning manager for context. rg --type go --context 5 'pruning manager' store/v2/root/store.goLength of output: 1378
store/v2/commitment/iavl/tree.go (1)
Line range hint
11-111
: LGTM! Ensure thePausePruning
method and the interface implementation are integrated correctly with other components.Verification successful
The
PausePruning
method is correctly integrated with other components in the codebase. The method is referenced and utilized instore/v2/store.go
,store/v2/commitment/store.go
, andstore/v2/pruning/manager.go
, ensuring that the pruning process can be paused or resumed as needed.
store/v2/store.go
: Defines thePausablePruner
interface, which includes thePausePruning
method.store/v2/commitment/store.go
: Implements thePausePruning
method in theCommitStore
struct, iterating overmultiTrees
and invokingPausePruning
on each tree that implementsPausablePruner
.store/v2/pruning/manager.go
: Uses thePausePruning
method in theSignalCommit
function to manage concurrent writes during pruning.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of `PausePruning` method with other components. # Test: Search for the usage of `PausePruning` method. Expect: Correct integration points. rg --type go $'PausePruning'Length of output: 678
Script:
#!/bin/bash # Description: Inspect the usage and context of `PausePruning` in the identified files. # Display lines around the usage of `PausePruning` in store/v2/store.go rg --type go --context 5 'PausePruning' store/v2/store.go # Display lines around the usage of `PausePruning` in store/v2/commitment/store.go rg --type go --context 5 'PausePruning' store/v2/commitment/store.go # Display lines around the usage of `PausePruning` in store/v2/pruning/manager.go rg --type go --context 5 'PausePruning' store/v2/pruning/manager.goLength of output: 1376
store/v2/storage/store.go (2)
20-20
: Implementation ofstore.Pruner
interface inStorageStore
looks good.
30-33
: UpdatedNewStorageStore
function signature simplifies initialization and aligns with the PR's objectives.store/v2/store.go (1)
82-96
: Introduction ofPruner
andPausablePruner
interfaces enhances control over the pruning process and supports dynamic management of state consistency.store/v2/migration/manager_test.go (2)
31-31
: Changes in the initialization ofCommitStore
reflect the updated constructor and align with the PR's objectives to simplify store setup in tests.Also applies to: 50-50
41-41
: Initialization ofStorageStore
in test setup correctly reflects the changes to its constructor in the main implementation.store/v2/storage/sqlite/db_test.go (1)
22-22
: UpdatedNewDB
function in test suite correctly uses the newStorageStore
constructor, maintaining consistency with main codebase changes.store/v2/commitment/store_test_suite.go (2)
28-28
: UpdatedNewStore
function in test suite reflects the main codebase changes, ensuring consistency and simplification in test setup.Also applies to: 33-33, 67-67, 132-132
152-154
: Pruning logic in test case correctly implements and tests the intended functionality usingPruneOptions
.store/v2/root/migrate_test.go (1)
17-17
: Changes in test setup and migration logic inMigrateStoreTestSuite
correctly integrate new components and reflect updates to store constructors, ensuring comprehensive testing of migration functionality.Also applies to: 45-45, 66-66, 72-72, 79-79, 82-82
store/v2/root/store_test.go (2)
16-16
: Ensure the new importcosmossdk.io/store/v2/pruning
is utilized appropriately in the tests.Verification successful
The
pruning
package is imported and used in the test suite, specifically with thepruning.NewManager
function. This indicates that the new import is indeed utilized in the tests.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `pruning` package in the test suite. # Test: Search for the usage of the `pruning` package. Expect: At least one usage. rg --type go $'pruning' store/v2/root/store_test.goLength of output: 127
48-48
: Initialization ofStorageStore
should be accompanied by tests that verify its interaction with the new pruning manager.store/v2/commitment/store.go (2)
31-31
: TheCommitStore
now implementsstore.PausablePruner
. Ensure that the implementation of the interface methods (Prune
andPausePruning
) is correct and adheres to the expected behavior.Verification successful
The
CommitStore
correctly implements thePrune
andPausePruning
methods as required by thestore.PausablePruner
interface. The methods adhere to the expected behavior, ensuring proper functionality.
Prune
method: Iterates through versions, deletes metadata, and prunes trees.PausePruning
method: Pauses pruning for each tree that supports thePausablePruner
interface.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct implementation of `store.PausablePruner` methods in `CommitStore`. # Test: Search for the implementation of `Prune` and `PausePruning`. Expect: Correct implementation according to interface definition. rg --type go $'func \(c \*CommitStore\) (Prune|PausePruning)' store/v2/commitment/store.goLength of output: 199
Script:
#!/bin/bash # Extract the full implementation of the `Prune` and `PausePruning` methods from `CommitStore`. # Extract the `Prune` method implementation. rg --type go --context 10 $'func (c *CommitStore) Prune(version uint64) (ferr error) {' store/v2/commitment/store.go # Extract the `PausePruning` method implementation. rg --type go --context 10 $'func (c *CommitStore) PausePruning(pause bool) {' store/v2/commitment/store.goLength of output: 565
Script:
#!/bin/bash # Extract the full implementation of the `Prune` and `PausePruning` methods from `CommitStore`. # Extract the `Prune` method implementation. rg --type go --context 10 'func \(c \*CommitStore\) Prune\(version uint64\) \(ferr error\) \{' store/v2/commitment/store.go # Extract the `PausePruning` method implementation. rg --type go --context 10 'func \(c \*CommitStore\) PausePruning\(pause bool\) \{' store/v2/commitment/store.goLength of output: 1292
286-286
: Review the implementation ofPrune
andPausePruning
methods to ensure they handle errors appropriately and perform the expected operations on the trees.Also applies to: 312-319
Verification successful
The implementations of the
Prune
andPausePruning
methods have been reviewed. Both methods handle errors appropriately:
- The
Prune
method checks for errors when deleting keys and writing the batch, returning the error if encountered. It also accumulates errors from pruning individual trees.- The
PausePruning
method checks if each tree supports pausing pruning and calls thePausePruning
method on those that do.No issues were found in the error handling of these methods.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify error handling in `Prune` and `PausePruning`. # Test: Search for error handling patterns in `Prune` and `PausePruning`. Expect: Proper error handling. rg --type go $'if err != nil' store/v2/commitment/store.goLength of output: 377
Script:
#!/bin/bash # Description: Locate and extract the implementations of `Prune` and `PausePruning` methods in `store/v2/commitment/store.go`. # Search for the `Prune` method implementation. ast-grep --lang go --pattern $'func (s *$_) Prune($_) $_ { $$$ }' store/v2/commitment/store.go # Search for the `PausePruning` method implementation. ast-grep --lang go --pattern $'func (s *$_) PausePruning($_) $_ { $$$ }' store/v2/commitment/store.goLength of output: 202
Script:
#!/bin/bash # Description: Search for the method names `Prune` and `PausePruning` in `store/v2/commitment/store.go`. # Search for the `Prune` method. rg 'Prune' store/v2/commitment/store.go # Search for the `PausePruning` method. rg 'PausePruning' store/v2/commitment/store.goLength of output: 516
Script:
#!/bin/bash # Description: Extract the lines of code for the `Prune` and `PausePruning` methods from `store/v2/commitment/store.go`. # Extract lines for the `Prune` method. sed -n '288,311p' store/v2/commitment/store.go # Extract lines for the `PausePruning` method. sed -n '312,319p' store/v2/commitment/store.goLength of output: 785
store/v2/root/store.go (2)
281-285
: Review the signaling to thepruningManager
during the commit process to ensure it correctly handles the start and end of a commit.Also applies to: 314-318
Verification successful
The signaling to the
pruningManager
during the commit process correctly handles both the start and end of a commit. The first call toSignalCommit
withtrue
signals the start of a commit, and the second call withfalse
signals the end of a commit.
- Lines 281-285: Signal the start of a commit.
- Lines 314-318: Signal the end of a commit.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the signaling process to `pruningManager` during commits. # Test: Search for the signaling logic in the commit process. Expect: Correct signaling. rg --type go $'SignalCommit' store/v2/root/store.goLength of output: 191
Script:
#!/bin/bash # Extract surrounding lines of SignalCommit calls to understand the context rg --type go -A 5 -B 5 'SignalCommit' store/v2/root/store.goLength of output: 852
47-49
: TheStore
struct now includes apruningManager
. Ensure that the initialization in theNew
function correctly sets up thepruningManager
and that it is utilized appropriately in the rest of the class methods.Also applies to: 69-78
Verification successful
The
pruningManager
is correctly initialized in theNew
function of theStore
class and is used in theSignalCommit
method. TheSignalCommit
method in thepruning.Manager
is implemented to handle the start and end of a commit process, pausing and resuming pruning as necessary.
The
pruningManager
is initialized in theNew
function:return &Store{ logger: logger.With("module", "root_store"), initialVersion: 1, stateStorage: ss, stateCommitment: sc, pruningManager: pm, migrationManager: mm, telemetry: m, isMigrating: mm != nil, }, nilThe
SignalCommit
method is implemented as follows:func (m *Manager) SignalCommit(start bool, version uint64) error { if scPausablePruner, ok := m.scPruner.(store.PausablePruner); ok { scPausablePruner.PausePruning(start) } if ssPausablePruner, ok := m.ssPruner.(store.PausablePruner); ok { ssPausablePruner.PausePruning(start) } if !start { return m.Prune(version) } return nil }The initialization and usage of
pruningManager
appear to be correctly implemented.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correct setup and utilization of `pruningManager` in the `Store` class. # Test: Search for the usage of `pruningManager` in the `Store` class methods. Expect: Correct setup and utilization. rg --type go $'pruningManager' store/v2/root/store.goLength of output: 344
Script:
#!/bin/bash # Description: Verify the initialization of `pruningManager` in the `New` function and the implementation of `SignalCommit`. # Test: Search for the initialization of `pruningManager` in the `New` function. rg --type go 'New' store/v2/root/store.go # Test: Search for the implementation of `SignalCommit` method in the `pruning.Manager`. rg --type go 'SignalCommit'Length of output: 576
Script:
#!/bin/bash # Description: Extract the full implementation of the `New` function and the `SignalCommit` method. # Extract the full implementation of the `New` function. rg --type go -A 20 'func New(' store/v2/root/store.go # Extract the full implementation of the `SignalCommit` method. rg --type go -A 20 'func (m *Manager) SignalCommit(' store/v2/pruning/manager.goLength of output: 320
Script:
#!/bin/bash # Description: Extract the full implementation of the `New` function and the `SignalCommit` method. # Extract the full implementation of the `New` function. rg --type go -A 20 'func New\(' store/v2/root/store.go # Extract the full implementation of the `SignalCommit` method. rg --type go -A 20 'func \(m \*Manager\) SignalCommit\(' store/v2/pruning/manager.goLength of output: 1004
pm := pruning.NewManager(sc, ss, nil, nil) | ||
rs, err := New(noopLog, ss, sc, pm, nil, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The search results indicate that while pruning.NewManager
is instantiated in the test file, there is no evidence that it is being used in conjunction with RootStore
. This suggests that the integration of pruning.Manager
with RootStore
is not being tested.
- Ensure that tests verify the correct behavior of
RootStore
with the pruning manager integrated.
Analysis chain
The creation of RootStore
now includes a pruning.Manager
. Ensure that the tests verify the correct behavior of RootStore
with the pruning manager integrated.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the correct behavior of `RootStore` with the pruning manager.
# Test: Search for tests that involve `RootStore` and `pruning.Manager`. Expect: At least one test.
rg --type go $'RootStore.*pruning.Manager' store/v2/root/store_test.go
Length of output: 71
Script:
#!/bin/bash
# Description: Verify the correct behavior of `RootStore` with the pruning manager.
# Step 1: Search for `RootStore` instantiation in the test file.
rg --type go 'RootStore' store/v2/root/store_test.go
# Step 2: Search for `pruning.Manager` instantiation in the test file.
rg --type go 'pruning.Manager' store/v2/root/store_test.go
Length of output: 792
Script:
#!/bin/bash
# Description: Verify the correct behavior of `RootStore` with the pruning manager.
# Step 1: Search for the instantiation of `RootStore` in the test file.
rg --type go 'New(noopLog, ss, sc, pm, nil, nil)' store/v2/root/store_test.go
# Step 2: Check if `pruning.Manager` is passed as a parameter to `RootStore`.
rg --type go 'pruning.NewManager' store/v2/root/store_test.go
Length of output: 185
@@ -20,7 +20,7 @@ func TestStorageTestSuite(t *testing.T) { | |||
db.SetSync(false) | |||
} | |||
|
|||
return storage.NewStorageStore(db, nil, log.NewNopLogger()), err | |||
return storage.NewStorageStore(db, log.NewNopLogger()), err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The recent commits and PRs do not mention the new pruning manager, indicating that it might not be integrated yet. To ensure proper integration, the NewStorageStore
function should be updated to include the new pruning manager if it is part of the intended changes.
- File:
store/v2/storage/store.go
- Function:
NewStorageStore
Analysis chain
LGTM! Ensure the NewStorageStore
integrates correctly with the new pruning manager.
The search results indicate multiple instances of NewStorageStore
with different signatures. To verify the integration with the new pruning manager, we need to inspect the definition of NewStorageStore
and ensure it includes the new pruning manager.
The definition of NewStorageStore
does not include the new pruning manager. This suggests that the integration might be missing or handled elsewhere. To confirm, we need to check for any recent changes or PRs that might include the new pruning manager integration.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the integration of `NewStorageStore` with the new pruning manager.
# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type go $'NewStorageStore'
Length of output: 1189
Script:
#!/bin/bash
# Description: Verify the definition of `NewStorageStore` to check for integration with the new pruning manager.
# Test: Retrieve the definition of `NewStorageStore` function.
ast-grep --lang go --pattern $'func NewStorageStore($_, $_) *$_ {
$$$
}'
Length of output: 390
Script:
#!/bin/bash
# Description: Check for recent changes or PRs related to the new pruning manager integration.
# Test: List recent commits and PRs to find references to the new pruning manager.
git log -n 10 --oneline
gh pr list --state merged --limit 10
Length of output: 1444
@@ -21,7 +21,7 @@ func TestStorageTestSuite(t *testing.T) { | |||
s := &storage.StorageTestSuite{ | |||
NewDB: func(dir string) (store.VersionedDatabase, error) { | |||
db, err := New(dir) | |||
return storage.NewStorageStore(db, nil, log.NewNopLogger()), err | |||
return storage.NewStorageStore(db, log.NewNopLogger()), err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
The NewStorageStore
function does not currently initialize the pruning manager. This is evident from the implementation found in store/v2/storage/store.go
, which only initializes the logger
and db
fields of the StorageStore
struct.
store/v2/storage/store.go:func NewStorageStore(db Database, logger log.Logger) *StorageStore {
To ensure proper integration with the new pruning manager, the NewStorageStore
function should be updated to initialize the pruning manager as well.
Analysis chain
LGTM! Ensure the NewStorageStore
integrates correctly with the new pruning manager.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the integration of `NewStorageStore` with the new pruning manager.
# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type go $'NewStorageStore'
Length of output: 1189
Script:
#!/bin/bash
# Description: Verify the integration of `NewStorageStore` with the new pruning manager.
# Test: Search for references to the pruning manager within the `NewStorageStore` function and its usage.
rg --type go 'pruningManager' --context 5
Length of output: 9794
Script:
#!/bin/bash
# Description: Verify the initialization of the pruning manager within the `NewStorageStore` function.
# Test: Search for the implementation of the `NewStorageStore` function.
rg --type go 'func NewStorageStore' --context 10
Length of output: 1172
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (17)
- store/v2/commitment/iavl/tree.go (3 hunks)
- store/v2/commitment/iavl/tree_test.go (2 hunks)
- store/v2/commitment/store.go (5 hunks)
- store/v2/commitment/store_test_suite.go (5 hunks)
- store/v2/database.go (2 hunks)
- store/v2/migration/manager.go (1 hunks)
- store/v2/migration/manager_test.go (4 hunks)
- store/v2/pruning/manager_test.go (1 hunks)
- store/v2/root/factory.go (5 hunks)
- store/v2/root/migrate_test.go (4 hunks)
- store/v2/root/store.go (7 hunks)
- store/v2/root/store_test.go (3 hunks)
- store/v2/storage/pebbledb/db_test.go (1 hunks)
- store/v2/storage/rocksdb/db_test.go (1 hunks)
- store/v2/storage/sqlite/db_test.go (1 hunks)
- store/v2/storage/storage_bench_test.go (1 hunks)
- store/v2/storage/storage_test_suite.go (1 hunks)
Files skipped from review as they are similar to previous changes (12)
- store/v2/commitment/iavl/tree.go
- store/v2/commitment/iavl/tree_test.go
- store/v2/commitment/store.go
- store/v2/commitment/store_test_suite.go
- store/v2/migration/manager_test.go
- store/v2/root/factory.go
- store/v2/root/migrate_test.go
- store/v2/root/store.go
- store/v2/root/store_test.go
- store/v2/storage/pebbledb/db_test.go
- store/v2/storage/rocksdb/db_test.go
- store/v2/storage/sqlite/db_test.go
Additional Context Used
Path-based Instructions (5)
store/v2/database.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/storage/storage_bench_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/pruning/manager_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/migration/manager.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/storage/storage_test_suite.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (5)
store/v2/database.go (1)
30-31
: The addition of theWriteChangeset
method in theCommitter
interface aligns well with the PR's objectives to enhance commitment management.store/v2/storage/storage_bench_test.go (1)
30-30
: The use oflog.NewNopLogger()
in the instantiation ofStorageStore
for benchmark tests is a good practice, as it prevents logging overhead from affecting performance measurements.Also applies to: 38-38, 42-42
store/v2/pruning/manager_test.go (1)
1-173
: ThePruningManagerTestSuite
is comprehensive and well-structured, effectively testing various scenarios including error handling and state verification post-pruning. This ensures the reliability and robustness of the pruning functionality.store/v2/migration/manager.go (1)
236-236
: The updates in theSync
method to handle changesets committed during the migration process are crucial for maintaining data consistency. This is a key enhancement in the migration functionality.store/v2/storage/storage_test_suite.go (1)
25-25
: The addition of theNewDB
field to theStorageTestSuite
struct enhances the flexibility and reusability of the test suite by allowing dynamic instantiation of storage backends. This is a valuable improvement for testing different configurations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM, suggested some updates to comments for code clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK, can we add a few docs on the pruning manager and a small diagram using plantuml on how its meant to be used
@@ -0,0 +1,69 @@ | |||
package pruning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a small readme/doc.go on the design with a small diagram on how this is meant to be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review Details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files ignored due to path filters (2)
store/v2/go.mod
is excluded by!**/*.mod
store/v2/go.sum
is excluded by!**/*.sum
Files selected for processing (18)
- store/v2/commitment/iavl/tree.go (3 hunks)
- store/v2/commitment/iavl/tree_test.go (2 hunks)
- store/v2/commitment/store.go (5 hunks)
- store/v2/commitment/store_test_suite.go (5 hunks)
- store/v2/migration/manager.go (1 hunks)
- store/v2/migration/manager_test.go (4 hunks)
- store/v2/pruning/README.md (1 hunks)
- store/v2/pruning/manager.go (1 hunks)
- store/v2/pruning/manager_test.go (1 hunks)
- store/v2/root/factory.go (5 hunks)
- store/v2/root/migrate_test.go (4 hunks)
- store/v2/root/store.go (7 hunks)
- store/v2/root/store_test.go (3 hunks)
- store/v2/storage/pebbledb/db_test.go (1 hunks)
- store/v2/storage/rocksdb/db_test.go (1 hunks)
- store/v2/storage/sqlite/db_test.go (1 hunks)
- store/v2/storage/storage_bench_test.go (1 hunks)
- store/v2/storage/store.go (2 hunks)
Files skipped from review as they are similar to previous changes (14)
- store/v2/commitment/iavl/tree.go
- store/v2/commitment/iavl/tree_test.go
- store/v2/commitment/store_test_suite.go
- store/v2/migration/manager.go
- store/v2/migration/manager_test.go
- store/v2/pruning/manager.go
- store/v2/pruning/manager_test.go
- store/v2/root/store.go
- store/v2/root/store_test.go
- store/v2/storage/pebbledb/db_test.go
- store/v2/storage/rocksdb/db_test.go
- store/v2/storage/sqlite/db_test.go
- store/v2/storage/storage_bench_test.go
- store/v2/storage/store.go
Additional Context Used
LanguageTool (1)
store/v2/pruning/README.md (1)
Near line 17: Possible missing comma found.
Context: ...rinterface defines the
PausePruning` method which is used to pause the pruning proc...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA
Markdownlint (1)
store/v2/pruning/README.md (1)
52: null
Files should end with a single newline character
Path-based Instructions (4)
store/v2/pruning/README.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"store/v2/root/factory.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.store/v2/root/migrate_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"store/v2/commitment/store.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (10)
store/v2/pruning/README.md (2)
1-14
: The introduction and description of thePruningManager
andPruneOptions
are clear and well-documented.
23-52
: ThePruning Flow
diagram provides a clear visual representation of the process. Good use of the mermaid diagram to illustrate complex interactions.store/v2/root/factory.go (3)
Line range hint
1-43
: The imports and type definitions are appropriate and well-organized.
Line range hint
53-106
: TheCreateRootStore
function is well-implemented with clear error handling and initialization logic for different storage types. Good use of helper functionensureDir
for directory management.
Line range hint
1-106
: The overall structure and formatting of the file conform to the Uber Golang style guide.store/v2/root/migrate_test.go (3)
Line range hint
1-18
: The imports and initial setup for theMigrateStoreTestSuite
are appropriate and well-organized, providing a solid foundation for the tests.
Line range hint
46-83
: The test functions in theMigrateStoreTestSuite
are well-implemented, covering a variety of scenarios and properly handling errors. Good use of assertions to ensure state correctness.
Line range hint
1-83
: The overall structure and formatting of the test file are well-maintained and follow best practices for test code.store/v2/commitment/store.go (2)
Line range hint
31-319
: The method implementations inCommitStore
, includingPausePruning
andPrune
, correctly adhere to their respective interfaces. The implementation details are consistent with the expected behavior described in the PR.
Line range hint
1-320
: The overall structure and formatting of the file conform to the Uber Golang style guide.
* main: (120 commits) chore: update protoc-gen-swagger to protoc-gen-openapiv2 (#20448) ci: Add GitHub Action for go mod tidy and mocks (#20501) chore: Address linter issues (#20486) fix: wrap errors in auto CLI service registration (#20493) chore: fix comment (#20498) chore: fix the note box syntax error (#20499) feat(server/v2): introduce cometbft v2 (#20483) refactor(x/upgrade): migrate to appmodule.VersionMap (#20485) docs: code guidelines changes (#20482) feat(cosmovisor): load cosmovisor configuration from toml file (#19995) perf(math): Significantly speedup Dec quo truncate and quo Roundup (#20034) fix: Bump CometBFT versions (#20481) refactor(core): remove redundant ExecMode (#20322) feat(store/v2): pruning manager (#20430) chore: force reload sonar cloud (#20480) refactor(x/accounts): reuse calculated sum in `func safeAdd` (#20458) refactor: remove `defer` in loop (#20223) ci: remove livness test (#20474) build(deps): Bump bufbuild/buf-setup-action from 1.32.1 to 1.32.2 (#20477) chore: migrate a few diagrams to mermaid (#20473) ...
Description
Closes: #20429
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Summary by CodeRabbit
New Features
PruningManager
for managing state storage and commitment pruning based on chain height.Refactor
pruneOpts
parameter from various initialization functions.Tests