diff --git a/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.cc b/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.cc index 633dfcdf6102..e7578c70ad17 100644 --- a/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.cc +++ b/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.cc @@ -275,7 +275,6 @@ const int TxnMeta::kEpochFieldNumber; const int TxnMeta::kTimestampFieldNumber; const int TxnMeta::kPriorityFieldNumber; const int TxnMeta::kSequenceFieldNumber; -const int TxnMeta::kDeprecatedBatchIndexFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 TxnMeta::TxnMeta() @@ -303,8 +302,8 @@ TxnMeta::TxnMeta(const TxnMeta& from) timestamp_ = NULL; } ::memcpy(&epoch_, &from.epoch_, - static_cast(reinterpret_cast(&deprecated_batch_index_) - - reinterpret_cast(&epoch_)) + sizeof(deprecated_batch_index_)); + static_cast(reinterpret_cast(&sequence_) - + reinterpret_cast(&epoch_)) + sizeof(sequence_)); // @@protoc_insertion_point(copy_constructor:cockroach.storage.engine.enginepb.TxnMeta) } @@ -312,8 +311,8 @@ void TxnMeta::SharedCtor() { id_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ::memset(×tamp_, 0, static_cast( - reinterpret_cast(&deprecated_batch_index_) - - reinterpret_cast(×tamp_)) + sizeof(deprecated_batch_index_)); + reinterpret_cast(&sequence_) - + reinterpret_cast(×tamp_)) + sizeof(sequence_)); } TxnMeta::~TxnMeta() { @@ -349,8 +348,8 @@ void TxnMeta::Clear() { } timestamp_ = NULL; ::memset(&epoch_, 0, static_cast( - reinterpret_cast(&deprecated_batch_index_) - - reinterpret_cast(&epoch_)) + sizeof(deprecated_batch_index_)); + reinterpret_cast(&sequence_) - + reinterpret_cast(&epoch_)) + sizeof(sequence_)); _internal_metadata_.Clear(); } @@ -446,20 +445,6 @@ bool TxnMeta::MergePartialFromCodedStream( break; } - // int32 deprecated_batch_index = 8; - case 8: { - if (static_cast< ::google::protobuf::uint8>(tag) == - static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) { - - DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< - ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( - input, &deprecated_batch_index_))); - } else { - goto handle_unusual; - } - break; - } - default: { handle_unusual: if (tag == 0) { @@ -517,11 +502,6 @@ void TxnMeta::SerializeWithCachedSizes( ::google::protobuf::internal::WireFormatLite::WriteInt32(7, this->sequence(), output); } - // int32 deprecated_batch_index = 8; - if (this->deprecated_batch_index() != 0) { - ::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->deprecated_batch_index(), output); - } - output->WriteRaw((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).data(), static_cast((::google::protobuf::internal::GetProto3PreserveUnknownsDefault() ? _internal_metadata_.unknown_fields() : _internal_metadata_.default_instance()).size())); // @@protoc_insertion_point(serialize_end:cockroach.storage.engine.enginepb.TxnMeta) @@ -573,13 +553,6 @@ size_t TxnMeta::ByteSizeLong() const { this->sequence()); } - // int32 deprecated_batch_index = 8; - if (this->deprecated_batch_index() != 0) { - total_size += 1 + - ::google::protobuf::internal::WireFormatLite::Int32Size( - this->deprecated_batch_index()); - } - int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); return total_size; @@ -617,9 +590,6 @@ void TxnMeta::MergeFrom(const TxnMeta& from) { if (from.sequence() != 0) { set_sequence(from.sequence()); } - if (from.deprecated_batch_index() != 0) { - set_deprecated_batch_index(from.deprecated_batch_index()); - } } void TxnMeta::CopyFrom(const TxnMeta& from) { @@ -647,7 +617,6 @@ void TxnMeta::InternalSwap(TxnMeta* other) { swap(epoch_, other->epoch_); swap(priority_, other->priority_); swap(sequence_, other->sequence_); - swap(deprecated_batch_index_, other->deprecated_batch_index_); _internal_metadata_.Swap(&other->_internal_metadata_); } diff --git a/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.h b/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.h index 7c383cd9e8cb..b4de3e41de2f 100644 --- a/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.h +++ b/c-deps/libroach/protos/storage/engine/enginepb/mvcc3.pb.h @@ -244,12 +244,6 @@ class TxnMeta : public ::google::protobuf::MessageLite /* @@protoc_insertion_poi ::google::protobuf::int32 sequence() const; void set_sequence(::google::protobuf::int32 value); - // int32 deprecated_batch_index = 8; - void clear_deprecated_batch_index(); - static const int kDeprecatedBatchIndexFieldNumber = 8; - ::google::protobuf::int32 deprecated_batch_index() const; - void set_deprecated_batch_index(::google::protobuf::int32 value); - // @@protoc_insertion_point(class_scope:cockroach.storage.engine.enginepb.TxnMeta) private: @@ -260,7 +254,6 @@ class TxnMeta : public ::google::protobuf::MessageLite /* @@protoc_insertion_poi ::google::protobuf::uint32 epoch_; ::google::protobuf::int32 priority_; ::google::protobuf::int32 sequence_; - ::google::protobuf::int32 deprecated_batch_index_; mutable ::google::protobuf::internal::CachedSize _cached_size_; friend struct ::protobuf_storage_2fengine_2fenginepb_2fmvcc3_2eproto::TableStruct; }; @@ -1779,20 +1772,6 @@ inline void TxnMeta::set_sequence(::google::protobuf::int32 value) { // @@protoc_insertion_point(field_set:cockroach.storage.engine.enginepb.TxnMeta.sequence) } -// int32 deprecated_batch_index = 8; -inline void TxnMeta::clear_deprecated_batch_index() { - deprecated_batch_index_ = 0; -} -inline ::google::protobuf::int32 TxnMeta::deprecated_batch_index() const { - // @@protoc_insertion_point(field_get:cockroach.storage.engine.enginepb.TxnMeta.deprecated_batch_index) - return deprecated_batch_index_; -} -inline void TxnMeta::set_deprecated_batch_index(::google::protobuf::int32 value) { - - deprecated_batch_index_ = value; - // @@protoc_insertion_point(field_set:cockroach.storage.engine.enginepb.TxnMeta.deprecated_batch_index) -} - // ------------------------------------------------------------------- // MVCCStatsDelta diff --git a/pkg/storage/below_raft_protos_test.go b/pkg/storage/below_raft_protos_test.go index 6b4e21f0b862..c2e8f4833d54 100644 --- a/pkg/storage/below_raft_protos_test.go +++ b/pkg/storage/below_raft_protos_test.go @@ -63,7 +63,7 @@ var belowRaftGoldenProtos = map[reflect.Type]fixture{ return m }, emptySum: 7551962144604783939, - populatedSum: 10215960487899724343, + populatedSum: 17791546305376889937, }, reflect.TypeOf(&enginepb.RangeAppliedState{}): { populatedConstructor: func(r *rand.Rand) protoutil.Message { diff --git a/pkg/storage/engine/enginepb/mvcc3.pb.go b/pkg/storage/engine/enginepb/mvcc3.pb.go index 86a4abf374b3..137bab92c9f5 100644 --- a/pkg/storage/engine/enginepb/mvcc3.pb.go +++ b/pkg/storage/engine/enginepb/mvcc3.pb.go @@ -50,20 +50,6 @@ type TxnMeta struct { // last request. Used to prevent replay and out-of-order application // protection (by means of a transaction retry). Sequence int32 `protobuf:"varint,7,opt,name=sequence,proto3" json:"sequence,omitempty"` - // A zero-indexed sequence number indicating the index of a command - // within a batch. This disambiguate Raft replays of a batch from - // multiple commands in a batch which modify the same key. The field - // has now been deprecated because each request in a batch is now - // given its own sequence number. - // - // TODO(nvanbenschoten): Remove this field and its uses entirely - // in 2.2. This is safe because the field is only set on pending - // intents by transactions with 2.0 coordinators. 2.1 nodes need - // to be able to handle the field so they can interop with 2.0 nodes. - // However, 2.2 nodes will not, because all transactions started by - // 2.0 nodes will necessarily be abandoned for 2.2 nodes to join a - // cluster. - DeprecatedBatchIndex int32 `protobuf:"varint,8,opt,name=deprecated_batch_index,json=deprecatedBatchIndex,proto3" json:"deprecated_batch_index,omitempty"` } func (m *TxnMeta) Reset() { *m = TxnMeta{} } @@ -272,9 +258,6 @@ func (this *TxnMeta) Equal(that interface{}) bool { if this.Sequence != that1.Sequence { return false } - if this.DeprecatedBatchIndex != that1.DeprecatedBatchIndex { - return false - } return true } func (this *MVCCStatsDelta) Equal(that interface{}) bool { @@ -485,11 +468,6 @@ func (m *TxnMeta) MarshalTo(dAtA []byte) (int, error) { i++ i = encodeVarintMvcc3(dAtA, i, uint64(m.Sequence)) } - if m.DeprecatedBatchIndex != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintMvcc3(dAtA, i, uint64(m.DeprecatedBatchIndex)) - } return i, nil } @@ -1002,10 +980,6 @@ func NewPopulatedTxnMeta(r randyMvcc3, easy bool) *TxnMeta { if r.Intn(2) == 0 { this.Sequence *= -1 } - this.DeprecatedBatchIndex = int32(r.Int31()) - if r.Intn(2) == 0 { - this.DeprecatedBatchIndex *= -1 - } if !easy && r.Intn(10) != 0 { } return this @@ -1174,9 +1148,6 @@ func (m *TxnMeta) Size() (n int) { if m.Sequence != 0 { n += 1 + sovMvcc3(uint64(m.Sequence)) } - if m.DeprecatedBatchIndex != 0 { - n += 1 + sovMvcc3(uint64(m.DeprecatedBatchIndex)) - } return n } @@ -1608,25 +1579,6 @@ func (m *TxnMeta) Unmarshal(dAtA []byte) error { break } } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedBatchIndex", wireType) - } - m.DeprecatedBatchIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMvcc3 - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DeprecatedBatchIndex |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipMvcc3(dAtA[iNdEx:]) @@ -3334,69 +3286,67 @@ var ( func init() { proto.RegisterFile("storage/engine/enginepb/mvcc3.proto", fileDescriptorMvcc3) } var fileDescriptorMvcc3 = []byte{ - // 1013 bytes of a gzipped FileDescriptorProto + // 990 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x6f, 0xe3, 0x44, - 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a, 0x8b, 0x22, - 0x66, 0xc5, 0x81, 0x8d, 0x18, 0xb1, 0x3c, 0xe4, 0xf9, 0x91, 0x38, 0xdd, 0x8a, 0xf9, 0x0a, 0x07, - 0x4e, 0x85, 0xff, 0x13, 0xee, 0x86, 0xf7, 0x01, 0xa0, 0x1e, 0x23, 0x1e, 0xb3, 0x90, 0x43, 0x74, - 0x55, 0x04, 0x15, 0xa5, 0xa7, 0xe3, 0x10, 0xf8, 0x0e, 0x28, 0x3b, 0xd8, 0x1a, 0xce, 0x19, 0x89, - 0x44, 0x00, 0x3f, 0xcf, 0x4a, 0x77, 0x6f, 0x71, 0x51, 0x07, 0x1f, 0xf4, 0xba, 0xdc, 0xdd, 0x71, - 0x88, 0x09, 0x1c, 0x9c, 0xae, 0x39, 0xa1, 0x4b, 0xa7, 0x44, 0xe6, 0x88, 0xb3, 0x86, 0x66, 0x91, - 0x7b, 0x44, 0x44, 0x06, 0x63, 0x3f, 0xf6, 0x98, 0x38, 0xf0, 0x04, 0xee, 0x71, 0x07, 0x7c, 0x1d, - 0x14, 0xc7, 0x64, 0x9e, 0x24, 0x6f, 0x0b, 0xb4, 0x30, 0x26, 0x73, 0x99, 0x9b, 0x80, 0x32, 0x75, - 0x27, 0x03, 0xb3, 0xcc, 0x29, 0x72, 0x93, 0xcc, 0x82, 0x04, 0xa7, 0xc8, 0xcd, 0x32, 0x39, 0x28, - 0x33, 0x8b, 0x19, 0x28, 0x33, 0x1f, 0x80, 0x72, 0x72, 0x04, 0x32, 0x19, 0x08, 0xbc, 0x24, 0x7d, - 0x32, 0x7f, 0x19, 0x22, 0x29, 0x4a, 0xab, 0x21, 0x59, 0xfd, 0x68, 0x1e, 0x25, 0x14, 0x65, 0x59, - 0x22, 0x9a, 0x47, 0x59, 0x7d, 0x0e, 0xca, 0xe4, 0xdd, 0x0c, 0x94, 0x99, 0x6f, 0x03, 0x88, 0x7d, - 0x8f, 0x21, 0xea, 0x45, 0x16, 0x89, 0x18, 0x9d, 0x20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, 0x53, 0xe2, 0x66, 0x99, 0x02, 0x54, 0x99, 0xc5, 0x0c, 0x54, 0x99, 0x0f, 0x50, + 0x39, 0x79, 0x02, 0x95, 0x8c, 0x24, 0x5e, 0x52, 0x3e, 0x95, 0xbf, 0x0c, 0x51, 0x14, 0xa5, 0xd5, + 0x90, 0xac, 0x7e, 0x34, 0x8f, 0x12, 0x8a, 0xb2, 0x2a, 0x11, 0xcd, 0xa3, 0xac, 0xbe, 0x00, 0x55, + 0xf2, 0x6e, 0x06, 0xaa, 0xcc, 0xb7, 0x10, 0xb6, 0x7d, 0x8f, 0x13, 0xe6, 0x45, 0x16, 0x8d, 0x38, + 0x9b, 0x10, 0x41, 0xb1, 0x57, 0x07, 0xcd, 0x82, 0xb9, 0x9f, 0x22, 0xef, 0xa7, 0xc0, 0x71, 0x4e, + 0x8c, 0x40, 0xe3, 0x6f, 0x88, 0xee, 0x09, 0xd9, 0x3f, 0xa1, 0x61, 0xc4, 0x22, 0x71, 0x0d, 0x39, + 0x00, 0xff, 0x37, 0xed, 0xe1, 0x66, 0xed, 0xe1, 0x46, 0xed, 0xe1, 0x26, 0xed, 0xe1, 0x26, 0xed, + 0xe1, 0x26, 0xed, 0xe1, 0x15, 0xda, 0xc3, 0xab, 0xb5, 0x87, 0x57, 0x68, 0x0f, 0x37, 0x69, 0x0f, + 0x6f, 0xae, 0x7d, 0xb6, 0x02, 0x1a, 0xcf, 0x01, 0xda, 0x37, 0x89, 0xe7, 0xd0, 0x76, 0x10, 0xb8, + 0x8c, 0x0e, 0x85, 0xfa, 0x14, 0xbf, 0x89, 0x70, 0x48, 0xbe, 0xe2, 0x16, 0x51, 0x4e, 0x8b, 0x79, + 0x43, 0x3a, 0x93, 0xf2, 0xe7, 0xcc, 0x8a, 0x40, 0x92, 0xe8, 0xbe, 0xf0, 0x63, 0x03, 0xdd, 0x73, + 0x29, 0x89, 0xe8, 0x0b, 0xe1, 0x9a, 0x0c, 0xdf, 0x97, 0xd0, 0x5a, 0xf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x2a, 0x3d, 0x13, 0x33, 0x6e, 0xa9, 0xfb, 0x01, 0xd9, 0xde, 0xd1, 0x4b, 0xfe, 0xa0, 0x57, 0x7f, + 0x9d, 0x26, 0x7a, 0x96, 0x59, 0xf8, 0x29, 0x2a, 0x2b, 0x56, 0xb5, 0x22, 0x13, 0xf9, 0xdf, 0xb9, + 0x0e, 0x6d, 0xfa, 0x20, 0xa6, 0xba, 0x9f, 0x32, 0xf1, 0xe7, 0x68, 0x37, 0xf9, 0xac, 0x25, 0xcc, + 0x4a, 0x8f, 0x77, 0x5f, 0x92, 0x79, 0x7d, 0xfe, 0xcd, 0x72, 0xbc, 0x62, 0x0b, 0x6e, 0x5b, 0x0e, + 0x5a, 0xca, 0x9d, 0xbb, 0x16, 0xf7, 0xfa, 0x90, 0x9a, 0x65, 0x7b, 0xc5, 0x16, 0x0f, 0x42, 0x84, + 0xcc, 0x29, 0x75, 0xfe, 0x5a, 0x0f, 0xb2, 0x36, 0x21, 0x66, 0x89, 0x2c, 0xcd, 0xe3, 0xdc, 0xc5, + 0x79, 0x0d, 0x74, 0xf4, 0x8b, 0xdf, 0xab, 0x5b, 0x17, 0x8b, 0x2a, 0xf8, 0x69, 0x51, 0x05, 0xbf, + 0x2c, 0xaa, 0xe0, 0xb7, 0x45, 0x15, 0x7c, 0xfb, 0x47, 0x75, 0x6b, 0xb0, 0x2d, 0xff, 0x75, 0x3e, + 0xfa, 0x27, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xcb, 0x02, 0x8b, 0xb4, 0x0b, 0x00, 0x00, } diff --git a/pkg/storage/engine/enginepb/mvcc3.proto b/pkg/storage/engine/enginepb/mvcc3.proto index 9428599e7b80..043fb27cfd05 100644 --- a/pkg/storage/engine/enginepb/mvcc3.proto +++ b/pkg/storage/engine/enginepb/mvcc3.proto @@ -53,20 +53,7 @@ message TxnMeta { // last request. Used to prevent replay and out-of-order application // protection (by means of a transaction retry). int32 sequence = 7; - // A zero-indexed sequence number indicating the index of a command - // within a batch. This disambiguate Raft replays of a batch from - // multiple commands in a batch which modify the same key. The field - // has now been deprecated because each request in a batch is now - // given its own sequence number. - // - // TODO(nvanbenschoten): Remove this field and its uses entirely - // in 2.2. This is safe because the field is only set on pending - // intents by transactions with 2.0 coordinators. 2.1 nodes need - // to be able to handle the field so they can interop with 2.0 nodes. - // However, 2.2 nodes will not, because all transactions started by - // 2.0 nodes will necessarily be abandoned for 2.2 nodes to join a - // cluster. - int32 deprecated_batch_index = 8; + reserved 8; } // MVCCStatsDelta is convertible to MVCCStats, but uses signed variable width diff --git a/pkg/storage/engine/mvcc.go b/pkg/storage/engine/mvcc.go index 80d6d237e773..b709e4c95bb6 100644 --- a/pkg/storage/engine/mvcc.go +++ b/pkg/storage/engine/mvcc.go @@ -1332,6 +1332,9 @@ func mvccPutInternal( return errors.Errorf("put with epoch %d came after put with epoch %d in txn %s", txn.Epoch, meta.Txn.Epoch, txn.ID) } else if txn.Epoch == meta.Txn.Epoch && txn.Sequence <= meta.Txn.Sequence { + // The transaction has executed at this sequence before. This is merely a + // replay of the transactional write. Assert that all is in order and return + // early. return replayTransactionalWrite(ctx, engine, iter, meta, ms, key, timestamp, value, txn, buf, valueFn) } diff --git a/pkg/storage/engine/mvcc_test.go b/pkg/storage/engine/mvcc_test.go index 31bf7b5a9eb0..eea3e8a2c927 100644 --- a/pkg/storage/engine/mvcc_test.go +++ b/pkg/storage/engine/mvcc_test.go @@ -3286,11 +3286,10 @@ func TestMVCCReadWithOldEpoch(t *testing.T) { } } -// TestMVCCWriteWithSequenceAndBatchIndex verifies that retry errors +// TestMVCCWriteWithSequence verifies that no retry errors // are thrown in the event that earlier sequence numbers are -// encountered or if the same sequence and an earlier or same batch -// index. -func TestMVCCWriteWithSequenceAndBatchIndex(t *testing.T) { +// encountered. +func TestMVCCWriteWithSequence(t *testing.T) { defer leaktest.AfterTest(t)() ctx := context.Background() @@ -3298,39 +3297,32 @@ func TestMVCCWriteWithSequenceAndBatchIndex(t *testing.T) { defer engine.Close() testCases := []struct { - sequence int32 - batchIndex int32 - expRetry bool + sequence int32 + expectedErr string }{ - {1, 0, false}, // old sequence old batch index - {1, 1, false}, // old sequence, same batch index - {1, 2, false}, // old sequence, new batch index - {2, 0, false}, // same sequence, old batch index - {2, 1, false}, // same sequence, same batch index - {2, 2, false}, // same sequence, new batch index - {3, 0, false}, // new sequence, old batch index - {3, 1, false}, // new sequence, same batch index - {3, 2, false}, // new sequence, new batch index + {1, "missing an intent"}, // old sequence + {2, ""}, // same sequence + {3, ""}, // new sequence } ts := hlc.Timestamp{Logical: 1} for i, tc := range testCases { key := roachpb.Key(fmt.Sprintf("key-%d", i)) - // Start with sequence 2, batch index 1. + // Start with sequence 2. txn := *txn1 txn.Sequence = 2 - txn.DeprecatedBatchIndex = 1 if err := MVCCPut(ctx, engine, nil, key, ts, value1, &txn); err != nil { t.Fatal(err) } - txn.Sequence, txn.DeprecatedBatchIndex = tc.sequence, tc.batchIndex - err := MVCCPut(ctx, engine, nil, key, ts, value2, &txn) - _, ok := err.(*roachpb.TransactionRetryError) - if !tc.expRetry && ok { + txn.Sequence = tc.sequence + err := MVCCPut(ctx, engine, nil, key, ts, value1, &txn) + if tc.expectedErr != "" && err != nil { + if !testutils.IsError(err, tc.expectedErr) { + t.Fatalf("%d: unexpected error: %s", i, err) + } + } else if err != nil { t.Fatalf("%d: unexpected error: %s", i, err) - } else if ok != tc.expRetry { - t.Fatalf("%d: expected retry %t but got %s", i, tc.expRetry, err) } } }