Skip to content

fix: ensure range requests in txn are executed on all cluster members#21432

Open
kairosci wants to merge 1 commit intoetcd-io:mainfrom
kairosci:fix/18667-txn-range-consistency
Open

fix: ensure range requests in txn are executed on all cluster members#21432
kairosci wants to merge 1 commit intoetcd-io:mainfrom
kairosci:fix/18667-txn-range-consistency

Conversation

@kairosci
Copy link

@kairosci kairosci commented Mar 4, 2026

Summary

Root Cause

When a client makes a txn with a range request (e.g., get key --rev=X), if the revision has been compacted:

  • On members where the range request is executed, the txn fails with ErrCompacted
  • On members where the range request was removed by removeNeedlessRangeReqs, the txn proceeds and executes the write operations (put/delete)

This leads to data inconsistency across cluster members.

Solution

Remove the optimization that removes range requests from read-only txns. This ensures all cluster members execute the same validation and maintain consistent data.

Testing

  • All existing tests pass
  • The fix ensures that when a txn with a range request fails (e.g., due to ErrCompacted), it fails consistently across all cluster members

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kairosci
Once this PR has been reviewed and has the lgtm label, please assign fuweid for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link

Hi @kairosci. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kairosci kairosci marked this pull request as draft March 4, 2026 21:26
@kairosci kairosci force-pushed the fix/18667-txn-range-consistency branch 2 times, most recently from 49a2760 to d649536 Compare March 4, 2026 21:28
@k8s-ci-robot k8s-ci-robot added size/S and removed size/L labels Mar 4, 2026
@kairosci kairosci force-pushed the fix/18667-txn-range-consistency branch from d649536 to 716f743 Compare March 4, 2026 21:29
@kairosci kairosci marked this pull request as ready for review March 4, 2026 21:30
@kairosci kairosci marked this pull request as draft March 4, 2026 21:40
@kairosci kairosci force-pushed the fix/18667-txn-range-consistency branch from 39bc34d to 9196a59 Compare March 4, 2026 21:59
…-io#18667

Ensure range requests in transactions are executed only on the requester member,
while all members validate for consistency. This fixes data inconsistency issues
when range requests have specific revisions that may be compacted on non-requester
members.

Signed-off-by: Alessio Attilio <attilio.alessio@protonmail.com>
@kairosci kairosci force-pushed the fix/18667-txn-range-consistency branch from 9196a59 to 7645fe8 Compare March 4, 2026 22:11
@kairosci kairosci marked this pull request as ready for review March 4, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants