Closed cool-develope closed 3 months ago
The recent changes focus on enhancing synchronization and performance within a tree data structure, particularly through the introduction of lazy pruning, renaming methods for clarity on synchronous operations, and adjusting control flow in test scenarios. Major updates include the implementation of lazy pruning to improve commit flow efficiency, synchronization enhancements by renaming deletion methods, and modifications in node handling to support these improvements. These changes aim to address performance bottlenecks and improve the overall robustness of the system.
Files | Change Summary |
---|---|
export_test.go, iterator_test.go, ... | Renamed DeleteVersionsTo to DeleteVersionsToSync ; updated test logic for synchronization. |
import.go | Adjusted batch.Set method call within a conditional statement. |
migrate_test.go | Removed dbType parameter, updated method calls, and introduced new logic for pruning. |
mutable_tree.go, mutable_tree_test.go | Added methods for commit state management and synchronous version deletion; updated comments. |
nodedb.go | Enhanced committing state management, pruning operations, and orphan handling with new fields/methods. |
batch.go | Modified Set and Delete methods to internally call Write for flushing batches. |
node.go | Added isLegacy field and logic to handle legacy nodes differently. |
benchmarks/bench_test.go | Replaced DeleteVersionsTo with DeleteVersionsToSync in commitTree function. |
Objective | Addressed | Explanation |
---|---|---|
Implement lazy pruning in IAVL v1 (#885) | ✅ | |
Run the internal pruning loop process | ✅ | |
Store the version in the Prune function |
✅ | |
Setup channel between SaveVersion and internal pruning process |
✅ | The changes indicate the setup of a channel for communication, aligning with the issue's proposal. |
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?
The lazy pruning feature is not working properly since multi trees share the same db backend in store
close in favor of #909
Implement the deferred pruning
Closes: #885
Fix
When the root refers to the legacy root, it will reformat the legacy node as a new node key format. This node is removed while pruning but it is still being referred by the forward version. Another issue with the reference node, it can refer to the internal node, not only the root. For example, if there are no adds, just removes, then the leaf or inner node can be the root.
nodeKey
instead of only the version as a reference node valuenodeKey
to distinguish with the root. It will also be applied for the case of when pruning the version, reformat the given root nodeKey to (version, 0).