feat(ecstore): protect streaming GETs with snapshot leases - #5391
Merged
Conversation
Contributor
|
CLA requirements are satisfied for this pull request. |
…lease' into cxymds/feat-1526-remote-snapshot-lease
…-lease' into cxymds/feat-1526-get-snapshot-lease
Contributor
There was a problem hiding this comment.
Pull request overview
This PR integrates snapshot-lease protection into streaming GET so the namespace read lock can be released once read-quorum snapshot safety is established, allowing concurrent overwrites without invalidating an in-flight response.
Changes:
- Adds snapshot-lease RPC messages, canonical-body digest binding, and NodeService handlers (including TTL bounds and server-side expiry scheduling).
- Extends Disk APIs (local + remote) with acquire/renew/release lease operations and token parsing/validation.
- Wires lease acquisition + periodic renewal into the ecstore streaming GET path, with drop/EOF/error cleanup and fallback to holding the namespace lock.
Reviewed changes
Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rustfs/src/storage/storage_api.rs | Exposes SnapshotLeaseToken and extends StorageDiskRpcExt with snapshot-lease methods. |
| rustfs/src/storage/rpc/node_service/disk.rs | Implements snapshot-lease RPC handlers + TTL validation + server-side expiry scheduler. |
| rustfs/src/storage/rpc/node_service.rs | Stores the lease expiry scheduler in NodeService and wires the new RPC methods. |
| rustfs/Cargo.toml | Enables tokio-util time feature to support DelayQueue. |
| crates/protos/src/node.proto | Adds snapshot-lease request/response messages and RPC definitions. |
| crates/protos/src/lib.rs | Adds canonical-body builders for snapshot-lease RPCs and canonical binding tests. |
| crates/protos/src/generated/proto_gen/node_service.rs | Regenerates prost/tonic bindings for new messages/RPCs. |
| crates/ecstore/src/set_disk/ops/object.rs | Acquires snapshot leases for streaming GET and replaces lock guarding with SnapshotLeaseReader when possible. |
| crates/ecstore/src/set_disk/mod.rs | Adds lease state/renewal machinery, wraps streaming bodies, and adds integration tests for overwrite/drop behavior. |
| crates/ecstore/src/disk/mod.rs | Adds token parsing/byte serialization and DiskAPI renew support. |
| crates/ecstore/src/disk/local.rs | Implements local-disk lease renewal and updates tests for superseded-token idempotency. |
| crates/ecstore/src/disk/disk_store.rs | Routes renew through disk health tracking wrapper. |
| crates/ecstore/src/cluster/rpc/remote_disk.rs | Implements remote acquire/renew/release RPC calls and validates protocol/token in responses. |
| crates/ecstore/src/api/mod.rs | Re-exports SnapshotLeaseToken via the ecstore API module. |
| crates/e2e_test/src/reliant/grpc_lock_server.rs | Updates minimal NodeService test double to include new unimplemented lease RPCs. |
| Cargo.lock | Locks additional deps pulled in by enabling tokio-util time support. |
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
…snapshot-lease # Conflicts: # crates/protos/src/lib.rs # crates/protos/src/node.proto
cxymds
marked this pull request as ready for review
July 29, 2026 13:22
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.
Related Issues
Related to rustfs/backlog#1526.
Stacked on #5389.
Summary of Changes
Verification
cargo test -p rustfs-ecstore snapshot_lease_acquisition_is_all_or_nothing --libcargo test -p rustfs-ecstore snapshot_lease_reader_fails_when_renewal_fails --libcargo test -p rustfs-ecstore streaming_get_snapshot_survives_concurrent_overwrite --libcargo fmt --all --checkgit diff --checkmake pre-commitImpact
When the GET lock optimization is enabled, streaming reads can release the namespace lock after snapshot protection is established, so concurrent overwrites proceed without invalidating the in-flight response. Mixed-version or lease-degraded clusters fail safely by retaining the existing lock for the response lifetime. No configuration or public API changes are introduced.
Additional Notes
High-risk adversarial validation:
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md). If this is your first contribution, review the CLA document and sign it by commenting
I have read and agree to the CLA.on the PR.