-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(store/v2): clean up resources after the migration is completed #19800
Conversation
WalkthroughWalkthroughThe recent updates involve significant enhancements to the store migration process, focusing on the proper closure of stores and efficient management of migrations. Changes include implementing a Changes
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yml
Files selected for processing (4)
- store/commitment/iavl/tree.go (1 hunks)
- store/migration/manager.go (1 hunks)
- store/root/store.go (2 hunks)
- store/snapshots/manager.go (2 hunks)
Additional comments: 5
store/commitment/iavl/tree.go (1)
- 134-134: The modification to return
t.tree.Close()
in theClose
method ensures that the underlying iavl tree is properly closed. This is a crucial change for proper resource management and cleanup.store/migration/manager.go (1)
- 208-218: The addition of the
Close
method to theManager
struct is crucial for ensuring that resources are properly released after a migration process is completed. It handles the closing of the database and notifies thesnapshotsManager
, which is essential for clean resource management post-migration.store/root/store.go (1)
- 385-406: The modifications in the
writeSC
function to handle migration progress more efficiently are well thought out. Closing channels, updating state commitments, and managing the migration manager appropriately are crucial steps for streamlining the migration process and ensuring effective resource management.store/snapshots/manager.go (2)
- 248-248: The modification in the
CreateMigration
method to defer them.end()
call to be handled by the migration manager withEndMigration()
is a thoughtful change. It allows for better control over the migration process and ensures that resources are properly managed and cleaned up after migration.- 261-266: The addition of the
EndMigration
method to theManager
struct is crucial for ensuring that the migration process is handled correctly. It ends the migration operation by replacing the currentcommitSnapshotter
with a new one, which is essential for clean resource management post-migration.
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.
Review Status
Actionable comments generated: 0
Configuration used: .coderabbit.yml
Files selected for processing (2)
- store/migration/manager.go (1 hunks)
- store/root/store.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- store/migration/manager.go
- store/root/store.go
@@ -245,7 +245,7 @@ func (m *Manager) CreateMigration(height uint64, protoWriter WriteCloser) error | |||
if err != nil { | |||
return err | |||
} | |||
defer m.end() | |||
// m.end() will be called by the migration manager with EndMigration(). |
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.
remove?
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.
no, just comments
Description
Closes: #19704 #19705
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