Skip to content

Fix the costTxnReq ignores nested RequestTxn issue#22134

Merged
ahrtr merged 2 commits into
etcd-io:mainfrom
ahrtr:20260721_txn_quota
Jul 21, 2026
Merged

Fix the costTxnReq ignores nested RequestTxn issue#22134
ahrtr merged 2 commits into
etcd-io:mainfrom
ahrtr:20260721_txn_quota

Conversation

@ahrtr

@ahrtr ahrtr commented Jul 21, 2026

Copy link
Copy Markdown
Member

The costTxnReq ignores nested RequestTxn, so it may bypass backend quota check.

cc @fuweid @ivanvc @serathius

Without the second commit, the unit test reproduces the issue. After applying the patch (second commit), the test passes.

$ go test -run TestCostTxn -v
=== RUN   TestCostTxn
=== RUN   TestCostTxn/flat_put
=== RUN   TestCostTxn/nested_txn_put_in_success_branch_must_be_counted
    quota_test.go:77: 
        	Error Trace:	/Users/wachao/go/src/github.com/ahrtr/etcd/server/storage/quota_test.go:77
        	Error:      	Not equal: 
        	            	expected: 278
        	            	actual  : 0
        	Test:       	TestCostTxn/nested_txn_put_in_success_branch_must_be_counted
=== RUN   TestCostTxn/nested_txn_put_in_failure_branch_must_be_counted
    quota_test.go:77: 
        	Error Trace:	/Users/wachao/go/src/github.com/ahrtr/etcd/server/storage/quota_test.go:77
        	Error:      	Not equal: 
        	            	expected: 278
        	            	actual  : 0
        	Test:       	TestCostTxn/nested_txn_put_in_failure_branch_must_be_counted
--- FAIL: TestCostTxn (0.00s)
    --- PASS: TestCostTxn/flat_put (0.00s)
    --- FAIL: TestCostTxn/nested_txn_put_in_success_branch_must_be_counted (0.00s)
    --- FAIL: TestCostTxn/nested_txn_put_in_failure_branch_must_be_counted (0.00s)
FAIL
exit status 1
FAIL	go.etcd.io/etcd/server/v3/storage	0.407s

ahrtr added 2 commits July 21, 2026 16:04
…RequestTxn

Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
Signed-off-by: Benjamin Wang <benjamin.ahrtr@gmail.com>
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.64%. Comparing base (81e09b0) to head (f1f8893).

Additional details and impacted files
Files with missing lines Coverage Δ
server/storage/quota.go 67.10% <100.00%> (+0.43%) ⬆️

... and 27 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #22134      +/-   ##
==========================================
- Coverage   69.66%   69.64%   -0.03%     
==========================================
  Files         449      449              
  Lines       38177    38178       +1     
==========================================
- Hits        26597    26589       -8     
- Misses      10148    10155       +7     
- Partials     1432     1434       +2     

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 81e09b0...f1f8893. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ivanvc ivanvc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that the first commit breaks the tests. Thanks for the fix.

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, fuweid, ivanvc

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [ahrtr,fuweid,ivanvc]

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

@ahrtr
ahrtr merged commit 7294df1 into etcd-io:main Jul 21, 2026
34 checks passed
@ahrtr

ahrtr commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

/cherry-pick release-3.7

@ahrtr

ahrtr commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

/cherry-pick release-3.6

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@ahrtr: new pull request created: #22139

Details

In response to this:

/cherry-pick release-3.7

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.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@ahrtr: new pull request created: #22140

Details

In response to this:

/cherry-pick release-3.6

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.

@ahrtr

ahrtr commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

/cherry-pick release-3.5

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown

@ahrtr: new pull request created: #22162

Details

In response to this:

/cherry-pick release-3.5

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.

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.

4 participants