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: store encoded MVCCValues in SequencedIntents
This commit switches from storing encoded `roachpb.Value`s to storing encoded `storage.MVCCValue`s in `MVCCMetadata`'s `SequencedIntent`s. Doing so ensures that MVCCValue headers are not lost when an intent is rolled back. This is important to avoid losing the local timestamp of values in a key's intent history. Failure to do so could allow for stale reads.
- Loading branch information
1 parent
1bcf950
commit a3e608d
Showing
7 changed files
with
138 additions
and
75 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
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
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
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
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
46 changes: 46 additions & 0 deletions
46
pkg/storage/testdata/mvcc_histories/ignored_seq_nums_with_local_timestamps
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,46 @@ | ||
# Perform some writes at various sequence numbers with local timestamps. | ||
|
||
run ok | ||
with t=A | ||
txn_begin ts=50 | ||
txn_step seq=15 | ||
put k=k v=a localTs=15,0 | ||
txn_step seq=20 | ||
put k=k v=b localTs=20,0 | ||
txn_step seq=25 | ||
put k=k v=c localTs=25,0 | ||
---- | ||
>> at end: | ||
txn: "A" meta={id=00000000 key=/Min pri=0.00000000 epo=0 ts=50.000000000,0 min=0,0 seq=25} lock=true stat=PENDING rts=50.000000000,0 wto=false gul=0,0 | ||
meta: "k"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=50.000000000,0 min=0,0 seq=25} ts=50.000000000,0 del=false klen=12 vlen=19 ih={{15 vheader{ localTs=15.000000000,0 } /BYTES/a}{20 vheader{ localTs=20.000000000,0 } /BYTES/b}} mergeTs=<nil> txnDidNotUpdateMeta=false | ||
data: "k"/50.000000000,0 -> vheader{ localTs=25.000000000,0 } /BYTES/c | ||
|
||
# Rollback to a previous sequence number. Should be able to read before and | ||
# after resolving the intent. | ||
|
||
run ok | ||
with t=A | ||
txn_ignore_seqs seqs=(25-25) | ||
get k=k | ||
resolve_intent k=k status=PENDING | ||
get k=k | ||
---- | ||
get: "k" -> /BYTES/b @50.000000000,0 | ||
get: "k" -> /BYTES/b @50.000000000,0 | ||
>> at end: | ||
txn: "A" meta={id=00000000 key=/Min pri=0.00000000 epo=0 ts=50.000000000,0 min=0,0 seq=25} lock=true stat=PENDING rts=50.000000000,0 wto=false gul=0,0 isn=1 | ||
meta: "k"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=50.000000000,0 min=0,0 seq=20} ts=50.000000000,0 del=false klen=12 vlen=19 ih={{15 vheader{ localTs=15.000000000,0 } /BYTES/a}} mergeTs=<nil> txnDidNotUpdateMeta=false | ||
data: "k"/50.000000000,0 -> vheader{ localTs=20.000000000,0 } /BYTES/b | ||
|
||
# Rollback and commit at a previous sequence number. Committed value should have | ||
# original local timestamp. This is important to avoid losing the local timestamp | ||
# of values in a key's intent history. | ||
|
||
run ok | ||
with t=A | ||
txn_ignore_seqs seqs=(20-20) | ||
resolve_intent k=k status=COMMITTED | ||
---- | ||
>> at end: | ||
txn: "A" meta={id=00000000 key=/Min pri=0.00000000 epo=0 ts=50.000000000,0 min=0,0 seq=25} lock=true stat=PENDING rts=50.000000000,0 wto=false gul=0,0 isn=1 | ||
data: "k"/50.000000000,0 -> vheader{ localTs=15.000000000,0 } /BYTES/a |
Oops, something went wrong.