Skip to content

Commit

Permalink
storage: add TestMVCCHistories cases
Browse files Browse the repository at this point in the history
This patch adds additional test cases for `TestMVCCHistories`. These
were primarily designed by deliberately introducing bugs in MVCC code
that did not cause existing test cases to fail.

Release note: None
  • Loading branch information
erikgrinaker committed Sep 30, 2022
1 parent ded6767 commit aaac54c
Show file tree
Hide file tree
Showing 10 changed files with 2,237 additions and 1,017 deletions.
27 changes: 26 additions & 1 deletion pkg/storage/testdata/mvcc_histories/delete_range_predicate
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ meta: "i"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=7.000000000,0
data: "i"/7.000000000,0 -> /BYTES/i7
stats: key_count=8 key_bytes=160 val_count=12 val_bytes=111 range_key_count=2 range_key_bytes=27 range_val_count=2 live_count=3 live_bytes=111 gc_bytes_age=17863 intent_count=1 intent_bytes=19 separated_intent_count=1 intent_age=93

# error on intent, no tombstones should be written
# Error on intent, no tombstones should be written. We try both the
# point tombstone and range tombstone paths.
run stats error
del_range_pred k=a end=p ts=6 startTime=1
----
Expand All @@ -95,6 +96,30 @@ data: "i"/7.000000000,0 -> /BYTES/i7
stats: key_count=8 key_bytes=160 val_count=12 val_bytes=111 range_key_count=2 range_key_bytes=27 range_val_count=2 live_count=3 live_bytes=111 gc_bytes_age=17863 intent_count=1 intent_bytes=19 separated_intent_count=1 intent_age=93
error: (*roachpb.WriteIntentError:) conflicting intents on "i"

run stats error
del_range_pred k=i end=+i ts=6 startTime=1
----
>> del_range_pred k=i end=+i ts=6 startTime=1
stats: no change
>> at end:
rangekey: {f-h\x00}/[5.000000000,0=/<empty>]
rangekey: {k-p}/[4.000000000,0=/<empty>]
data: "a"/4.000000000,0 -> /<empty>
data: "a"/2.000000000,0 -> /BYTES/a2
data: "b"/3.000000000,0 -> /BYTES/b3
data: "d"/5.000000000,0 -> /<empty>
data: "d"/4.000000000,0 -> /BYTES/d4
data: "d"/1.000000000,0 -> /BYTES/d1
data: "e"/2.000000000,0 -> /BYTES/e2
data: "f"/4.000000000,0 -> /BYTES/f4
data: "g"/4.000000000,0 -> /<empty>
data: "g"/2.000000000,0 -> /BYTES/g2
data: "h"/4.000000000,0 -> /BYTES/h4
meta: "i"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=7.000000000,0 min=0,0 seq=0} ts=7.000000000,0 del=false klen=12 vlen=7 mergeTs=<nil> txnDidNotUpdateMeta=true
data: "i"/7.000000000,0 -> /BYTES/i7
stats: key_count=8 key_bytes=160 val_count=12 val_bytes=111 range_key_count=2 range_key_bytes=27 range_val_count=2 live_count=3 live_bytes=111 gc_bytes_age=17863 intent_count=1 intent_bytes=19 separated_intent_count=1 intent_age=93
error: (*roachpb.WriteIntentError:) conflicting intents on "i"

# error encountering point key at d5.
# a tombstone should not get written at c5 or e5, since
# DeleteRange didn't flush before reaching d5.
Expand Down
606 changes: 606 additions & 0 deletions pkg/storage/testdata/mvcc_histories/delete_range_predicate_complex

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

557 changes: 308 additions & 249 deletions pkg/storage/testdata/mvcc_histories/range_tombstone_stats_intent_rewrite

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,49 @@ data: "n"/3.000000000,0 -> /<empty>
meta: "p"/0,0 -> txn={<nil>} ts=0,0 del=false klen=0 vlen=0 raw=/BYTES/p0 mergeTs=<nil> txnDidNotUpdateMeta=false
error: (*roachpb.WriteTooOldError:) WriteTooOldError: write for key "l" at timestamp 3.000000000,0 too old; wrote at 4.000000000,1

# Writing at the timestamp of a point or range key errors.
run error
del_range_ts k=e end=f ts=4 idempotent
----
>> at end:
rangekey: {a-d}/[3.000000000,0=/<empty>]
rangekey: {k-m}/[4.000000000,0=/<empty>]
rangekey: {m-o}/[4.000000000,0=/<empty> 2.000000000,0=/<empty>]
data: "a"/4.000000000,0 -> /<empty>
data: "a"/2.000000000,0 -> /BYTES/a2
data: "c"/4.000000000,0 -> /BYTES/c4
data: "e"/4.000000000,0 -> /BYTES/e4
data: "f"/4.000000000,0 -> /<empty>
data: "g"/2.000000000,0 -> /BYTES/g2
meta: "i"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=6.000000000,0 min=0,0 seq=0} ts=6.000000000,0 del=false klen=12 vlen=7 mergeTs=<nil> txnDidNotUpdateMeta=true
data: "i"/6.000000000,0 -> /BYTES/i6
data: "k"/3.000000000,0 -> /BYTES/k3
data: "m"/1.000000000,0 -> /BYTES/m1
data: "n"/3.000000000,0 -> /<empty>
meta: "p"/0,0 -> txn={<nil>} ts=0,0 del=false klen=0 vlen=0 raw=/BYTES/p0 mergeTs=<nil> txnDidNotUpdateMeta=false
error: (*roachpb.WriteTooOldError:) WriteTooOldError: write for key "e" at timestamp 4.000000000,0 too old; wrote at 4.000000000,1

run error
del_range_ts k=l end=m ts=4 idempotent
----
>> at end:
rangekey: {a-d}/[3.000000000,0=/<empty>]
rangekey: {k-m}/[4.000000000,0=/<empty>]
rangekey: {m-o}/[4.000000000,0=/<empty> 2.000000000,0=/<empty>]
data: "a"/4.000000000,0 -> /<empty>
data: "a"/2.000000000,0 -> /BYTES/a2
data: "c"/4.000000000,0 -> /BYTES/c4
data: "e"/4.000000000,0 -> /BYTES/e4
data: "f"/4.000000000,0 -> /<empty>
data: "g"/2.000000000,0 -> /BYTES/g2
meta: "i"/0,0 -> txn={id=00000000 key=/Min pri=0.00000000 epo=0 ts=6.000000000,0 min=0,0 seq=0} ts=6.000000000,0 del=false klen=12 vlen=7 mergeTs=<nil> txnDidNotUpdateMeta=true
data: "i"/6.000000000,0 -> /BYTES/i6
data: "k"/3.000000000,0 -> /BYTES/k3
data: "m"/1.000000000,0 -> /BYTES/m1
data: "n"/3.000000000,0 -> /<empty>
meta: "p"/0,0 -> txn={<nil>} ts=0,0 del=false klen=0 vlen=0 raw=/BYTES/p0 mergeTs=<nil> txnDidNotUpdateMeta=false
error: (*roachpb.WriteTooOldError:) WriteTooOldError: write for key "l" at timestamp 4.000000000,0 too old; wrote at 4.000000000,1

# Writing below intents error.
run error
del_range_ts k=i end=j ts=3 idempotent
Expand Down

0 comments on commit aaac54c

Please sign in to comment.