cosmos / iavl

Merkleized IAVL+ Tree implementation in Go
Apache License 2.0
409 stars 256 forks source link

fix: iavl live migration of orphan nodes #866

Closed czarcas7ic closed 5 months ago

czarcas7ic commented 6 months ago

This is cherry picks of work from both John Reynolds and Dev to ensure main stays up to date with the iavl v1.0.0 branch we will be using in v21 of Osmosis.

Previously, we would block chain progress on pruning orphan nodes. For a chain like Osmosis, this took upwards of 2 hours. This change allows chain progress to continue, while pruning orphan nodes synchronously.

As a drive by change, this also fixes the golang linter in this repo.

coderabbitai[bot] commented 6 months ago

Walkthrough

The project has undergone a significant update focused on improving performance, code organization, and maintainability. The Golang version was upgraded, and a custom linting command was introduced. Thread safety in BatchWithFlusher was enhanced with mutex locks. Comments were added to clarify the immutability of certain function inputs. The encoding layer received optimizations and new functionalities. A new FastPrefixFormatter type was introduced for efficient key manipulation. Node structure was refined for better child node handling, and the database management code was restructured with new mutexes, deletion methods, and more efficient key handling.

Changes

File(s) Change Summary
.github/workflows/lint.yml Updated Golang to 1.21, switched to custom lint command.
batch.go Added mutex for thread safety in BatchWithFlusher.
fastnode/fast_node.go, internal/encoding/encoding.go Added immutability comments; encoding.go also includes new functions and simplifications.
keyformat/.../prefix_formatter.go Introduced FastPrefixFormatter for key operations.
mutable_tree.go, node.go Refactored methods for leaf and child node handling.
nodedb.go Overhauled key formatting, added mutexes and new deletion methods, optimized key iteration.

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?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) > Note: Auto-reply has been disabled for this repository by the repository owner. The CodeRabbit bot will not respond to your comments unless it is explicitly tagged. - You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging `@coderabbitai` in a comment. Examples: - `@coderabbitai generate unit tests for this file` - `@coderabbitai modularize this function` - You can tag `@coderabbitai` in a PR comment and ask questions about the PR and the codebase. Examples: - `@coderabbitai gather interesting statistics about this repository and render them in a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai generate unit tests for the src/utils.ts file.` ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json` ### CodeRabbit Discord Community Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.
cool-develope commented 6 months ago

Does it include all of #863, #864, #865 changes?

czarcas7ic commented 6 months ago

This needs to be reopened with the proper changes just haven't had a moment to do so

czarcas7ic commented 5 months ago

Closing in favor of #877 and #876