tests/integration: Update TestLeasingDeleteRangeContendTxn #15425
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.
The TestLeasingDeleteRangeContendTxn is trying to test for RangeDelete when the target resources are being updated. When the
txnLeasing
wants a server-side transaction, it needs to ensure all the keys mod revision should be leass than what it saw. If the compare fails, it will repeat to apply the server-side transaction until it is sucessful. I believe the test-case is trying to verify how thetxnLeasing
handles the race issue.Before the patch #15401, the resource-updating goroutine keeps updating until the RangeDelete finishes. The testcase is flaky because two goroutines are sharing one
ctx
and grpc-go client won't wait for the response ifctx
has been canceled.For example,
So
raw-cli
gets[key/0=123]
while theputkv
gets[]
. Ifputkv
applies two update reqs to ETCD server and the last one is canceled before apply, the error will be like:The resource-updating goroutine should not share the ctx with RangeDelete here. And I also revert current main branch because the resource-update goroutine only updates 8 times and might exit before
RangeDelete
. In this case, thetxnLeasing
is not handling the race issue.Fixes: #15352
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.
cc @ahrtr @chaochn47 @serathius @tjungblu