From a01757dcf60de508d3cec45789857c55135c2ee1 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Tue, 25 Apr 2023 12:46:37 -0400 Subject: [PATCH 1/2] kv: delete TestApplier/txn-error The subtest was fooling itself. Only tests that end in "-err" return errors. We already had a `TestApplier/txn-err` subtest, so we just delete this one. Epic: None Release note: None --- pkg/kv/kvnemesis/applier_test.go | 3 --- pkg/kv/kvnemesis/testdata/TestApplier/addsstable | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/merge | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/merge-again | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/split | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/split-again | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/transfer | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/transfer-again | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/txn-error | 6 ------ 9 files changed, 7 insertions(+), 16 deletions(-) delete mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-error diff --git a/pkg/kv/kvnemesis/applier_test.go b/pkg/kv/kvnemesis/applier_test.go index 225c4247e823..cc38e76982e5 100644 --- a/pkg/kv/kvnemesis/applier_test.go +++ b/pkg/kv/kvnemesis/applier_test.go @@ -145,9 +145,6 @@ func TestApplier(t *testing.T) { { "txn-rollback", step(closureTxn(ClosureTxnType_Rollback, put(k5, 5))), }, - { - "txn-error", step(closureTxn(ClosureTxnType_Rollback, put(k5, 5))), - }, { "split", step(split(k2)), }, diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/addsstable b/pkg/kv/kvnemesis/testdata/TestApplier/addsstable index 69d2fd16c336..95ac83f04c6b 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/addsstable +++ b/pkg/kv/kvnemesis/testdata/TestApplier/addsstable @@ -1,6 +1,6 @@ echo ---- -db1.AddSSTable(ctx, tk(1), tk(4), ... /* @s1 */) // 1252 bytes (as writes) +db0.AddSSTable(ctx, tk(1), tk(4), ... /* @s1 */) // 1252 bytes (as writes) // ^-- tk(1) -> sv(s1): /Table/100/"0000000000000001"/ -> /BYTES/v1 // ^-- tk(2) -> sv(s1): /Table/100/"0000000000000002"/ -> / // ^-- [tk(3), tk(4)) -> sv(s1): /Table/100/"000000000000000{3"-4"} -> / diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/merge b/pkg/kv/kvnemesis/testdata/TestApplier/merge index 262fa20e40e6..b47cd1985dc4 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/merge +++ b/pkg/kv/kvnemesis/testdata/TestApplier/merge @@ -1,3 +1,3 @@ echo ---- -db0.AdminMerge(ctx, tk(1)) // +db1.AdminMerge(ctx, tk(1)) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/merge-again b/pkg/kv/kvnemesis/testdata/TestApplier/merge-again index 097de87b6380..bbe2ac5ee0a7 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/merge-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/merge-again @@ -1,3 +1,3 @@ echo ---- -db0.AdminMerge(ctx, tk(1)) // context canceled +db1.AdminMerge(ctx, tk(1)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/split b/pkg/kv/kvnemesis/testdata/TestApplier/split index 2c98be6da1ff..9d596c5d5ca0 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/split +++ b/pkg/kv/kvnemesis/testdata/TestApplier/split @@ -1,3 +1,3 @@ echo ---- -db1.AdminSplit(ctx, tk(2)) // +db0.AdminSplit(ctx, tk(2)) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/split-again b/pkg/kv/kvnemesis/testdata/TestApplier/split-again index 916303dcfc73..3700715e11fc 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/split-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/split-again @@ -1,3 +1,3 @@ echo ---- -db1.AdminSplit(ctx, tk(2)) // context canceled +db0.AdminSplit(ctx, tk(2)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/transfer b/pkg/kv/kvnemesis/testdata/TestApplier/transfer index 2c9becff21d0..7b94b50c98ac 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/transfer +++ b/pkg/kv/kvnemesis/testdata/TestApplier/transfer @@ -1,3 +1,3 @@ echo ---- -db1.TransferLeaseOperation(ctx, tk(6), 1) // +db0.TransferLeaseOperation(ctx, tk(6), 1) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again b/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again index d34cc822e962..078827f7e02d 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again @@ -1,3 +1,3 @@ echo ---- -db0.TransferLeaseOperation(ctx, tk(6), 1) // context canceled +db1.TransferLeaseOperation(ctx, tk(6), 1) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-error b/pkg/kv/kvnemesis/testdata/TestApplier/txn-error deleted file mode 100644 index 406c0d55dbd6..000000000000 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-error +++ /dev/null @@ -1,6 +0,0 @@ -echo ----- -db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { - txn.Put(ctx, tk(5), sv(5)) // @ - return errors.New("rollback") -}) // rollback From 85ff79600a710933a3beee2cb8e894853fc834a5 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Tue, 25 Apr 2023 13:33:58 -0400 Subject: [PATCH 2/2] kv: teach kvnemesis about isolation levels and snapshot isolation Informs #100169. This commit teaches kvnemesis about transaction isolation levels, and specifically to generate snapshot isolation transaction closures. The commit is strictly plumbing because isolation level is currently a no-op. Once snapshot isolation is implemented, the validator logic in kvnemesis will need to change. Release note: None --- pkg/kv/kvnemesis/BUILD.bazel | 4 + pkg/kv/kvnemesis/applier.go | 3 + pkg/kv/kvnemesis/applier_test.go | 26 ++- pkg/kv/kvnemesis/generator.go | 73 +++++--- pkg/kv/kvnemesis/generator_test.go | 28 ++- pkg/kv/kvnemesis/operations.go | 4 + pkg/kv/kvnemesis/operations.proto | 2 + pkg/kv/kvnemesis/operations_test.go | 2 + .../kvnemesis/testdata/TestApplier/addsstable | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/del-err | 2 +- .../testdata/TestApplier/delrange-err | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/get-err | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/merge | 2 +- .../testdata/TestApplier/merge-again | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/put-err | 2 +- .../kvnemesis/testdata/TestApplier/rscan-err | 2 +- .../testdata/TestApplier/rscan-for-update-err | 2 +- .../testdata/TestApplier/scan-for-update-err | 2 +- pkg/kv/kvnemesis/testdata/TestApplier/split | 2 +- .../testdata/TestApplier/split-again | 2 +- .../kvnemesis/testdata/TestApplier/transfer | 2 +- .../testdata/TestApplier/transfer-again | 2 +- .../{txn-commit-batch => txn-si-commit-batch} | 1 + .../testdata/TestApplier/txn-si-commit-mixed | 14 ++ .../testdata/TestApplier/txn-si-delrange | 8 + .../TestApplier/{txn-err => txn-si-err} | 1 + .../testdata/TestApplier/txn-si-rollback | 7 + .../testdata/TestApplier/txn-ssi-commit-batch | 12 ++ ...{txn-commit-mixed => txn-ssi-commit-mixed} | 1 + .../{txn-delrange => txn-ssi-delrange} | 1 + .../testdata/TestApplier/txn-ssi-err | 7 + .../{txn-rollback => txn-ssi-rollback} | 1 + .../kvnemesis/testdata/TestOperationsFormat/3 | 1 + .../ambiguous_del-del_transaction_committed | 1 + ...el-del_transaction_committed_but_wrong_seq | 1 + .../ambiguous_put-del_transaction_committed | 1 + ...saction_committed_but_has_validation_error | 1 + ...biguous_put-del_transaction_did_not_commit | 1 + .../ambiguous_put-put_transaction_committed | 1 + ...saction_committed_but_has_validation_error | 1 + ...biguous_put-put_transaction_did_not_commit | 1 + ...ter_write_transaction_with_shadowed_delete | 1 + .../TestValidate/one_deleterange_after_write | 1 + ...one_deleterange_after_write_extra_deletion | 1 + .../one_deleterange_after_write_missing_write | 1 + ...eterange_after_write_returning_wrong_value | 1 + ...terange_after_write_with_spurious_deletion | 1 + .../TestValidate/one_deleterange_after_writes | 1 + .../one_deleterange_after_writes_and_delete | 1 + ...rectly_deleting_keys_outside_span_boundary | 1 + ...rites_returning_keys_outside_span_boundary | 1 + ...eleterange_after_writes_with_missing_write | 1 + ...r_writes_with_write_timestamp_disagreement | 1 + ...er_writes_and_delete_returning_missing_key | 2 + ...after_write_and_delete_returning_extra_key | 1 + ...ete_with_write_on_another_key_after_delete | 1 + ...l_deleterange_followed_by_put_after_writes | 1 + ...r_writes_with_write_timestamp_disagreement | 1 + ...l_put_shadowed_by_deleterange_after_writes | 1 + ...r_writes_with_write_timestamp_disagreement | 1 + ...transactional_put_with_correct_commit_time | 1 + ...ansactional_put_with_incorrect_commit_time | 1 + ...scan_followed_by_delete_outside_time_range | 1 + ..._scan_followed_by_delete_within_time_range | 1 + ..._committed_delete_with_first_write_missing | 1 + ...committed_delete_with_second_write_missing | 1 + ...y_committed_delete_with_the_correct_writes | 1 + ...d_delete_with_write_timestamp_disagreement | 1 + ...lly_committed_put_with_first_write_missing | 1 + ...ly_committed_put_with_second_write_missing | 1 + ...ally_committed_put_with_the_correct_writes | 1 + ...tted_put_with_write_timestamp_disagreement | 1 + ..._batch_delete_with_write_correctly_missing | 1 + ...ack_batch_put_with_write_correctly_missing | 1 + ...d_back_delete_with_write_correctly_missing | 1 + ...back_delete_with_write_incorrectly_present | 1 + ...lled_back_put_with_write_correctly_missing | 1 + ...ed_back_put_with_write_incorrectly_present | 1 + ...ansaction_with_incorrect_read_after_delete | 1 + ...ransaction_with_incorrect_read_after_write | 1 + ...nsaction_with_incorrect_read_before_delete | 1 + ...ansaction_with_incorrect_read_before_write | 1 + ...ransaction_with_incorrect_scan_after_write | 1 + ...ansaction_with_incorrect_scan_before_write | 1 + ...nsaction_with_read_before_and_after_delete | 1 + ...ansaction_with_read_before_and_after_write | 1 + ...ansaction_with_scan_before_and_after_write | 1 + ...nal_read_and_write_with_empty_time_overlap | 1 + ...read_and_write_with_non-empty_time_overlap | 1 + ...writes_and_deletes_with_empty_time_overlap | 2 + ...es_and_deletes_with_non-empty_time_overlap | 1 + ...eletes_after_write_with_empty_time_overlap | 1 + ...es_after_write_with_non-empty_time_overlap | 1 + ..._reads_one_missing_with_empty_time_overlap | 1 + ...ds_one_missing_with_non-empty_time_overlap | 1 + ...ransactional_reads_with_empty_time_overlap | 1 + ...actional_reads_with_non-empty_time_overlap | 1 + ...nal_scan_and_write_with_empty_time_overlap | 1 + ...scan_and_write_with_non-empty_time_overlap | 1 + ...scans_after_delete_with_empty_time_overlap | 1 + ...s_after_delete_with_non-empty_time_overlap | 1 + ..._scans_one_missing_with_empty_time_overlap | 1 + ...ns_one_missing_with_non-empty_time_overlap | 1 + ...ransactional_scans_with_empty_time_overlap | 1 + ...actional_scans_with_non-empty_time_overlap | 1 + ...nal_deletes_with_out_of_order_commit_times | 1 + ...tionally_committed_deletes_of_the_same_key | 1 + ...d_deletes_of_the_same_key_with_extra_write | 1 + ...te_ops_of_the_same_key_with_incorrect_read | 1 + ..._put_delete_ops_of_the_same_key_with_reads | 1 + ...sactionally_committed_puts_of_the_same_key | 1 + ...tted_puts_of_the_same_key_with_extra_write | 1 + ..._committed_puts_of_the_same_key_with_reads | 1 + ..._committed_puts_of_the_same_key_with_scans | 1 + ...ommitted_writes_delete_put_of_the_same_key | 1 + ...ommitted_writes_put_delete_of_the_same_key | 1 + ...ut_delete_of_the_same_key_with_extra_write | 1 + pkg/kv/kvnemesis/validator_test.go | 172 +++++++++--------- 118 files changed, 351 insertions(+), 131 deletions(-) rename pkg/kv/kvnemesis/testdata/TestApplier/{txn-commit-batch => txn-si-commit-batch} (88%) create mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-mixed create mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-si-delrange rename pkg/kv/kvnemesis/testdata/TestApplier/{txn-err => txn-si-err} (80%) create mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-si-rollback create mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-batch rename pkg/kv/kvnemesis/testdata/TestApplier/{txn-commit-mixed => txn-ssi-commit-mixed} (88%) rename pkg/kv/kvnemesis/testdata/TestApplier/{txn-delrange => txn-ssi-delrange} (81%) create mode 100644 pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-err rename pkg/kv/kvnemesis/testdata/TestApplier/{txn-rollback => txn-ssi-rollback} (79%) diff --git a/pkg/kv/kvnemesis/BUILD.bazel b/pkg/kv/kvnemesis/BUILD.bazel index 1cb1c8bb1858..8bee62dfc3bf 100644 --- a/pkg/kv/kvnemesis/BUILD.bazel +++ b/pkg/kv/kvnemesis/BUILD.bazel @@ -28,6 +28,7 @@ go_library( "//pkg/kv/kvnemesis/kvnemesisutil", "//pkg/kv/kvpb", "//pkg/kv/kvserver", + "//pkg/kv/kvserver/concurrency/isolation", "//pkg/kv/kvserver/liveness", "//pkg/roachpb", "//pkg/settings/cluster", @@ -77,6 +78,7 @@ go_test( "//pkg/kv/kvnemesis/kvnemesisutil", "//pkg/kv/kvpb", "//pkg/kv/kvserver", + "//pkg/kv/kvserver/concurrency/isolation", "//pkg/roachpb", "//pkg/security/securityassets", "//pkg/security/securitytest", @@ -111,6 +113,7 @@ proto_library( visibility = ["//visibility:public"], deps = [ "//pkg/kv/kvpb:kvpb_proto", + "//pkg/kv/kvserver/concurrency/isolation:isolation_proto", "//pkg/roachpb:roachpb_proto", "//pkg/util/hlc:hlc_proto", "@com_github_cockroachdb_errors//errorspb:errorspb_proto", @@ -126,6 +129,7 @@ go_proto_library( visibility = ["//visibility:public"], deps = [ "//pkg/kv/kvpb", + "//pkg/kv/kvserver/concurrency/isolation", "//pkg/roachpb", "//pkg/util/hlc", "@com_github_cockroachdb_errors//errorspb", diff --git a/pkg/kv/kvnemesis/applier.go b/pkg/kv/kvnemesis/applier.go index 5cf894ddd88f..3db41cb86fff 100644 --- a/pkg/kv/kvnemesis/applier.go +++ b/pkg/kv/kvnemesis/applier.go @@ -145,6 +145,9 @@ func applyOp(ctx context.Context, env *Env, db *kv.DB, op *Operation) { }) var savedTxn *kv.Txn txnErr := db.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + if err := txn.SetIsoLevel(o.IsoLevel); err != nil { + panic(err) + } if savedTxn != nil && txn.TestingCloneTxn().Epoch == 0 { // If the txn's current epoch is 0 and we've run at least one prior // iteration, we were just aborted. diff --git a/pkg/kv/kvnemesis/applier_test.go b/pkg/kv/kvnemesis/applier_test.go index cc38e76982e5..aeeba6597022 100644 --- a/pkg/kv/kvnemesis/applier_test.go +++ b/pkg/kv/kvnemesis/applier_test.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/config/zonepb" + "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/storage" @@ -104,7 +105,10 @@ func TestApplier(t *testing.T) { "delrange", step(delRange(k1, k3, 6)), }, { - "txn-delrange", step(closureTxn(ClosureTxnType_Commit, delRange(k2, k4, 1))), + "txn-ssi-delrange", step(closureTxn(ClosureTxnType_Commit, isolation.Serializable, delRange(k2, k4, 1))), + }, + { + "txn-si-delrange", step(closureTxn(ClosureTxnType_Commit, isolation.Snapshot, delRange(k2, k4, 1))), }, { "get-err", step(get(k1)), @@ -128,7 +132,10 @@ func TestApplier(t *testing.T) { "delrange-err", step(delRange(k2, k3, 12)), }, { - "txn-err", step(closureTxn(ClosureTxnType_Commit, delRange(k2, k4, 1))), + "txn-ssi-err", step(closureTxn(ClosureTxnType_Commit, isolation.Serializable, delRange(k2, k4, 1))), + }, + { + "txn-si-err", step(closureTxn(ClosureTxnType_Commit, isolation.Snapshot, delRange(k2, k4, 1))), }, { "batch-mixed", step(batch(put(k2, 2), get(k1), del(k2, 1), del(k3, 1), scan(k1, k3), reverseScanForUpdate(k1, k5))), @@ -137,13 +144,22 @@ func TestApplier(t *testing.T) { "batch-mixed-err", step(batch(put(k2, 2), getForUpdate(k1), scanForUpdate(k1, k3), reverseScan(k1, k3))), }, { - "txn-commit-mixed", step(closureTxn(ClosureTxnType_Commit, put(k5, 5), batch(put(k6, 6), delRange(k3, k5, 1)))), + "txn-ssi-commit-mixed", step(closureTxn(ClosureTxnType_Commit, isolation.Serializable, put(k5, 5), batch(put(k6, 6), delRange(k3, k5, 1)))), + }, + { + "txn-si-commit-mixed", step(closureTxn(ClosureTxnType_Commit, isolation.Snapshot, put(k5, 5), batch(put(k6, 6), delRange(k3, k5, 1)))), + }, + { + "txn-ssi-commit-batch", step(closureTxnCommitInBatch(isolation.Serializable, opSlice(get(k1), put(k6, 6)), put(k5, 5))), + }, + { + "txn-si-commit-batch", step(closureTxnCommitInBatch(isolation.Snapshot, opSlice(get(k1), put(k6, 6)), put(k5, 5))), }, { - "txn-commit-batch", step(closureTxnCommitInBatch(opSlice(get(k1), put(k6, 6)), put(k5, 5))), + "txn-ssi-rollback", step(closureTxn(ClosureTxnType_Rollback, isolation.Serializable, put(k5, 5))), }, { - "txn-rollback", step(closureTxn(ClosureTxnType_Rollback, put(k5, 5))), + "txn-si-rollback", step(closureTxn(ClosureTxnType_Rollback, isolation.Snapshot, put(k5, 5))), }, { "split", step(split(k2)), diff --git a/pkg/kv/kvnemesis/generator.go b/pkg/kv/kvnemesis/generator.go index 691cca96bcc0..192a6de34ee0 100644 --- a/pkg/kv/kvnemesis/generator.go +++ b/pkg/kv/kvnemesis/generator.go @@ -22,6 +22,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/keys" "github.com/cockroachdb/cockroach/pkg/kv/kvnemesis/kvnemesisutil" kvpb "github.com/cockroachdb/cockroach/pkg/kv/kvpb" + "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/sql/catalog/bootstrap" @@ -63,17 +64,25 @@ type OperationConfig struct { // composition of the operations in the txn is controlled by TxnClientOps and // TxnBatchOps type ClosureTxnConfig struct { + // CommitSerializable is a serializable transaction that commits normally. + CommitSerializable int + // CommitSnapshot is a snapshot transaction that commits normally. + CommitSnapshot int + // RollbackSerializable is a serializable transaction that encounters an error + // at the end and has to roll back. + RollbackSerializable int + // RollbackSnapshot is a snapshot transaction that encounters an error at the + // end and has to roll back. + RollbackSnapshot int + // CommitSerializableInBatch is a serializable transaction that commits via + // the CommitInBatchMethod. This is an important part of the 1pc txn fastpath. + CommitSerializableInBatch int + // CommitSnapshotInBatch is a snapshot transaction that commits via the + // CommitInBatchMethod. This is an important part of the 1pc txn fastpath. + CommitSnapshotInBatch int + TxnClientOps ClientOperationConfig TxnBatchOps BatchOperationConfig - - // Commit is a transaction that commits normally. - Commit int - // Rollback is a transaction that encounters an error at the end and has to - // roll back. - Rollback int - // CommitInBatch is a transaction that commits via the CommitInBatchMethod. - // This is an important part of the 1pc txn fastpath. - CommitInBatch int // When CommitInBatch is selected, CommitBatchOps controls the composition of // the kv.Batch used. CommitBatchOps ClientOperationConfig @@ -208,12 +217,15 @@ func newAllOperationsConfig() GeneratorConfig { DB: clientOpConfig, Batch: batchOpConfig, ClosureTxn: ClosureTxnConfig{ - Commit: 5, - Rollback: 5, - CommitInBatch: 5, - TxnClientOps: clientOpConfig, - TxnBatchOps: batchOpConfig, - CommitBatchOps: clientOpConfig, + CommitSerializable: 3, + CommitSnapshot: 3, + RollbackSerializable: 3, + RollbackSnapshot: 3, + CommitSerializableInBatch: 3, + CommitSnapshotInBatch: 3, + TxnClientOps: clientOpConfig, + TxnBatchOps: batchOpConfig, + CommitBatchOps: clientOpConfig, }, Split: SplitConfig{ SplitNew: 1, @@ -849,16 +861,25 @@ func makeRandBatch(c *ClientOperationConfig) opGenFunc { } func (g *generator) registerClosureTxnOps(allowed *[]opGen, c *ClosureTxnConfig) { + const Commit, Rollback = ClosureTxnType_Commit, ClosureTxnType_Rollback + const SSI, SI = isolation.Serializable, isolation.Snapshot + addOpGen(allowed, + makeClosureTxn(Commit, SSI, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.CommitSerializable) + addOpGen(allowed, + makeClosureTxn(Commit, SI, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.CommitSnapshotInBatch) addOpGen(allowed, - makeClosureTxn(ClosureTxnType_Commit, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.Commit) + makeClosureTxn(Rollback, SSI, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.RollbackSerializable) addOpGen(allowed, - makeClosureTxn(ClosureTxnType_Rollback, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.Rollback) + makeClosureTxn(Rollback, SI, &c.TxnClientOps, &c.TxnBatchOps, nil /* commitInBatch*/), c.RollbackSnapshot) addOpGen(allowed, - makeClosureTxn(ClosureTxnType_Commit, &c.TxnClientOps, &c.TxnBatchOps, &c.CommitBatchOps), c.CommitInBatch) + makeClosureTxn(Commit, SSI, &c.TxnClientOps, &c.TxnBatchOps, &c.CommitBatchOps), c.CommitSerializableInBatch) + addOpGen(allowed, + makeClosureTxn(Commit, SI, &c.TxnClientOps, &c.TxnBatchOps, &c.CommitBatchOps), c.CommitSnapshotInBatch) } func makeClosureTxn( txnType ClosureTxnType, + iso isolation.Level, txnClientOps *ClientOperationConfig, txnBatchOps *BatchOperationConfig, commitInBatch *ClientOperationConfig, @@ -872,7 +893,7 @@ func makeClosureTxn( for i := range ops { ops[i] = g.selectOp(rng, allowed) } - op := closureTxn(txnType, ops...) + op := closureTxn(txnType, iso, ops...) if commitInBatch != nil { if txnType != ClosureTxnType_Commit { panic(errors.AssertionFailedf(`CommitInBatch must commit got: %s`, txnType)) @@ -1012,12 +1033,18 @@ func opSlice(ops ...Operation) []Operation { return ops } -func closureTxn(typ ClosureTxnType, ops ...Operation) Operation { - return Operation{ClosureTxn: &ClosureTxnOperation{Ops: ops, Type: typ}} +func closureTxn(typ ClosureTxnType, iso isolation.Level, ops ...Operation) Operation { + return Operation{ClosureTxn: &ClosureTxnOperation{Ops: ops, Type: typ, IsoLevel: iso}} +} + +func closureTxnSSI(typ ClosureTxnType, ops ...Operation) Operation { + return closureTxn(typ, isolation.Serializable, ops...) } -func closureTxnCommitInBatch(commitInBatch []Operation, ops ...Operation) Operation { - o := closureTxn(ClosureTxnType_Commit, ops...) +func closureTxnCommitInBatch( + iso isolation.Level, commitInBatch []Operation, ops ...Operation, +) Operation { + o := closureTxn(ClosureTxnType_Commit, iso, ops...) if len(commitInBatch) > 0 { o.ClosureTxn.CommitInBatch = &BatchOperation{Ops: commitInBatch} } diff --git a/pkg/kv/kvnemesis/generator_test.go b/pkg/kv/kvnemesis/generator_test.go index 15504bad32ec..59c914c78cae 100644 --- a/pkg/kv/kvnemesis/generator_test.go +++ b/pkg/kv/kvnemesis/generator_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/cockroachdb/cockroach/pkg/kv/kvnemesis/kvnemesisutil" + "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/testutils/datapathutils" "github.com/cockroachdb/cockroach/pkg/testutils/echotest" @@ -172,12 +173,33 @@ func TestRandStep(t *testing.T) { case *ClosureTxnOperation: countClientOps(&counts.ClosureTxn.TxnClientOps, &counts.ClosureTxn.TxnBatchOps, o.Ops...) if o.CommitInBatch != nil { - counts.ClosureTxn.CommitInBatch++ + switch o.IsoLevel { + case isolation.Serializable: + counts.ClosureTxn.CommitSerializableInBatch++ + case isolation.Snapshot: + counts.ClosureTxn.CommitSnapshotInBatch++ + default: + t.Fatalf("unexpected isolation level %s", o.IsoLevel) + } countClientOps(&counts.ClosureTxn.CommitBatchOps, nil, o.CommitInBatch.Ops...) } else if o.Type == ClosureTxnType_Commit { - counts.ClosureTxn.Commit++ + switch o.IsoLevel { + case isolation.Serializable: + counts.ClosureTxn.CommitSerializable++ + case isolation.Snapshot: + counts.ClosureTxn.CommitSnapshot++ + default: + t.Fatalf("unexpected isolation level %s", o.IsoLevel) + } } else if o.Type == ClosureTxnType_Rollback { - counts.ClosureTxn.Rollback++ + switch o.IsoLevel { + case isolation.Serializable: + counts.ClosureTxn.RollbackSerializable++ + case isolation.Snapshot: + counts.ClosureTxn.RollbackSnapshot++ + default: + t.Fatalf("unexpected isolation level %s", o.IsoLevel) + } } case *SplitOperation: if _, ok := splits[string(o.Key)]; ok { diff --git a/pkg/kv/kvnemesis/operations.go b/pkg/kv/kvnemesis/operations.go index 74048534f847..6a6b50c9bea2 100644 --- a/pkg/kv/kvnemesis/operations.go +++ b/pkg/kv/kvnemesis/operations.go @@ -162,6 +162,10 @@ func (op Operation) format(w *strings.Builder, fctx formatCtx) { newFctx.receiver = txnName w.WriteString(fctx.receiver) fmt.Fprintf(w, `.Txn(ctx, func(ctx context.Context, %s *kv.Txn) error {`, txnName) + w.WriteString("\n") + w.WriteString(newFctx.indent) + w.WriteString(newFctx.receiver) + fmt.Fprintf(w, `.SetIsoLevel(isolation.%s)`, o.IsoLevel) formatOps(w, newFctx, o.Ops) if o.CommitInBatch != nil { newFctx.receiver = `b` diff --git a/pkg/kv/kvnemesis/operations.proto b/pkg/kv/kvnemesis/operations.proto index 19f4ac1f53af..7380e5c509c0 100644 --- a/pkg/kv/kvnemesis/operations.proto +++ b/pkg/kv/kvnemesis/operations.proto @@ -15,6 +15,7 @@ option go_package = "github.com/cockroachdb/cockroach/pkg/kv/kvnemesis"; import "errorspb/errors.proto"; import "gogoproto/gogo.proto"; import "kv/kvpb/api.proto"; +import "kv/kvserver/concurrency/isolation/levels.proto"; import "roachpb/data.proto"; import "util/hlc/timestamp.proto"; @@ -34,6 +35,7 @@ message ClosureTxnOperation { repeated Operation ops = 2 [(gogoproto.nullable) = false]; BatchOperation commit_in_batch = 3; ClosureTxnType type = 4; + cockroach.kv.kvserver.concurrency.isolation.Level iso_level = 7; Result result = 5 [(gogoproto.nullable) = false]; roachpb.Transaction txn = 6; } diff --git a/pkg/kv/kvnemesis/operations_test.go b/pkg/kv/kvnemesis/operations_test.go index 6d435ca5d130..5c24e2034477 100644 --- a/pkg/kv/kvnemesis/operations_test.go +++ b/pkg/kv/kvnemesis/operations_test.go @@ -16,6 +16,7 @@ import ( "strings" "testing" + "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/isolation" "github.com/cockroachdb/cockroach/pkg/roachpb" "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/storage" @@ -77,6 +78,7 @@ func TestOperationsFormat(t *testing.T) { { step: step( closureTxn(ClosureTxnType_Commit, + isolation.Serializable, batch(get(k7), get(k8), del(k9, 1)), delRange(k10, k11, 2), put(k11, 3), diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/addsstable b/pkg/kv/kvnemesis/testdata/TestApplier/addsstable index 95ac83f04c6b..69d2fd16c336 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/addsstable +++ b/pkg/kv/kvnemesis/testdata/TestApplier/addsstable @@ -1,6 +1,6 @@ echo ---- -db0.AddSSTable(ctx, tk(1), tk(4), ... /* @s1 */) // 1252 bytes (as writes) +db1.AddSSTable(ctx, tk(1), tk(4), ... /* @s1 */) // 1252 bytes (as writes) // ^-- tk(1) -> sv(s1): /Table/100/"0000000000000001"/ -> /BYTES/v1 // ^-- tk(2) -> sv(s1): /Table/100/"0000000000000002"/ -> / // ^-- [tk(3), tk(4)) -> sv(s1): /Table/100/"000000000000000{3"-4"} -> / diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/del-err b/pkg/kv/kvnemesis/testdata/TestApplier/del-err index 0933233e8d68..5d8af55adb1a 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/del-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/del-err @@ -1,3 +1,3 @@ echo ---- -db0.Del(ctx, tk(2) /* @s1 */) // context canceled +db1.Del(ctx, tk(2) /* @s1 */) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/delrange-err b/pkg/kv/kvnemesis/testdata/TestApplier/delrange-err index 96bd7e0acbd4..c598e73160b7 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/delrange-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/delrange-err @@ -1,3 +1,3 @@ echo ---- -db1.DelRange(ctx, tk(2), tk(3), true /* @s12 */) // context canceled +db0.DelRange(ctx, tk(2), tk(3), true /* @s12 */) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/get-err b/pkg/kv/kvnemesis/testdata/TestApplier/get-err index 740b8866b63e..1156b0926432 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/get-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/get-err @@ -1,3 +1,3 @@ echo ---- -db1.Get(ctx, tk(1)) // context canceled +db0.Get(ctx, tk(1)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/merge b/pkg/kv/kvnemesis/testdata/TestApplier/merge index b47cd1985dc4..262fa20e40e6 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/merge +++ b/pkg/kv/kvnemesis/testdata/TestApplier/merge @@ -1,3 +1,3 @@ echo ---- -db1.AdminMerge(ctx, tk(1)) // +db0.AdminMerge(ctx, tk(1)) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/merge-again b/pkg/kv/kvnemesis/testdata/TestApplier/merge-again index bbe2ac5ee0a7..097de87b6380 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/merge-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/merge-again @@ -1,3 +1,3 @@ echo ---- -db1.AdminMerge(ctx, tk(1)) // context canceled +db0.AdminMerge(ctx, tk(1)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/put-err b/pkg/kv/kvnemesis/testdata/TestApplier/put-err index 42f9864a4cbe..a417f624096e 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/put-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/put-err @@ -1,3 +1,3 @@ echo ---- -db0.Put(ctx, tk(1), sv(1)) // context canceled +db1.Put(ctx, tk(1), sv(1)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/rscan-err b/pkg/kv/kvnemesis/testdata/TestApplier/rscan-err index 99791cf475a6..a0aaa9b306fb 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/rscan-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/rscan-err @@ -1,3 +1,3 @@ echo ---- -db0.ReverseScan(ctx, tk(1), tk(3), 0) // context canceled +db1.ReverseScan(ctx, tk(1), tk(3), 0) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/rscan-for-update-err b/pkg/kv/kvnemesis/testdata/TestApplier/rscan-for-update-err index 96e356762ea8..40c09b2e28cf 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/rscan-for-update-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/rscan-for-update-err @@ -1,3 +1,3 @@ echo ---- -db1.ReverseScanForUpdate(ctx, tk(1), tk(3), 0) // context canceled +db0.ReverseScanForUpdate(ctx, tk(1), tk(3), 0) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/scan-for-update-err b/pkg/kv/kvnemesis/testdata/TestApplier/scan-for-update-err index 54d4e3c75df9..8c5fa687a9b4 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/scan-for-update-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/scan-for-update-err @@ -1,3 +1,3 @@ echo ---- -db1.ScanForUpdate(ctx, tk(1), tk(3), 0) // context canceled +db0.ScanForUpdate(ctx, tk(1), tk(3), 0) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/split b/pkg/kv/kvnemesis/testdata/TestApplier/split index 9d596c5d5ca0..2c98be6da1ff 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/split +++ b/pkg/kv/kvnemesis/testdata/TestApplier/split @@ -1,3 +1,3 @@ echo ---- -db0.AdminSplit(ctx, tk(2)) // +db1.AdminSplit(ctx, tk(2)) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/split-again b/pkg/kv/kvnemesis/testdata/TestApplier/split-again index 3700715e11fc..916303dcfc73 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/split-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/split-again @@ -1,3 +1,3 @@ echo ---- -db0.AdminSplit(ctx, tk(2)) // context canceled +db1.AdminSplit(ctx, tk(2)) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/transfer b/pkg/kv/kvnemesis/testdata/TestApplier/transfer index 7b94b50c98ac..2c9becff21d0 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/transfer +++ b/pkg/kv/kvnemesis/testdata/TestApplier/transfer @@ -1,3 +1,3 @@ echo ---- -db0.TransferLeaseOperation(ctx, tk(6), 1) // +db1.TransferLeaseOperation(ctx, tk(6), 1) // diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again b/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again index 078827f7e02d..d34cc822e962 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again +++ b/pkg/kv/kvnemesis/testdata/TestApplier/transfer-again @@ -1,3 +1,3 @@ echo ---- -db1.TransferLeaseOperation(ctx, tk(6), 1) // context canceled +db0.TransferLeaseOperation(ctx, tk(6), 1) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-batch b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-batch similarity index 88% rename from pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-batch rename to pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-batch index cc4f3fa83845..38ba0b8dcf24 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-batch +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-batch @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Snapshot) txn.Put(ctx, tk(5), sv(5)) // @ b := &kv.Batch{} b.Get(tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-mixed b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-mixed new file mode 100644 index 000000000000..4d973cb80ace --- /dev/null +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-commit-mixed @@ -0,0 +1,14 @@ +echo +---- +db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Snapshot) + txn.Put(ctx, tk(5), sv(5)) // @ + { + b := &kv.Batch{} + b.Put(tk(6), sv(6)) // + b.DelRange(tk(3), tk(5), true /* @s1 */) // + txn.Run(ctx, b) // @ + } + return nil +}) // @ +// ^-- txnpb: diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-delrange b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-delrange new file mode 100644 index 000000000000..2b349e3833a4 --- /dev/null +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-delrange @@ -0,0 +1,8 @@ +echo +---- +db1.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Snapshot) + txn.DelRange(ctx, tk(2), tk(4), true /* @s1 */) // @ + return nil +}) // @ +// ^-- txnpb: diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-err b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-err similarity index 80% rename from pkg/kv/kvnemesis/testdata/TestApplier/txn-err rename to pkg/kv/kvnemesis/testdata/TestApplier/txn-si-err index 2d6bad71ab5c..624e19c66aa2 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-err +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-err @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Snapshot) txn.DelRange(ctx, tk(2), tk(4), true /* @s1 */) return nil }) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-rollback b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-rollback new file mode 100644 index 000000000000..6fcec6909e87 --- /dev/null +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-si-rollback @@ -0,0 +1,7 @@ +echo +---- +db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Snapshot) + txn.Put(ctx, tk(5), sv(5)) // @ + return errors.New("rollback") +}) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-batch b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-batch new file mode 100644 index 000000000000..06bb3ac42466 --- /dev/null +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-batch @@ -0,0 +1,12 @@ +echo +---- +db1.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) + txn.Put(ctx, tk(5), sv(5)) // @ + b := &kv.Batch{} + b.Get(tk(1)) // (, ) + b.Put(tk(6), sv(6)) // + txn.CommitInBatch(ctx, b) // @ + return nil +}) // @ +// ^-- txnpb: diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-mixed b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-mixed similarity index 88% rename from pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-mixed rename to pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-mixed index e5b8f606fe1f..9e8ffd670a65 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-commit-mixed +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-commit-mixed @@ -1,6 +1,7 @@ echo ---- db1.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(5), sv(5)) // @ { b := &kv.Batch{} diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-delrange b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-delrange similarity index 81% rename from pkg/kv/kvnemesis/testdata/TestApplier/txn-delrange rename to pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-delrange index 45c812639499..9fee6d1f91e9 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-delrange +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-delrange @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(2), tk(4), true /* @s1 */) // @ return nil }) // @ diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-err b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-err new file mode 100644 index 000000000000..966d8dcf5a3c --- /dev/null +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-err @@ -0,0 +1,7 @@ +echo +---- +db1.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) + txn.DelRange(ctx, tk(2), tk(4), true /* @s1 */) + return nil +}) // context canceled diff --git a/pkg/kv/kvnemesis/testdata/TestApplier/txn-rollback b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-rollback similarity index 79% rename from pkg/kv/kvnemesis/testdata/TestApplier/txn-rollback rename to pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-rollback index 0b92c1010dbc..c3b3658b48ce 100644 --- a/pkg/kv/kvnemesis/testdata/TestApplier/txn-rollback +++ b/pkg/kv/kvnemesis/testdata/TestApplier/txn-ssi-rollback @@ -1,6 +1,7 @@ echo ---- db1.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(5), sv(5)) // @ return errors.New("rollback") }) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestOperationsFormat/3 b/pkg/kv/kvnemesis/testdata/TestOperationsFormat/3 index a0b522398085..2aaf77573d09 100644 --- a/pkg/kv/kvnemesis/testdata/TestOperationsFormat/3 +++ b/pkg/kv/kvnemesis/testdata/TestOperationsFormat/3 @@ -1,6 +1,7 @@ echo ---- ···db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { +··· txn.SetIsoLevel(isolation.Serializable) ··· { ··· b := &kv.Batch{} ··· b.Get(tk(7)) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed index 505c256d8a3c..c7fa65f1fc69 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed_but_wrong_seq b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed_but_wrong_seq index 6805fda502f0..326885230adf 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed_but_wrong_seq +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_del-del_transaction_committed_but_wrong_seq @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed index 95766b7a9b17..e66e575c2496 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed_but_has_validation_error b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed_but_has_validation_error index acbbd7b25de5..116530257a3f 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed_but_has_validation_error +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_committed_but_has_validation_error @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_did_not_commit b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_did_not_commit index aca32a7990a0..34f770a25411 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_did_not_commit +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-del_transaction_did_not_commit @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed index eec3d9dff950..e6ec949cfbd4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed_but_has_validation_error b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed_but_has_validation_error index 8d9818a960e1..a49862bab160 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed_but_has_validation_error +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_committed_but_has_validation_error @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_did_not_commit b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_did_not_commit index 128c9f377804..220561558216 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_did_not_commit +++ b/pkg/kv/kvnemesis/testdata/TestValidate/ambiguous_put-put_transaction_did_not_commit @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_delete_with_expected_write_after_write_transaction_with_shadowed_delete b/pkg/kv/kvnemesis/testdata/TestValidate/one_delete_with_expected_write_after_write_transaction_with_shadowed_delete index 40007c673f87..d80246e9d52a 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_delete_with_expected_write_after_write_transaction_with_shadowed_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_delete_with_expected_write_after_write_transaction_with_shadowed_delete @@ -3,6 +3,7 @@ echo db0.Del(ctx, tk(1) /* @s1 */) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(3)) // txn.Del(ctx, tk(1) /* @s4 */) // txn.Put(ctx, tk(1), sv(5)) // diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write index a567d19a14e3..218af891d2cd 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // (/Table/100/"0000000000000001", ) return nil }) // @0.000000002,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_extra_deletion b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_extra_deletion index c7bd78b28dab..235c79c9c363 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_extra_deletion +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_extra_deletion @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // @0.000000002,0 (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil }) // @0.000000002,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_missing_write b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_missing_write index f30530cfb26b..39c75e4cb68c 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_missing_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_missing_write @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // @0.000000002,0 (/Table/100/"0000000000000001", ) return nil }) // @0.000000001,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_returning_wrong_value b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_returning_wrong_value index 85bf7e692c0f..8c1c6da284b7 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_returning_wrong_value +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_returning_wrong_value @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // @0.000000002,0 return nil }) // @0.000000002,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_with_spurious_deletion b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_with_spurious_deletion index a42c70f783bc..bdb584c467be 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_with_spurious_deletion +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_write_with_spurious_deletion @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // @0.000000002,0 (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil }) // @0.000000002,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes index 35b8fc8ffe30..6afb6a640283 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(3), sv(3)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s4 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil }) // @0.000000004,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_and_delete b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_and_delete index e1e552310d97..460e028a8bb5 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_and_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_and_delete @@ -5,6 +5,7 @@ db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Del(ctx, tk(1) /* @s3 */) // @0.000000004,0 db0.Put(ctx, tk(1), sv(4)) // @0.000000005,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s5 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil }) // @0.000000003,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_incorrectly_deleting_keys_outside_span_boundary b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_incorrectly_deleting_keys_outside_span_boundary index 20f93b91c4e6..f29334eb3fe7 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_incorrectly_deleting_keys_outside_span_boundary +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_incorrectly_deleting_keys_outside_span_boundary @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(4), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s3 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000004", ) return nil }) // @0.000000003,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_returning_keys_outside_span_boundary b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_returning_keys_outside_span_boundary index 73d4d9767a5f..623d36134c44 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_returning_keys_outside_span_boundary +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_returning_keys_outside_span_boundary @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(4), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s3 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000004", ) return nil }) // @0.000000003,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_missing_write b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_missing_write index 25d9843cbd42..a9f0e1a544b4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_missing_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_missing_write @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(3), sv(3)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s4 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil }) // @0.000000004,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_write_timestamp_disagreement b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_write_timestamp_disagreement index 9029aad3f854..19c1b0ce351e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_write_timestamp_disagreement +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_deleterange_after_writes_with_write_timestamp_disagreement @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(3), sv(3)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s4 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", /Table/100/"0000000000000003", ) return nil }) // @0.000000004,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_scan_after_writes_and_delete_returning_missing_key b/pkg/kv/kvnemesis/testdata/TestValidate/one_scan_after_writes_and_delete_returning_missing_key index 4afe769b2714..94a5a390f9fe 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_scan_after_writes_and_delete_returning_missing_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_scan_after_writes_and_delete_returning_missing_key @@ -1,11 +1,13 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil }) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000002":v2, ) txn.Del(ctx, tk(1) /* @s3 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_tranactional_scan_after_write_and_delete_returning_extra_key b/pkg/kv/kvnemesis/testdata/TestValidate/one_tranactional_scan_after_write_and_delete_returning_extra_key index a37ed9ea44cd..f976a1677480 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_tranactional_scan_after_write_and_delete_returning_extra_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_tranactional_scan_after_write_and_delete_returning_extra_key @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(2), sv(2)) // txn.Del(ctx, tk(1) /* @s3 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_delete_with_write_on_another_key_after_delete b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_delete_with_write_on_another_key_after_delete index b6b2796ce047..d585525f12fa 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_delete_with_write_on_another_key_after_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_delete_with_write_on_another_key_after_delete @@ -2,6 +2,7 @@ echo ---- db0.Del(ctx, tk(1) /* @s1 */) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(2), sv(2)) // txn.Del(ctx, tk(1) /* @s3 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes index 990e212014f2..e3f944c6bff4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // (/Table/100/"0000000000000001", ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes_with_write_timestamp_disagreement b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes_with_write_timestamp_disagreement index 148d4b5b59e5..8cbc3ce11cee 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes_with_write_timestamp_disagreement +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_deleterange_followed_by_put_after_writes_with_write_timestamp_disagreement @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.DelRange(ctx, tk(1), tk(3), true /* @s2 */) // (/Table/100/"0000000000000001", ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes index e47bed228b03..406ae8c76f7b 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(2), sv(2)) // txn.DelRange(ctx, tk(1), tk(3), true /* @s3 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes_with_write_timestamp_disagreement b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes_with_write_timestamp_disagreement index 66eaf67ae945..9020ef9fe5af 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes_with_write_timestamp_disagreement +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_shadowed_by_deleterange_after_writes_with_write_timestamp_disagreement @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(2), sv(2)) // txn.DelRange(ctx, tk(1), tk(3), true /* @s3 */) // (/Table/100/"0000000000000001", /Table/100/"0000000000000002", ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_correct_commit_time b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_correct_commit_time index e6627602ef30..9ad2653eb50a 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_correct_commit_time +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_correct_commit_time @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // return nil }) // @0.000000001,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_incorrect_commit_time b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_incorrect_commit_time index 95d9561a726d..57758cb8b143 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_incorrect_commit_time +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_put_with_incorrect_commit_time @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // return nil }) // @0.000000001,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_outside_time_range b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_outside_time_range index 4f9dc09aa499..f302253f087d 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_outside_time_range +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_outside_time_range @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_within_time_range b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_within_time_range index bae4e4c7e557..1d945cc17b38 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_within_time_range +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactional_scan_followed_by_delete_within_time_range @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_first_write_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_first_write_missing index e0bb716a3638..9e99801fb8c8 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_first_write_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_first_write_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_second_write_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_second_write_missing index fc08f8073806..816e7bdd8746 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_second_write_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_second_write_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_the_correct_writes b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_the_correct_writes index 4ad7f08fa6e4..7acf19ab4383 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_the_correct_writes +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_the_correct_writes @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // return nil }) // @0.000000001,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_write_timestamp_disagreement b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_write_timestamp_disagreement index 02cff9ad0e9e..7f046513d277 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_write_timestamp_disagreement +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_delete_with_write_timestamp_disagreement @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(2) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_first_write_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_first_write_missing index 1510a600518e..de424fe4b38a 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_first_write_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_first_write_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_second_write_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_second_write_missing index c3e0a8c116cf..6feb2cd3060e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_second_write_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_second_write_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_the_correct_writes b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_the_correct_writes index e6627602ef30..9ad2653eb50a 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_the_correct_writes +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_the_correct_writes @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // return nil }) // @0.000000001,0 diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_write_timestamp_disagreement b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_write_timestamp_disagreement index 6c6c6c7ffc56..f86f42ab6610 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_write_timestamp_disagreement +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_committed_put_with_write_timestamp_disagreement @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(2), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_delete_with_write_correctly_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_delete_with_write_correctly_missing index 6bf6550d9b18..4ea397bf15b4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_delete_with_write_correctly_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_delete_with_write_correctly_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) { b := &kv.Batch{} b.Del(tk(1) /* @s1 */) // diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_put_with_write_correctly_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_put_with_write_correctly_missing index a90b9e6a4d1f..68e90070965e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_put_with_write_correctly_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_batch_put_with_write_correctly_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) { b := &kv.Batch{} b.Put(tk(1), sv(1)) // diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_correctly_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_correctly_missing index 53f647f981d4..dc60c7e643ac 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_correctly_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_correctly_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // return errors.New("rollback") }) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_incorrectly_present b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_incorrectly_present index 55a5583afe82..9df69e998287 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_incorrectly_present +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_delete_with_write_incorrectly_present @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // return errors.New("rollback") }) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_correctly_missing b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_correctly_missing index 323a30b5d435..1af476deb9ba 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_correctly_missing +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_correctly_missing @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // return errors.New("rollback") }) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_incorrectly_present b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_incorrectly_present index 01907c3b220f..2975958b3ee4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_incorrectly_present +++ b/pkg/kv/kvnemesis/testdata/TestValidate/one_transactionally_rolled_back_put_with_write_incorrectly_present @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // return errors.New("rollback") }) // rollback diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_delete b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_delete index dd35166d4f69..add938495fbb 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_delete @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Del(ctx, tk(1) /* @s2 */) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_write index 75beff83bb12..4987cb304be6 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_after_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_delete b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_delete index bd0ec75041ea..902af0d11267 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_delete @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Del(ctx, tk(1) /* @s2 */) // txn.Get(ctx, tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_write index 09805740bb49..0019c9255a0d 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_read_before_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_after_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_after_write index 8779e943e407..70f424f13cc3 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_after_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_after_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // txn.Put(ctx, tk(1), sv(1)) // txn.Scan(ctx, tk(1), tk(3), 0) // diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_before_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_before_write index 45114c7023f9..51bcc08aebf5 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_before_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_incorrect_scan_before_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Put(ctx, tk(1), sv(1)) // txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_delete b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_delete index 401159f597a4..2db5793a54a2 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_delete +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_delete @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Del(ctx, tk(1) /* @s2 */) // txn.Get(ctx, tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_write index bb0a9589c7b0..4f1f8aa9921d 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_read_before_and_after_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_scan_before_and_after_write b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_scan_before_and_after_write index 98adf607f9b8..b5715d9ac07b 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_scan_before_and_after_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transaction_with_scan_before_and_after_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // txn.Put(ctx, tk(1), sv(1)) // txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_empty_time_overlap index c5e02610f071..129f1e10012e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_empty_time_overlap @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_non-empty_time_overlap index c28e899c9f15..63ff284cfdef 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_read_and_write_with_non-empty_time_overlap @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_empty_time_overlap index 362d831edfee..1a97e249fcd4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_empty_time_overlap @@ -3,11 +3,13 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s3 */) // txn.Del(ctx, tk(2) /* @s4 */) // return nil }) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Get(ctx, tk(2)) // (v2, ) txn.Get(ctx, tk(3)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_non-empty_time_overlap index cb4c766c5327..3e10f59b4222 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_after_writes_and_deletes_with_non-empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(2), sv(2)) // @0.000000002,0 db0.Del(ctx, tk(1) /* @s3 */) // @0.000000003,0 db0.Del(ctx, tk(2) /* @s4 */) // @0.000000004,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Get(ctx, tk(2)) // (v2, ) txn.Get(ctx, tk(3)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_empty_time_overlap index 1d5f79132f1e..d17d3a845efe 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_empty_time_overlap @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Del(ctx, tk(1) /* @s2 */) // txn.Get(ctx, tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_non-empty_time_overlap index 4fc0b7b3f529..3a2805becf63 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_and_deletes_after_write_with_non-empty_time_overlap @@ -2,6 +2,7 @@ echo ---- db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Del(ctx, tk(1) /* @s2 */) // txn.Get(ctx, tk(1)) // (, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_empty_time_overlap index 709315e98514..2d0d60f18074 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_empty_time_overlap @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Get(ctx, tk(2)) // (, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_non-empty_time_overlap index b175ef04ede1..7bcac6d053c0 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_one_missing_with_non-empty_time_overlap @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Get(ctx, tk(2)) // (, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_empty_time_overlap index fafd5f21e22b..0b51610a1d03 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(4)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Get(ctx, tk(2)) // (v3, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_non-empty_time_overlap index 6b26967055fb..ef612c24bfd4 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_reads_with_non-empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(1), sv(2)) // @0.000000003,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(4)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (v1, ) txn.Get(ctx, tk(2)) // (v3, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_empty_time_overlap index b52d86e9c2e9..4467ec48255e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_empty_time_overlap @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_non-empty_time_overlap index ea93007aafb0..b595e43b48d8 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scan_and_write_with_non-empty_time_overlap @@ -3,6 +3,7 @@ echo db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Put(ctx, tk(2), sv(3)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_empty_time_overlap index 5430bd1c14cb..d0cf575c2fcf 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000001,0 db0.Del(ctx, tk(2) /* @s4 */) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Scan(ctx, tk(2), tk(4), 0) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_non-empty_time_overlap index 905d7d31b24b..e782416359ed 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_after_delete_with_non-empty_time_overlap @@ -6,6 +6,7 @@ db0.Put(ctx, tk(2), sv(3)) // @0.000000001,0 db0.Del(ctx, tk(2) /* @s4 */) // @0.000000002,0 db0.Put(ctx, tk(2), sv(5)) // @0.000000004,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Scan(ctx, tk(2), tk(4), 0) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_empty_time_overlap index 3f310a978a3c..86eeb64a7579 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_empty_time_overlap @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000001,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Scan(ctx, tk(2), tk(4), 0) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_non-empty_time_overlap index 517ea2b1df17..085c98d6865c 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_one_missing_with_non-empty_time_overlap @@ -4,6 +4,7 @@ db0.Put(ctx, tk(1), sv(1)) // @0.000000001,0 db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) txn.Scan(ctx, tk(2), tk(4), 0) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_empty_time_overlap index f5f62dc52c7e..2585d96cad97 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(1), sv(2)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(4)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, /Table/100/"0000000000000002":v3, ) txn.Scan(ctx, tk(2), tk(4), 0) // (/Table/100/"0000000000000002":v3, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_non-empty_time_overlap b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_non-empty_time_overlap index a36ea1f95c5f..58cc8fcc92b5 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_non-empty_time_overlap +++ b/pkg/kv/kvnemesis/testdata/TestValidate/transactional_scans_with_non-empty_time_overlap @@ -5,6 +5,7 @@ db0.Put(ctx, tk(1), sv(2)) // @0.000000003,0 db0.Put(ctx, tk(2), sv(3)) // @0.000000002,0 db0.Put(ctx, tk(2), sv(4)) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, /Table/100/"0000000000000002":v3, ) txn.Scan(ctx, tk(2), tk(4), 0) // (/Table/100/"0000000000000002":v3, ) return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactional_deletes_with_out_of_order_commit_times b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactional_deletes_with_out_of_order_commit_times index a4b2cf65a8cb..045908b77568 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactional_deletes_with_out_of_order_commit_times +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactional_deletes_with_out_of_order_commit_times @@ -3,6 +3,7 @@ echo db0.Del(ctx, tk(1) /* @s1 */) // @0.000000002,0 db0.Del(ctx, tk(2) /* @s2 */) // @0.000000003,0 db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s3 */) // txn.Del(ctx, tk(2) /* @s4 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key index 7b231af8f913..7540a49e8f88 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key_with_extra_write b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key_with_extra_write index 1e2be15eb796..9e64ceefd902 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key_with_extra_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_deletes_of_the_same_key_with_extra_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_incorrect_read b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_incorrect_read index dfaf45accf6a..98f6aa3d87bc 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_incorrect_read +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_incorrect_read @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_reads b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_reads index 60bfa9e14217..32706592d6c2 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_reads +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_put_delete_ops_of_the_same_key_with_reads @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key index eb34541d3476..913f2ee2af32 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(1), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_extra_write b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_extra_write index 90fa22e01ca4..f67e2d0b4481 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_extra_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_extra_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Put(ctx, tk(1), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_reads b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_reads index b0231a889823..cd2e1a12223e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_reads +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_reads @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Get(ctx, tk(1)) // (, ) txn.Put(ctx, tk(1), sv(1)) // txn.Get(ctx, tk(1)) // (v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_scans b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_scans index fa9977249b22..660da2e9a55f 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_scans +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_puts_of_the_same_key_with_scans @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Scan(ctx, tk(1), tk(3), 0) // txn.Put(ctx, tk(1), sv(1)) // txn.Scan(ctx, tk(1), tk(3), 0) // (/Table/100/"0000000000000001":v1, ) diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_delete_put_of_the_same_key b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_delete_put_of_the_same_key index fdfeda1c821a..640b7dbee91e 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_delete_put_of_the_same_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_delete_put_of_the_same_key @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Del(ctx, tk(1) /* @s1 */) // txn.Put(ctx, tk(1), sv(2)) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key index 7c45a32997a7..ee3144b57914 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key_with_extra_write b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key_with_extra_write index 8a81d1c9976b..a57cab81163d 100644 --- a/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key_with_extra_write +++ b/pkg/kv/kvnemesis/testdata/TestValidate/two_transactionally_committed_writes_put_delete_of_the_same_key_with_extra_write @@ -1,6 +1,7 @@ echo ---- db0.Txn(ctx, func(ctx context.Context, txn *kv.Txn) error { + txn.SetIsoLevel(isolation.Serializable) txn.Put(ctx, tk(1), sv(1)) // txn.Del(ctx, tk(1) /* @s2 */) // return nil diff --git a/pkg/kv/kvnemesis/validator_test.go b/pkg/kv/kvnemesis/validator_test.go index b7f1e794ee2b..9b009bdcf572 100644 --- a/pkg/kv/kvnemesis/validator_test.go +++ b/pkg/kv/kvnemesis/validator_test.go @@ -337,7 +337,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(del(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResultOK(put(k1, s3)), withResultOK(del(k1, s4)), withResultOK(put(k1, s5)), @@ -373,7 +373,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed put with the correct writes", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), ), t1)), }, @@ -383,7 +383,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed delete with the correct writes", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), ), t1)), }, @@ -392,7 +392,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed put with first write missing", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ), t1)), @@ -402,7 +402,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed delete with first write missing", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k2, s2)), ), t1)), @@ -412,7 +412,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed put with second write missing", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ), t1)), @@ -422,7 +422,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed delete with second write missing", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k2, s2)), ), t1)), @@ -432,7 +432,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed put with write timestamp disagreement", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ), t1)), @@ -442,7 +442,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally committed delete with write timestamp disagreement", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k2, s2)), ), t1)), @@ -454,7 +454,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back put with write (correctly) missing", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(put(k1, s1)), ), errors.New(`rollback`))), }, @@ -463,7 +463,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back delete with write (correctly) missing", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(del(k1, s1)), ), errors.New(`rollback`))), }, @@ -472,7 +472,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back put with write (incorrectly) present", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(put(k1, s1)), ), errors.New(`rollback`))), }, @@ -481,7 +481,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back delete with write (incorrectly) present", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(del(k1, s1)), ), errors.New(`rollback`))), }, @@ -490,7 +490,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back batch put with write (correctly) missing", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(batch( withResult(put(k1, s1)), )), @@ -501,7 +501,7 @@ func TestValidate(t *testing.T) { { name: "one transactionally rolled back batch delete with write (correctly) missing", steps: []Step{ - step(withResultErr(closureTxn(ClosureTxnType_Rollback, + step(withResultErr(closureTxnSSI(ClosureTxnType_Rollback, withResult(batch( withResult(del(k1, s1)), )), @@ -512,7 +512,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed puts of the same key", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k1, s2)), ), t1)), @@ -534,7 +534,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed deletes of the same key", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k1, s2)), ), t1)), @@ -544,7 +544,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed writes (put, delete) of the same key", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(del(k1, s2)), ), t1)), @@ -554,7 +554,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed writes (delete, put) of the same key", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(put(k1, s2)), ), t1)), @@ -564,7 +564,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed puts of the same key with extra write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k1, s2)), ), t2)), @@ -574,7 +574,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed deletes of the same key with extra write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k1, s2)), ), t1)), @@ -584,7 +584,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed writes (put, delete) of the same key with extra write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResultOK(put(k1, s1)), withResultOK(del(k1, s2)), ), t1)), @@ -594,7 +594,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-put transaction committed", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ))), @@ -604,7 +604,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-del transaction committed", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(del(k2, s2)), ))), @@ -618,7 +618,7 @@ func TestValidate(t *testing.T) { // them if any of the writes show up. name: "ambiguous del-del transaction committed", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k1, s2)), ))), @@ -628,7 +628,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous del-del transaction committed but wrong seq", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s1)), withResult(del(k1, s2)), ))), @@ -638,7 +638,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-put transaction did not commit", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ))), @@ -648,7 +648,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-del transaction did not commit", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(del(k2, s2)), ))), @@ -658,7 +658,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-put transaction committed but has validation error", steps: []Step{ - step(withAmbResult(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ))), @@ -668,7 +668,7 @@ func TestValidate(t *testing.T) { { name: "ambiguous put-del transaction committed but has validation error", steps: []Step{ - step(withAmbResult(withTimestamp(closureTxn(ClosureTxnType_Commit, + step(withAmbResult(withTimestamp(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(del(k2, s2)), ), t2))), @@ -866,7 +866,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s2), t3)), step(withResultTS(put(k2, s3), t2)), step(withResultTS(put(k2, s4), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withReadResult(get(k2), v3), ), t3)), @@ -881,7 +881,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k2, s2), t2)), step(withResultTS(del(k1, s3), t3)), step(withResultTS(del(k2, s4), t4)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withReadResult(get(k2), v2), withReadResult(get(k3), ``), @@ -897,7 +897,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t2)), step(withResultTS(put(k2, s4), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withReadResult(get(k2), v3), ), t3)), @@ -910,11 +910,11 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k2, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResultOK(del(k1, s3)), withResultOK(del(k2, s4)), ), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withReadResult(get(k2), v2), withReadResult(get(k3), ``), @@ -927,7 +927,7 @@ func TestValidate(t *testing.T) { name: "transactional reads and deletes after write with non-empty time overlap", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResult(del(k1, s2)), withReadResult(get(k1), ``), @@ -942,7 +942,7 @@ func TestValidate(t *testing.T) { name: "transactional reads and deletes after write with empty time overlap", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(del(k1, s2)), withReadResult(get(k1), ``), @@ -959,7 +959,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withReadResult(get(k2), ``), ), t1)), @@ -973,7 +973,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withReadResult(get(k2), ``), ), t1)), @@ -986,7 +986,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResult(put(k2, s3)), ), t2)), @@ -999,7 +999,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResultOK(put(k2, s3)), ), t2)), @@ -1010,7 +1010,7 @@ func TestValidate(t *testing.T) { { name: "transaction with read before and after write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(put(k1, s1)), withReadResult(get(k1), v1), @@ -1022,7 +1022,7 @@ func TestValidate(t *testing.T) { name: "transaction with read before and after delete", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResult(del(k1, s2)), withReadResult(get(k1), ``), @@ -1033,7 +1033,7 @@ func TestValidate(t *testing.T) { { name: "transaction with incorrect read before write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResult(put(k1, s1)), withReadResult(get(k1), v1), @@ -1045,7 +1045,7 @@ func TestValidate(t *testing.T) { name: "transaction with incorrect read before delete", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(del(k1, s2)), withReadResult(get(k1), ``), @@ -1056,7 +1056,7 @@ func TestValidate(t *testing.T) { { name: "transaction with incorrect read after write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(put(k1, s1)), withReadResult(get(k1), ``), @@ -1068,7 +1068,7 @@ func TestValidate(t *testing.T) { name: "transaction with incorrect read after delete", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), v1), withResultOK(del(k1, s2)), withReadResult(get(k1), v1), @@ -1079,7 +1079,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed puts of the same key with reads", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(put(k1, s1)), withReadResult(get(k1), v1), @@ -1092,7 +1092,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed put/delete ops of the same key with reads", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(put(k1, s1)), withReadResult(get(k1), v1), @@ -1105,7 +1105,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed put/delete ops of the same key with incorrect read", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withReadResult(get(k1), ``), withResult(put(k1, s1)), withReadResult(get(k1), v1), @@ -1118,7 +1118,7 @@ func TestValidate(t *testing.T) { { name: "one transactional put with correct commit time", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), ), t1)), }, @@ -1127,7 +1127,7 @@ func TestValidate(t *testing.T) { { name: "one transactional put with incorrect commit time", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), ), t1)), }, @@ -1138,7 +1138,7 @@ func TestValidate(t *testing.T) { steps: []Step{ // NB: this Delete comes first in operation order, but the write is delayed. step(withResultTS(del(k1, s1), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k2, s2)), withResult(del(k1, s3)), ), t2)), @@ -1150,7 +1150,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(del(k1, s1), t2)), step(withResultTS(del(k2, s2), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(del(k1, s3)), withResult(del(k2, s4)), ), t1)), @@ -1161,7 +1161,7 @@ func TestValidate(t *testing.T) { name: "one transactional scan followed by delete within time range", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withResult(del(k1, s2)), ), t2)), @@ -1173,7 +1173,7 @@ func TestValidate(t *testing.T) { name: "one transactional scan followed by delete outside time range", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withResult(del(k1, s2)), ), t4)), @@ -1255,7 +1255,7 @@ func TestValidate(t *testing.T) { name: "one tranactional scan after write and delete returning extra key", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k2, s2)), withResult(del(k1, s3)), ), t2)), @@ -1288,11 +1288,11 @@ func TestValidate(t *testing.T) { { name: "one scan after writes and delete returning missing key", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k1, s1)), withResult(put(k2, s2)), ), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k2, v2)), withResult(del(k1, s3)), ), t2)), @@ -1403,7 +1403,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s2), t3)), step(withResultTS(put(k2, s3), t2)), step(withResultTS(put(k2, s4), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1), scanKV(k2, v3)), withScanResultTS(scan(k2, k4), noTS, scanKV(k2, v3)), ), t2)), @@ -1419,7 +1419,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k2, s3), t1)), step(withResultTS(del(k2, s4), t2)), step(withResultTS(put(k2, s5), t4)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withScanResultTS(scan(k2, k4), noTS), ), t2)), @@ -1434,7 +1434,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t2)), step(withResultTS(put(k2, s4), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1), scanKV(k2, v3)), withScanResultTS(scan(k2, k4), noTS, scanKV(k2, v3)), ), t2)), @@ -1449,7 +1449,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t1)), step(withResultTS(del(k2, s4), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withScanResultTS(scan(k2, k4), noTS), ), t3)), @@ -1463,7 +1463,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withScanResultTS(scan(k2, k4), noTS), ), t2)), @@ -1477,7 +1477,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), step(withResultTS(put(k2, s3), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withScanResultTS(scan(k2, k4), noTS), ), t1)), @@ -1490,7 +1490,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withResult(put(k2, s3)), ), t2)), @@ -1503,7 +1503,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k1, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withResult(put(k2, s3)), ), t2)), @@ -1514,7 +1514,7 @@ func TestValidate(t *testing.T) { { name: "transaction with scan before and after write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS), withResult(put(k1, s1)), withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), @@ -1525,7 +1525,7 @@ func TestValidate(t *testing.T) { { name: "transaction with incorrect scan before write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), withResult(put(k1, s1)), withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), @@ -1536,7 +1536,7 @@ func TestValidate(t *testing.T) { { name: "transaction with incorrect scan after write", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS), withResult(put(k1, s1)), withScanResultTS(scan(k1, k3), noTS), @@ -1547,7 +1547,7 @@ func TestValidate(t *testing.T) { { name: "two transactionally committed puts of the same key with scans", steps: []Step{ - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withScanResultTS(scan(k1, k3), noTS), withResult(put(k1, s1)), withScanResultTS(scan(k1, k3), noTS, scanKV(k1, v1)), @@ -1579,7 +1579,7 @@ func TestValidate(t *testing.T) { name: "one deleterange after write", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), noTS, roachpb.Key(k1)), ), t2)), }, @@ -1589,7 +1589,7 @@ func TestValidate(t *testing.T) { name: "one deleterange after write returning wrong value", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), t2), ), t2)), }, @@ -1599,7 +1599,7 @@ func TestValidate(t *testing.T) { name: "one deleterange after write missing write", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), t2, roachpb.Key(k1)), ), t1)), }, @@ -1609,7 +1609,7 @@ func TestValidate(t *testing.T) { name: "one deleterange after write extra deletion", steps: []Step{ step(withResultTS(put(k1, s1), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), t2, roachpb.Key(k1), roachpb.Key(k2)), ), t2)), }, @@ -1619,7 +1619,7 @@ func TestValidate(t *testing.T) { name: "one deleterange after write with spurious deletion", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), t2, roachpb.Key(k1), roachpb.Key(k2)), ), t2)), }, @@ -1631,7 +1631,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k2, s2), t2)), step(withResultTS(put(k3, s3), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s4), noTS, roachpb.Key(k1), roachpb.Key(k2)), ), t4)), step(withScanResultTS(scan(k1, k4), t4, scanKV(k3, v3))), @@ -1644,7 +1644,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k2, s2), t2)), step(withResultTS(put(k3, s3), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s4), noTS, roachpb.Key(k1), roachpb.Key(k2), roachpb.Key(k3)), ), t4)), }, @@ -1656,7 +1656,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k2, s2), t2)), step(withResultTS(put(k3, s3), t3)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s4), noTS, roachpb.Key(k1), roachpb.Key(k2)), ), t4)), step(withScanResultTS(scan(k1, k4), t5, scanKV(k3, v3))), @@ -1670,7 +1670,7 @@ func TestValidate(t *testing.T) { step(withResultTS(put(k2, s2), t2)), step(withResultTS(del(k1, s3), t4)), step(withResultTS(put(k1, s4), t5)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s5), noTS, roachpb.Key(k1), roachpb.Key(k2)), ), t3)), }, @@ -1680,7 +1680,7 @@ func TestValidate(t *testing.T) { name: "one transactional deleterange followed by put after writes", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), noTS, roachpb.Key(k1)), withResult(put(k2, s3)), ), t2)), @@ -1691,7 +1691,7 @@ func TestValidate(t *testing.T) { name: "one transactional deleterange followed by put after writes with write timestamp disagreement", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s2), noTS, roachpb.Key(k1)), withResult(put(k2, s3)), ), t2)), @@ -1702,7 +1702,7 @@ func TestValidate(t *testing.T) { name: "one transactional put shadowed by deleterange after writes", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k2, s2)), withDeleteRangeResult(delRange(k1, k3, s3), noTS, roachpb.Key(k1), roachpb.Key(k2)), ), t2)), @@ -1713,7 +1713,7 @@ func TestValidate(t *testing.T) { name: "one transactional put shadowed by deleterange after writes with write timestamp disagreement", steps: []Step{ step(withResultTS(put(k1, s1), t1)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withResult(put(k2, s2)), withDeleteRangeResult(delRange(k1, k3, s3), noTS, roachpb.Key(k1), roachpb.Key(k2)), ), t2)), @@ -1725,7 +1725,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k4, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s3), noTS, roachpb.Key(k1), roachpb.Key(k4)), ), t3)), }, @@ -1736,7 +1736,7 @@ func TestValidate(t *testing.T) { steps: []Step{ step(withResultTS(put(k1, s1), t1)), step(withResultTS(put(k4, s2), t2)), - step(withResultTS(closureTxn(ClosureTxnType_Commit, + step(withResultTS(closureTxnSSI(ClosureTxnType_Commit, withDeleteRangeResult(delRange(k1, k3, s3), noTS, roachpb.Key(k1), roachpb.Key(k4)), ), t3)), },