Closed kocubinski closed 5 months ago
is this ready for review?
The update enhances the iavl
package with significant improvements in version control, database management, and performance optimization. It introduces new functionalities such as command-line tools for database operations, integration with SQLite for snapshot management, advanced metrics tracking, and enhanced tree manipulation capabilities. These changes aim to provide more efficient and robust tools for managing tree structures and their data, emphasizing scalability and user experience.
File(s) | Change Summary |
---|---|
v2/.gitignore |
Excludes vendor files, test databases, profiling data, IDE-specific files, and Go workspace files. |
v2/.golangci.yml |
Introduces configuration for tests, linters, and issue reporting limits. |
v2/cmd/... (multiple files) |
Adds CLI functionality for database operations like data generation, snapshots, rollback, and scanning. |
v2/export.go |
Introduces functionality for exporting tree structures with traversal order options. |
v2/internal/encoding.go , encoding_test.go |
Adds encoding/decoding functionality for varint length-prefixed byte slices and related tests. |
v2/iterator.go |
Implements iterators for traversing tree structures and leaf nodes. |
v2/metrics/metrics.go |
Introduces metrics tracking for pools, trees, and database operations. |
v2/migrate/... (multiple files) |
Adds functionality for migrating database versions and managing readonly stores. |
v2/multitree.go |
Introduces MultiTree for managing multiple tree instances. |
v2/node.go , v2/pool.go |
Enhances node management within trees and introduces a node pool for memory management. |
v2/range.go |
Adds a VersionRange struct for managing and querying version ranges. |
v2/sh/rollback.sh |
Provides a bash script for database rollback operations. |
v2/snapshot.go , v2/sqlite... (multiple files) |
Introduces snapshot management and SQLite integration for efficient data storage and retrieval. |
v2/testutil/util.go |
Adds utility functions for configuring tree build options for testing. |
v2/tree.go , v2/visualize.go |
Enhances tree management and introduces visualization of tree structures. |
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?
Rollback feature is missed (DeleteVersionsFrom in v1). @kocubinski, I think MultiTree has the potential advantages in terms of deferred pruning and also would be easy to manage the flow, for example resolving the conflicts between export/import and pruning
how do we test v2 ?
gonna merge this as john is working iavlv2 cleann
See also: https://hackmd.io/rXq7coSyTFmhWIa4mifBYQ
For a complete end to end test, this version of code is running on an osmosis node syncing on mainnet, some metrics are viewable at this Grafana. Sync started from block
13946655
after an export ofapplication.db
to an iavl v2 SQLite database with the code in./migrate
in this PR.Sync rates as fast as ~10 blocks per second are observed, most of the spikiness in commit rate is spent waiting on blocks from consensus, but I don't have a way to show this in telemetry. AFAIK this is about 2x from iavl v1 with osmosis, I don't see evidence that the osmosis build is I/O bound on disk either as benchmarks put max throughput 10-20x iavl v1.
This configuration is using 45G of disk storage, down from 177G. Checkpoints are taken every 5k blocks, with a WAL maintained on each commit. Pruning occurs every 900 blocks with the last 5k blocks kept, therefore the last checkpoint always contains a fully materialized tree.