feat(raft): add nested transaction and CAS support#111
Merged
Conversation
Switch RaftRequest/RaftResponse serialization from rkyv to bincode to support recursive Txn types. Add Request::Txn/Response::Txn variants with nested Txn execution in the state machine sharing WriteBatch for atomicity. Fixes: - rollback() lease reconciliation order (reconcile before restore) - Txn Get/Range/compare reads uncommitted values from value_cache - Nested Txn auth check recursively validates sub-operations - MAX_TXN_DEPTH=1 at API boundary prevents stack overflow Add 15 CAS tests + 2 nested Txn tests covering all compare targets, results, failure branches, and uncommitted value reads.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add compare-and-swap (CAS) transaction support with nested Txn capability. Switch RaftRequest/RaftResponse serialization from rkyv to bincode to enable recursive types. Fix several bugs discovered during implementation review.
Changes
bincode = "1"dependency.TxnRequest txn/TxnResponse txntoRequestOp/ResponseOpfor nested Txn proto support.TxnRequest,TxnResponsestructs. AddRequest::Txn(Box<TxnRequest>)andResponse::Txn(Box<TxnResponse>)variants.RaftRequest/RaftResponseserialization from rkyv to bincode.evaluate_comparemethod. Implement nested Txn execution sharing parent'sWriteBatchfor atomicity. FixTxnSnapshot::rollback()lease reconciliation order. FixGet/Range/comparewithin Txn to read fromvalue_cachefor uncommitted values.convert_compares,convert_response_ops,convert_kvhelpers.convert_request_opsbecomes fallible withMAX_TXN_DEPTH=1depth limit. Add recursivecheck_txn_ops_permissionsfor nested Txn auth. Addraft::Response::Txnhandling in response conversion.extract_txn_keysrecursively handles nested Txn.Testing
How to verify
cargo build cargo test -p aether --lib cargo clippy -- -D warnings cargo fmt -- --checkRelated issues
Refs #82