forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
storage: repro a series of intent resolution bugs with ignored seq nums
The logic in mvccResolveWriteIntent is structured in such a way that if an intent contains both ignored and non-ignored seq nums in its intent history, the intent may end up being updated instead of aborted or unmodified. For the following examples, assume the intent has a history ["a", "b"] where "a" is written first, and "b" is ignored. 1. The intent resolution has status aborted. Instead of aborting the intent, it is modified to have value "a" and an empty intent history. 2. The intent resolution has status pending, and the intent has a lower epoch than the resolution. The intent should be aborted because the new epoch may not write it again. Instead, it is updated with value "a" and an empty intent history. 3. Same as 2 but the intent resolution has status committed. 4. The intent resolution has status pending, the intent is not pushed and has a higher epoch than the resolution. The intent should not be updated because the intent history is updated only when the epochs match. Instead, it is updated with value "a" and an empty intent history. 5. Same as 4 but the intent is pushed. The intent should be updated to bump its timestamp in order to unblock the pusher. The intent history should not be updated for the same reason as in 3. Instead, the intent is updated with value "a" and an empty intent history. Additionally, in cases 1, 2, 3 and 4 above, the resulting intent is not committed but a MVCCCommitIntentOp is logged erroneously. This commit only reproduces the bugs. Informs: cockroachdb#117553 Release note: None
- Loading branch information
1 parent
45bc7dc
commit 0e44a0f
Showing
3 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
31 changes: 31 additions & 0 deletions
31
pkg/storage/testdata/mvcc_histories/ignored_seq_nums_abort
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Abort an intent whose history includes ignored seq nums. | ||
# The test exposes a bug where even though the transaction is aborted, its | ||
# intent is updated instead of aborted. | ||
|
||
# The test exposes a bug where even though the transaction is aborted, its | ||
# intent is updated instead of aborted. | ||
# Moreover, it logs MVCCCommitIntentOp instead of MVCCUpdateIntentOp. | ||
|
||
run ok log-ops | ||
with t=A k=k | ||
txn_begin ts=11 | ||
txn_step seq=10 | ||
put v=a | ||
txn_step seq=20 | ||
put v=b | ||
txn_step seq=30 | ||
txn_ignore_seqs seqs=(15-25) | ||
resolve_intent status=ABORTED | ||
get | ||
---- | ||
put: lock acquisition = {k id=00000001 key="k" iso=Serializable pri=0.00000000 epo=0 ts=11.000000000,0 min=0,0 seq=10 Replicated Intent []} | ||
put: lock acquisition = {k id=00000001 key="k" iso=Serializable pri=0.00000000 epo=0 ts=11.000000000,0 min=0,0 seq=20 Replicated Intent []} | ||
resolve_intent: "k" -> resolved key = true | ||
get: "k" -> /BYTES/a @11.000000000,0 | ||
>> at end: | ||
txn: "A" meta={id=00000001 key="k" iso=Serializable pri=0.00000000 epo=0 ts=11.000000000,0 min=0,0 seq=30} lock=true stat=PENDING rts=11.000000000,0 wto=false gul=0,0 isn=1 | ||
meta: "k"/0,0 -> txn={id=00000001 key="k" iso=Serializable pri=0.00000000 epo=0 ts=11.000000000,0 min=0,0 seq=10} ts=11.000000000,0 del=false klen=12 vlen=6 mergeTs=<nil> txnDidNotUpdateMeta=false | ||
data: "k"/11.000000000,0 -> /BYTES/a | ||
logical op: *enginepb.MVCCWriteIntentOp | ||
logical op: *enginepb.MVCCUpdateIntentOp | ||
logical op: *enginepb.MVCCCommitIntentOp |
This file contains 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