diff --git a/pkg/ccl/storageccl/engineccl/mvcc.go b/pkg/ccl/storageccl/engineccl/mvcc.go index 404a57d7b5e8..9467457363a5 100644 --- a/pkg/ccl/storageccl/engineccl/mvcc.go +++ b/pkg/ccl/storageccl/engineccl/mvcc.go @@ -151,7 +151,7 @@ func (i *MVCCIncrementalIterator) advance() { metaTimestamp := hlc.Timestamp(i.meta.Timestamp) if i.meta.Txn != nil { - if i.startTime.Less(metaTimestamp) && !i.endTime.Less(metaTimestamp) { + if !i.endTime.Less(metaTimestamp) { i.err = &roachpb.WriteIntentError{ Intents: []roachpb.Intent{{ Span: roachpb.Span{Key: i.iter.Key().Key}, diff --git a/pkg/ccl/storageccl/engineccl/mvcc_test.go b/pkg/ccl/storageccl/engineccl/mvcc_test.go index 3e8060d42153..564ea348e256 100644 --- a/pkg/ccl/storageccl/engineccl/mvcc_test.go +++ b/pkg/ccl/storageccl/engineccl/mvcc_test.go @@ -61,7 +61,6 @@ func assertEqualKVs( expected []engine.MVCCKeyValue, ) func(*testing.T) { return func(t *testing.T) { - t.Helper() iter := NewMVCCIncrementalIterator(e, IterOptions{ StartTime: startTime, EndTime: endTime, @@ -181,18 +180,11 @@ func TestMVCCIterateIncremental(t *testing.T) { if err := engine.MVCCPut(ctx, e, nil, txn2.TxnMeta.Key, txn2.TxnMeta.Timestamp, txn2Val, &txn2); err != nil { t.Fatal(err) } - t.Run("intents", + t.Run("intents1", iterateExpectErr(e, fn, testKey1, testKey1.PrefixEnd(), tsMin, tsMax, "conflicting intents")) - t.Run("intents", + t.Run("intents2", iterateExpectErr(e, fn, testKey2, testKey2.PrefixEnd(), tsMin, tsMax, "conflicting intents")) - t.Run("intents", - iterateExpectErr(e, fn, keyMin, keyMax, tsMin, ts4, "conflicting intents")) - // Intents above the upper time bound or beneath the lower time bound must - // be ignored (#28358). Note that the lower time bound is exclusive while - // the upper time bound is inclusive. - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, ts3, kvs(kv1_3Deleted, kv2_2_2))) - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4, tsMax, kvs())) - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4.Next(), tsMax, kvs())) + t.Run("intents3", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, ts3, kvs(kv1_3Deleted, kv2_2_2))) intent1 := roachpb.Intent{Span: roachpb.Span{Key: testKey1}, Txn: txn1.TxnMeta, Status: roachpb.COMMITTED} if err := engine.MVCCResolveWriteIntent(ctx, e, nil, intent1); err != nil { @@ -202,7 +194,7 @@ func TestMVCCIterateIncremental(t *testing.T) { if err := engine.MVCCResolveWriteIntent(ctx, e, nil, intent2); err != nil { t.Fatal(err) } - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, tsMax, kvs(kv1_4_4, kv2_2_2))) + t.Run("intents4", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, tsMax, kvs(kv1_4_4, kv2_2_2))) }) t.Run("iterFn=Next", func(t *testing.T) { @@ -260,18 +252,11 @@ func TestMVCCIterateIncremental(t *testing.T) { if err := engine.MVCCPut(ctx, e, nil, txn2.TxnMeta.Key, txn2.TxnMeta.Timestamp, txn2Val, &txn2); err != nil { t.Fatal(err) } - t.Run("intents", + t.Run("intents1", iterateExpectErr(e, fn, testKey1, testKey1.PrefixEnd(), tsMin, tsMax, "conflicting intents")) - t.Run("intents", + t.Run("intents2", iterateExpectErr(e, fn, testKey2, testKey2.PrefixEnd(), tsMin, tsMax, "conflicting intents")) - t.Run("intents", - iterateExpectErr(e, fn, keyMin, keyMax, tsMin, ts4, "conflicting intents")) - // Intents above the upper time bound or beneath the lower time bound must - // be ignored (#28358). Note that the lower time bound is exclusive while - // the upper time bound is inclusive. - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, ts3, kvs(kv1_3Deleted, kv1_2_2, kv1_1_1, kv2_2_2))) - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4, tsMax, kvs())) - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, ts4.Next(), tsMax, kvs())) + t.Run("intents3", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, ts3, kvs(kv1_3Deleted, kv1_2_2, kv1_1_1, kv2_2_2))) intent1 := roachpb.Intent{Span: roachpb.Span{Key: testKey1}, Txn: txn1.TxnMeta, Status: roachpb.COMMITTED} if err := engine.MVCCResolveWriteIntent(ctx, e, nil, intent1); err != nil { @@ -281,7 +266,7 @@ func TestMVCCIterateIncremental(t *testing.T) { if err := engine.MVCCResolveWriteIntent(ctx, e, nil, intent2); err != nil { t.Fatal(err) } - t.Run("intents", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, tsMax, kvs(kv1_4_4, kv1_3Deleted, kv1_2_2, kv1_1_1, kv2_2_2))) + t.Run("intents4", assertEqualKVs(e, fn, keyMin, keyMax, tsMin, tsMax, kvs(kv1_4_4, kv1_3Deleted, kv1_2_2, kv1_1_1, kv2_2_2))) }) }