From 2d6a18cf96e9b19fa87df245782e6f0b1e36afb7 Mon Sep 17 00:00:00 2001 From: Andrei Matei Date: Thu, 10 Sep 2020 12:19:04 -0400 Subject: [PATCH] kvserver: reintroduce RangeDesc.GenerationComparable We dropped this field recently, but unfortunately that wasn't safe for mixed-version clusters. The rub is that 20.1 nodes need to roundtrip the proto through 20.2 nodes in a fairly subtle way. When it comes back to the 20.1 node, the descriptor needs to compare Equal() to the original. We configure our protos to not preserve unrecognized fields, so removing the field breaks this round-tripping. Specifically, the scenario which broke is the following: 1. A 20.1 node processes an AdminSplit, and performs the tranction writing the new descriptors. The descriptors have the GenerationCompable field set. 2. The lease changes while the respective txn is running. The lease moves to a 20.2 node. 3. The 20.2 node evaluates the EndTxn, and computes the split trigger info that's going to be replicated. The EndTxn has split info in it containing the field set, but the field is dropped when converting that into the proposed SplitTrigger (since the 20.2 unmarshalls and re-marshalls the descriptors). 4. All the 20.1 replicas of the ranges involved now apply the respective trigger via Raft, and their in-memory state doesn't have the field set. This doesn't match the bytes written in the database, which have the field. 5. The discrepancy between the in-memory state and the db state is a problem, as it causes the 20.1 node to spin if it tries to perform subsequent merge/split operations. The reason is that the code performing these operations short-circuits itself if it detects that the descriptor has changed while the operation was running. This detection is performed via the generated Equals() method, and it mis-fires because of the phantom field. That detection happens here: https://github.com/cockroachdb/cockroach/blob/79c01d28da9c379f67bb41beef3d85ad3bee1da1/pkg/kv/kvserver/replica_command.go#L1957 This patch takes precautions so that we can remove the field again in 21.1 - I'm merging this in 21.1, I'll backport it to 20.2, and then I'll come back to 20.2 and remove the field. Namely, the patch changes RangeDesc.Equal() to ignore that field (and the method is no longer generated). Fixes #53535 Release note: None --- c-deps/libroach/protos/roachpb/metadata.pb.cc | 47 ++- c-deps/libroach/protos/roachpb/metadata.pb.h | 34 ++ pkg/kv/kvclient/kvcoord/range_cache.go | 2 +- pkg/kv/kvserver/client_replica_test.go | 2 +- pkg/kv/kvserver/replica_command.go | 3 +- pkg/kv/kvserver/replica_gc_queue.go | 2 +- pkg/roachpb/metadata.go | 39 +++ pkg/roachpb/metadata.pb.go | 330 +++++++++--------- pkg/roachpb/metadata.proto | 25 +- 9 files changed, 301 insertions(+), 183 deletions(-) diff --git a/c-deps/libroach/protos/roachpb/metadata.pb.cc b/c-deps/libroach/protos/roachpb/metadata.pb.cc index 0dd2b4ff83ce..e2ee83dd40d8 100644 --- a/c-deps/libroach/protos/roachpb/metadata.pb.cc +++ b/c-deps/libroach/protos/roachpb/metadata.pb.cc @@ -1296,6 +1296,7 @@ const int RangeDescriptor::kEndKeyFieldNumber; const int RangeDescriptor::kInternalReplicasFieldNumber; const int RangeDescriptor::kNextReplicaIdFieldNumber; const int RangeDescriptor::kGenerationFieldNumber; +const int RangeDescriptor::kDeprecatedGenerationComparableFieldNumber; const int RangeDescriptor::kStickyBitFieldNumber; #endif // !defined(_MSC_VER) || _MSC_VER >= 1900 @@ -1326,8 +1327,8 @@ RangeDescriptor::RangeDescriptor(const RangeDescriptor& from) sticky_bit_ = NULL; } ::memcpy(&range_id_, &from.range_id_, - static_cast(reinterpret_cast(&next_replica_id_) - - reinterpret_cast(&range_id_)) + sizeof(next_replica_id_)); + static_cast(reinterpret_cast(&deprecated_generation_comparable_) - + reinterpret_cast(&range_id_)) + sizeof(deprecated_generation_comparable_)); // @@protoc_insertion_point(copy_constructor:cockroach.roachpb.RangeDescriptor) } @@ -1335,8 +1336,8 @@ void RangeDescriptor::SharedCtor() { start_key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); end_key_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ::memset(&sticky_bit_, 0, static_cast( - reinterpret_cast(&next_replica_id_) - - reinterpret_cast(&sticky_bit_)) + sizeof(next_replica_id_)); + reinterpret_cast(&deprecated_generation_comparable_) - + reinterpret_cast(&sticky_bit_)) + sizeof(deprecated_generation_comparable_)); } RangeDescriptor::~RangeDescriptor() { @@ -1379,10 +1380,10 @@ void RangeDescriptor::Clear() { sticky_bit_->Clear(); } } - if (cached_has_bits & 56u) { + if (cached_has_bits & 120u) { ::memset(&range_id_, 0, static_cast( - reinterpret_cast(&next_replica_id_) - - reinterpret_cast(&range_id_)) + sizeof(next_replica_id_)); + reinterpret_cast(&deprecated_generation_comparable_) - + reinterpret_cast(&range_id_)) + sizeof(deprecated_generation_comparable_)); } _has_bits_.Clear(); _internal_metadata_.Clear(); @@ -1488,6 +1489,20 @@ bool RangeDescriptor::MergePartialFromCodedStream( break; } + // optional bool deprecated_generation_comparable = 8; + case 8: { + if (static_cast< ::google::protobuf::uint8>(tag) == + static_cast< ::google::protobuf::uint8>(64u /* 64 & 0xFF */)) { + set_has_deprecated_generation_comparable(); + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &deprecated_generation_comparable_))); + } else { + goto handle_unusual; + } + break; + } + default: { handle_unusual: if (tag == 0) { @@ -1551,6 +1566,11 @@ void RangeDescriptor::SerializeWithCachedSizes( 7, this->_internal_sticky_bit(), output); } + // optional bool deprecated_generation_comparable = 8; + if (cached_has_bits & 0x00000040u) { + ::google::protobuf::internal::WireFormatLite::WriteBool(8, this->deprecated_generation_comparable(), output); + } + output->WriteRaw(_internal_metadata_.unknown_fields().data(), static_cast(_internal_metadata_.unknown_fields().size())); // @@protoc_insertion_point(serialize_end:cockroach.roachpb.RangeDescriptor) @@ -1572,7 +1592,7 @@ size_t RangeDescriptor::ByteSizeLong() const { } } - if (_has_bits_[0 / 32] & 63u) { + if (_has_bits_[0 / 32] & 127u) { if (has_start_key()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::BytesSize( @@ -1610,6 +1630,11 @@ size_t RangeDescriptor::ByteSizeLong() const { this->next_replica_id()); } + // optional bool deprecated_generation_comparable = 8; + if (has_deprecated_generation_comparable()) { + total_size += 1 + 1; + } + } int cached_size = ::google::protobuf::internal::ToCachedSize(total_size); SetCachedSize(cached_size); @@ -1630,7 +1655,7 @@ void RangeDescriptor::MergeFrom(const RangeDescriptor& from) { internal_replicas_.MergeFrom(from.internal_replicas_); cached_has_bits = from._has_bits_[0]; - if (cached_has_bits & 63u) { + if (cached_has_bits & 127u) { if (cached_has_bits & 0x00000001u) { set_has_start_key(); start_key_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.start_key_); @@ -1651,6 +1676,9 @@ void RangeDescriptor::MergeFrom(const RangeDescriptor& from) { if (cached_has_bits & 0x00000020u) { next_replica_id_ = from.next_replica_id_; } + if (cached_has_bits & 0x00000040u) { + deprecated_generation_comparable_ = from.deprecated_generation_comparable_; + } _has_bits_[0] |= cached_has_bits; } } @@ -1681,6 +1709,7 @@ void RangeDescriptor::InternalSwap(RangeDescriptor* other) { swap(range_id_, other->range_id_); swap(generation_, other->generation_); swap(next_replica_id_, other->next_replica_id_); + swap(deprecated_generation_comparable_, other->deprecated_generation_comparable_); swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); } diff --git a/c-deps/libroach/protos/roachpb/metadata.pb.h b/c-deps/libroach/protos/roachpb/metadata.pb.h index 0304ab3e3d1d..ada6b6a0a067 100644 --- a/c-deps/libroach/protos/roachpb/metadata.pb.h +++ b/c-deps/libroach/protos/roachpb/metadata.pb.h @@ -796,6 +796,13 @@ class RangeDescriptor : public ::google::protobuf::MessageLite /* @@protoc_inser ::google::protobuf::int32 next_replica_id() const; void set_next_replica_id(::google::protobuf::int32 value); + // optional bool deprecated_generation_comparable = 8; + bool has_deprecated_generation_comparable() const; + void clear_deprecated_generation_comparable(); + static const int kDeprecatedGenerationComparableFieldNumber = 8; + bool deprecated_generation_comparable() const; + void set_deprecated_generation_comparable(bool value); + // @@protoc_insertion_point(class_scope:cockroach.roachpb.RangeDescriptor) private: void set_has_range_id(); @@ -808,6 +815,8 @@ class RangeDescriptor : public ::google::protobuf::MessageLite /* @@protoc_inser void clear_has_next_replica_id(); void set_has_generation(); void clear_has_generation(); + void set_has_deprecated_generation_comparable(); + void clear_has_deprecated_generation_comparable(); void set_has_sticky_bit(); void clear_has_sticky_bit(); @@ -821,6 +830,7 @@ class RangeDescriptor : public ::google::protobuf::MessageLite /* @@protoc_inser ::google::protobuf::int64 range_id_; ::google::protobuf::int64 generation_; ::google::protobuf::int32 next_replica_id_; + bool deprecated_generation_comparable_; friend struct ::protobuf_roachpb_2fmetadata_2eproto::TableStruct; }; // ------------------------------------------------------------------- @@ -2754,6 +2764,30 @@ inline void RangeDescriptor::set_generation(::google::protobuf::int64 value) { // @@protoc_insertion_point(field_set:cockroach.roachpb.RangeDescriptor.generation) } +// optional bool deprecated_generation_comparable = 8; +inline bool RangeDescriptor::has_deprecated_generation_comparable() const { + return (_has_bits_[0] & 0x00000040u) != 0; +} +inline void RangeDescriptor::set_has_deprecated_generation_comparable() { + _has_bits_[0] |= 0x00000040u; +} +inline void RangeDescriptor::clear_has_deprecated_generation_comparable() { + _has_bits_[0] &= ~0x00000040u; +} +inline void RangeDescriptor::clear_deprecated_generation_comparable() { + deprecated_generation_comparable_ = false; + clear_has_deprecated_generation_comparable(); +} +inline bool RangeDescriptor::deprecated_generation_comparable() const { + // @@protoc_insertion_point(field_get:cockroach.roachpb.RangeDescriptor.deprecated_generation_comparable) + return deprecated_generation_comparable_; +} +inline void RangeDescriptor::set_deprecated_generation_comparable(bool value) { + set_has_deprecated_generation_comparable(); + deprecated_generation_comparable_ = value; + // @@protoc_insertion_point(field_set:cockroach.roachpb.RangeDescriptor.deprecated_generation_comparable) +} + // optional .cockroach.util.hlc.Timestamp sticky_bit = 7; inline bool RangeDescriptor::has_sticky_bit() const { return (_has_bits_[0] & 0x00000004u) != 0; diff --git a/pkg/kv/kvclient/kvcoord/range_cache.go b/pkg/kv/kvclient/kvcoord/range_cache.go index 6de6588d9a30..4ad5e106a124 100644 --- a/pkg/kv/kvclient/kvcoord/range_cache.go +++ b/pkg/kv/kvclient/kvcoord/range_cache.go @@ -1179,7 +1179,7 @@ func compareEntryDescs(a, b *rangeCacheEntry) int { } } - if a.desc.Equal(b.desc) { + if a.desc.Equal(&b.desc) { return 0 } diff --git a/pkg/kv/kvserver/client_replica_test.go b/pkg/kv/kvserver/client_replica_test.go index d1cdb14bbd72..ae8cf6e3d453 100644 --- a/pkg/kv/kvserver/client_replica_test.go +++ b/pkg/kv/kvserver/client_replica_test.go @@ -1854,7 +1854,7 @@ func TestSystemZoneConfigs(t *testing.T) { if len(desc.Replicas().Learners()) > 0 { return false, fmt.Errorf("descriptor contains learners: %v", desc) } - if existing, ok := replicas[desc.RangeID]; ok && !existing.Equal(desc) { + if existing, ok := replicas[desc.RangeID]; ok && !existing.Equal(&desc) { return false, fmt.Errorf("mismatch between\n%s\n%s", &existing, &desc) } replicas[desc.RangeID] = desc diff --git a/pkg/kv/kvserver/replica_command.go b/pkg/kv/kvserver/replica_command.go index e72ced72243b..4b866b427625 100644 --- a/pkg/kv/kvserver/replica_command.go +++ b/pkg/kv/kvserver/replica_command.go @@ -71,7 +71,7 @@ func maybeDescriptorChangedError( if !detail.ActualValue.IsPresent() { return true, nil } else if err := detail.ActualValue.GetProto(&actualDesc); err == nil && - desc.RangeID == actualDesc.RangeID && !desc.Equal(actualDesc) { + desc.RangeID == actualDesc.RangeID && !desc.Equal(&actualDesc) { return true, &actualDesc } } @@ -1993,7 +1993,6 @@ func checkDescsEqual(desc *roachpb.RangeDescriptor) func(*roachpb.RangeDescripto if desc2 != nil { desc2.Replicas() // for sorting side-effect } - return desc.Equal(desc2) } } diff --git a/pkg/kv/kvserver/replica_gc_queue.go b/pkg/kv/kvserver/replica_gc_queue.go index 2ec4e4daad4a..6ae6c71e3d4d 100644 --- a/pkg/kv/kvserver/replica_gc_queue.go +++ b/pkg/kv/kvserver/replica_gc_queue.go @@ -335,7 +335,7 @@ func (rgcq *replicaGCQueue) process( if len(rs) != 1 { return false, errors.Errorf("expected 1 range descriptor, got %d", len(rs)) } - if leftReplyDesc := &rs[0]; !leftDesc.Equal(*leftReplyDesc) { + if leftReplyDesc := &rs[0]; !leftDesc.Equal(leftReplyDesc) { log.VEventf(ctx, 1, "left neighbor %s not up-to-date with meta descriptor %s; cannot safely GC range yet", leftDesc, leftReplyDesc) // Chances are that the left replica needs to be GC'd. Since we don't diff --git a/pkg/roachpb/metadata.go b/pkg/roachpb/metadata.go index 85de2a93f896..d77bb24cdc56 100644 --- a/pkg/roachpb/metadata.go +++ b/pkg/roachpb/metadata.go @@ -11,6 +11,7 @@ package roachpb import ( + "bytes" "fmt" "sort" "strconv" @@ -145,6 +146,44 @@ func NewRangeDescriptor( return desc } +// Equal compares two descriptors for equality. This was copied over from the +// gogoproto generated version in order to ignore deprecated fields. +func (r *RangeDescriptor) Equal(other *RangeDescriptor) bool { + if other == nil { + return r == nil + } + if r == nil { + return false + } + if r.RangeID != other.RangeID { + return false + } + if r.Generation != other.Generation { + return false + } + if !bytes.Equal(r.StartKey, other.StartKey) { + return false + } + if !bytes.Equal(r.EndKey, other.EndKey) { + return false + } + if len(r.InternalReplicas) != len(other.InternalReplicas) { + return false + } + for i := range r.InternalReplicas { + if !r.InternalReplicas[i].Equal(&other.InternalReplicas[i]) { + return false + } + } + if r.NextReplicaID != other.NextReplicaID { + return false + } + if !r.StickyBit.Equal(other.StickyBit) { + return false + } + return true +} + // RSpan returns the RangeDescriptor's resolved span. func (r *RangeDescriptor) RSpan() RSpan { return RSpan{Key: r.StartKey, EndKey: r.EndKey} diff --git a/pkg/roachpb/metadata.pb.go b/pkg/roachpb/metadata.pb.go index 9286f575df6f..fc19e3199e25 100644 --- a/pkg/roachpb/metadata.pb.go +++ b/pkg/roachpb/metadata.pb.go @@ -9,8 +9,6 @@ import math "math" import util "github.com/cockroachdb/cockroach/pkg/util" import hlc "github.com/cockroachdb/cockroach/pkg/util/hlc" -import bytes "bytes" - import encoding_binary "encoding/binary" import io "io" @@ -112,7 +110,7 @@ func (x *ReplicaType) UnmarshalJSON(data []byte) error { return nil } func (ReplicaType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{0} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{0} } // Attributes specifies a list of arbitrary strings describing @@ -124,7 +122,7 @@ type Attributes struct { func (m *Attributes) Reset() { *m = Attributes{} } func (*Attributes) ProtoMessage() {} func (*Attributes) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{0} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{0} } func (m *Attributes) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -158,7 +156,7 @@ type ReplicationTarget struct { func (m *ReplicationTarget) Reset() { *m = ReplicationTarget{} } func (*ReplicationTarget) ProtoMessage() {} func (*ReplicationTarget) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{1} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{1} } func (m *ReplicationTarget) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -203,7 +201,7 @@ type ReplicaDescriptor struct { func (m *ReplicaDescriptor) Reset() { *m = ReplicaDescriptor{} } func (*ReplicaDescriptor) ProtoMessage() {} func (*ReplicaDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{2} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{2} } func (m *ReplicaDescriptor) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -238,7 +236,7 @@ func (m *ReplicaIdent) Reset() { *m = ReplicaIdent{} } func (m *ReplicaIdent) String() string { return proto.CompactTextString(m) } func (*ReplicaIdent) ProtoMessage() {} func (*ReplicaIdent) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{3} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{3} } func (m *ReplicaIdent) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -267,8 +265,15 @@ var xxx_messageInfo_ReplicaIdent proto.InternalMessageInfo // A range is described using an inclusive start key, a non-inclusive end key, // and a list of replicas where the range is stored. // -// NOTE: Care must be taken when changing the encoding of this proto -// because it is used as part of conditional put operations. +// NOTE: Care must be taken when adding or removing fields from this proto +// because we have code relies on the descriptor comparing Equal() after +// round-tripping through a previous/next version node (i.e. in mixed-version +// clusters). Note that we don't need to proto encoding to be stable since, when +// doing CPuts we use the raw bytes we've read from the DB as the expected value +// (instead of re-marshaling the proto), but unfortunately we also need the +// Equal() method to work. Also note that we configure our protos to not +// maintain unrecognized fields. +// // TODO(jeffreyxiao): All nullable fields in RangeDescriptor can be made // non-nullable if #38302 is guaranteed to be on all nodes (I.E. 20.1). type RangeDescriptor struct { @@ -349,6 +354,11 @@ type RangeDescriptor struct { // replica is gc'able or not. If it is not gc'able, then by definition the // replica applying the merge is. Generation RangeGeneration `protobuf:"varint,6,opt,name=generation,casttype=RangeGeneration" json:"generation"` + // This field is not used any more, but we need to maintain it in 20.2 because + // 20.1 nodes need descriptors to round-trip through 20.2 nodes and compare + // Equal() when they come back. 20.2 nodes know to ignore this field when + // comparing, so the field can be removed in 21.1. + DeprecatedGenerationComparable *bool `protobuf:"varint,8,opt,name=deprecated_generation_comparable,json=deprecatedGenerationComparable" json:"deprecated_generation_comparable,omitempty"` // The presence of the sticky_bit indicates that the range should not be // automatically merged by the merge queue with the range to its left. It is // set during a split operation and unset during an unsplit operation. Note @@ -370,7 +380,7 @@ type RangeDescriptor struct { func (m *RangeDescriptor) Reset() { *m = RangeDescriptor{} } func (*RangeDescriptor) ProtoMessage() {} func (*RangeDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{4} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{4} } func (m *RangeDescriptor) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -409,7 +419,7 @@ type Percentiles struct { func (m *Percentiles) Reset() { *m = Percentiles{} } func (*Percentiles) ProtoMessage() {} func (*Percentiles) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{5} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{5} } func (m *Percentiles) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -471,7 +481,7 @@ type StoreCapacity struct { func (m *StoreCapacity) Reset() { *m = StoreCapacity{} } func (*StoreCapacity) ProtoMessage() {} func (*StoreCapacity) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{6} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{6} } func (m *StoreCapacity) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,7 +526,7 @@ func (m *NodeDescriptor) Reset() { *m = NodeDescriptor{} } func (m *NodeDescriptor) String() string { return proto.CompactTextString(m) } func (*NodeDescriptor) ProtoMessage() {} func (*NodeDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{7} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{7} } func (m *NodeDescriptor) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -552,7 +562,7 @@ func (m *LocalityAddress) Reset() { *m = LocalityAddress{} } func (m *LocalityAddress) String() string { return proto.CompactTextString(m) } func (*LocalityAddress) ProtoMessage() {} func (*LocalityAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{8} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{8} } func (m *LocalityAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -590,7 +600,7 @@ func (m *StoreDescriptor) Reset() { *m = StoreDescriptor{} } func (m *StoreDescriptor) String() string { return proto.CompactTextString(m) } func (*StoreDescriptor) ProtoMessage() {} func (*StoreDescriptor) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{9} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{9} } func (m *StoreDescriptor) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -627,7 +637,7 @@ func (m *StoreDeadReplicas) Reset() { *m = StoreDeadReplicas{} } func (m *StoreDeadReplicas) String() string { return proto.CompactTextString(m) } func (*StoreDeadReplicas) ProtoMessage() {} func (*StoreDeadReplicas) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{10} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{10} } func (m *StoreDeadReplicas) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -661,7 +671,7 @@ type Locality struct { func (m *Locality) Reset() { *m = Locality{} } func (*Locality) ProtoMessage() {} func (*Locality) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{11} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{11} } func (m *Locality) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -697,7 +707,7 @@ type Tier struct { func (m *Tier) Reset() { *m = Tier{} } func (*Tier) ProtoMessage() {} func (*Tier) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{12} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{12} } func (m *Tier) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -736,7 +746,7 @@ type Version struct { func (m *Version) Reset() { *m = Version{} } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_metadata_7ed07157f6315f19, []int{13} + return fileDescriptor_metadata_a87f6e067a405dc7, []int{13} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -844,53 +854,6 @@ func (this *ReplicaDescriptor) Equal(that interface{}) bool { } return true } -func (this *RangeDescriptor) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RangeDescriptor) - if !ok { - that2, ok := that.(RangeDescriptor) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.RangeID != that1.RangeID { - return false - } - if !bytes.Equal(this.StartKey, that1.StartKey) { - return false - } - if !bytes.Equal(this.EndKey, that1.EndKey) { - return false - } - if len(this.InternalReplicas) != len(that1.InternalReplicas) { - return false - } - for i := range this.InternalReplicas { - if !this.InternalReplicas[i].Equal(&that1.InternalReplicas[i]) { - return false - } - } - if this.NextReplicaID != that1.NextReplicaID { - return false - } - if this.Generation != that1.Generation { - return false - } - if !this.StickyBit.Equal(that1.StickyBit) { - return false - } - return true -} func (m *Attributes) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1067,6 +1030,16 @@ func (m *RangeDescriptor) MarshalTo(dAtA []byte) (int, error) { } i += n2 } + if m.DeprecatedGenerationComparable != nil { + dAtA[i] = 0x40 + i++ + if *m.DeprecatedGenerationComparable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + } return i, nil } @@ -1525,6 +1498,10 @@ func NewPopulatedRangeDescriptor(r randyMetadata, easy bool) *RangeDescriptor { if r.Intn(10) != 0 { this.StickyBit = hlc.NewPopulatedTimestamp(r, easy) } + if r.Intn(10) != 0 { + v6 := bool(bool(r.Intn(2) == 0)) + this.DeprecatedGenerationComparable = &v6 + } if !easy && r.Intn(10) != 0 { } return this @@ -1549,9 +1526,9 @@ func randUTF8RuneMetadata(r randyMetadata) rune { return rune(ru + 61) } func randStringMetadata(r randyMetadata) string { - v6 := r.Intn(100) - tmps := make([]rune, v6) - for i := 0; i < v6; i++ { + v7 := r.Intn(100) + tmps := make([]rune, v7) + for i := 0; i < v7; i++ { tmps[i] = randUTF8RuneMetadata(r) } return string(tmps) @@ -1573,11 +1550,11 @@ func randFieldMetadata(dAtA []byte, r randyMetadata, fieldNumber int, wire int) switch wire { case 0: dAtA = encodeVarintPopulateMetadata(dAtA, uint64(key)) - v7 := r.Int63() + v8 := r.Int63() if r.Intn(2) == 0 { - v7 *= -1 + v8 *= -1 } - dAtA = encodeVarintPopulateMetadata(dAtA, uint64(v7)) + dAtA = encodeVarintPopulateMetadata(dAtA, uint64(v8)) case 1: dAtA = encodeVarintPopulateMetadata(dAtA, uint64(key)) dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) @@ -1682,6 +1659,9 @@ func (m *RangeDescriptor) Size() (n int) { l = m.StickyBit.Size() n += 1 + l + sovMetadata(uint64(l)) } + if m.DeprecatedGenerationComparable != nil { + n += 2 + } return n } @@ -2456,6 +2436,27 @@ func (m *RangeDescriptor) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DeprecatedGenerationComparable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMetadata + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.DeprecatedGenerationComparable = &b default: iNdEx = preIndex skippy, err := skipMetadata(dAtA[iNdEx:]) @@ -3955,96 +3956,97 @@ var ( ErrIntOverflowMetadata = fmt.Errorf("proto: integer overflow") ) -func init() { proto.RegisterFile("roachpb/metadata.proto", fileDescriptor_metadata_7ed07157f6315f19) } - -var fileDescriptor_metadata_7ed07157f6315f19 = []byte{ - // 1393 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xc6, 0xeb, 0x78, 0xfd, 0xf2, 0x65, 0x8f, 0xa0, 0xb5, 0x8c, 0xb0, 0xd3, 0x85, 0x8a, - 0xb6, 0xa0, 0x24, 0x0d, 0x8a, 0xaa, 0x06, 0x0a, 0xc4, 0x4d, 0x5a, 0xb9, 0xcd, 0x17, 0x1b, 0xb7, - 0x48, 0x5c, 0x56, 0x93, 0xdd, 0xc1, 0x59, 0xba, 0xde, 0x75, 0x67, 0x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x11, 0x0b, 0x42, 0x92, - 0xa0, 0x53, 0x90, 0xef, 0x5d, 0x5c, 0x10, 0xb5, 0x33, 0x54, 0x2e, 0x38, 0x20, 0xf0, 0xc5, 0x25, - 0x51, 0x9b, 0x21, 0xbe, 0xb8, 0x24, 0xf0, 0xa5, 0x05, 0x51, 0x8e, 0x21, 0xbe, 0x24, 0xf9, 0x97, - 0x96, 0x44, 0xaf, 0x0f, 0xf1, 0x4b, 0x92, 0x7f, 0x79, 0x41, 0xa4, 0x6e, 0x88, 0x5f, 0x5e, 0x40, - 0x55, 0x30, 0x7b, 0x1b, 0xf8, 0xbe, 0x48, 0x86, 0x36, 0x08, 0x44, 0x4d, 0xa1, 0xa3, 0x3c, 0x4c, - 0x89, 0x03, 0x79, 0x15, 0xf7, 0xb0, 0x17, 0xb0, 0x01, 0x9a, 0x05, 0xcb, 0x53, 0x6b, 0xd5, 0x6a, - 0x52, 0x95, 0xa2, 0xc8, 0x86, 0x12, 0xde, 0xc7, 0x41, 0x88, 0x77, 0x43, 0x22, 0x22, 0xd7, 0x94, - 0x21, 0x8c, 0xce, 0xc2, 0x84, 0x6c, 0x58, 0x2f, 0xee, 0x47, 0x4c, 0x1d, 0x6a, 0xc9, 0x02, 0x61, - 0xb8, 0xca, 0x71, 0x4e, 0x0b, 0x09, 0x4e, 0x34, 0xcd, 0xcc, 0xd2, 0x84, 0x41, 0xd2, 0x16, 0xa0, - 0x72, 0x8f, 0x06, 0x8c, 0x24, 0x6e, 0x8f, 0x50, 0x37, 0x21, 0x5e, 0x1c, 0xf9, 0x23, 0x7b, 0x9d, - 0x91, 0xe6, 0x6d, 0x42, 0x77, 0x84, 0x11, 0x6d, 0x43, 0x65, 0x77, 0xa0, 0x05, 0xfa, 0x50, 0x8e, - 0x8b, 0xc2, 0x9e, 0x34, 0x21, 0x32, 0xa5, 0xd2, 0x1e, 0x85, 0x7c, 0x9b, 0x50, 0xd5, 0x5e, 0xc8, - 0x01, 0x94, 0x89, 0x41, 0xbb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0xe6, 0x77, 0xbf, 0xd4, 0x73, 0xcd, 0xf3, - 0x8f, 0x7e, 0xaf, 0xe7, 0x1e, 0x1d, 0xd6, 0x8d, 0xc7, 0x87, 0x75, 0xe3, 0xc9, 0x61, 0xdd, 0x78, - 0x7a, 0x58, 0x37, 0x7e, 0x7c, 0x56, 0xcf, 0x3d, 0x7e, 0x56, 0xcf, 0x3d, 0x79, 0x56, 0xcf, 0x7d, - 0x59, 0x54, 0xa5, 0xf9, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x53, 0x80, 0x8c, 0x9b, 0x97, 0x0d, 0x00, - 0x00, +func init() { proto.RegisterFile("roachpb/metadata.proto", fileDescriptor_metadata_a87f6e067a405dc7) } + +var fileDescriptor_metadata_a87f6e067a405dc7 = []byte{ + // 1422 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xf6, 0xc6, 0xeb, 0xd8, 0x7e, 0xf9, 0x65, 0x8f, 0xa0, 0xb5, 0x8c, 0xb0, 0xdd, 0x85, 0x8a, + 0xb4, 0xa0, 0x24, 0x0d, 0x8a, 0xaa, 0x06, 0x0a, 0xc4, 0x49, 0x5a, 0x4c, 0xf3, 0x8b, 0x8d, 0x5b, + 0x24, 0x2e, 0xab, 0xc9, 0xee, 0xe0, 0x2c, 0x5d, 0xef, 0x6e, 0x67, 0xc7, 0x69, 0x7d, 0x47, 0x80, + 0x84, 0x90, 0xb8, 0x20, 0x71, 0xac, 0x84, 0xfa, 0x3f, 0xf0, 0x27, 0xf4, 0xd8, 0x63, 0x4f, 0x51, + 0x49, 0x2f, 0x9c, 0x39, 0xe6, 0x80, 0xd0, 0xcc, 0xce, 0xec, 0xae, 0xd3, 0x14, 0xda, 0x22, 0x71, + 0x9b, 0xfd, 0xde, 0xf7, 0xbd, 0x7d, 0xf3, 0xe6, 0xcd, 0x7b,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f, 0x5c, 0x12, 0xe7, 0x9b, + 0xe2, 0x8b, 0x4b, 0x02, 0x5f, 0x5a, 0x10, 0x47, 0x9a, 0xe2, 0x4b, 0x31, 0xff, 0xf2, 0x92, 0xb8, + 0x2f, 0x29, 0x7e, 0x39, 0xe6, 0x5f, 0x59, 0x10, 0xe9, 0x4f, 0xf1, 0x2b, 0x0b, 0xa8, 0x06, 0x7a, + 0xb8, 0x89, 0xef, 0x89, 0x84, 0x2a, 0x83, 0x40, 0x64, 0x27, 0x3b, 0xce, 0xc3, 0x94, 0xb8, 0xd4, + 0xab, 0x38, 0xc4, 0xb6, 0xcb, 0x86, 0xa8, 0x05, 0x25, 0x5b, 0xae, 0x65, 0xb9, 0xc6, 0xaa, 0x04, + 0x45, 0x06, 0x94, 0xf1, 0x01, 0x76, 0x3d, 0x91, 0x9c, 0xb1, 0x0c, 0x25, 0x85, 0xd1, 0x79, 0x98, + 0x88, 0x8b, 0xde, 0x0e, 0x06, 0x3e, 0x93, 0x8d, 0x21, 0x66, 0x81, 0x30, 0xac, 0x72, 0x9c, 0xd3, + 0x3c, 0x82, 0x23, 0x45, 0xd3, 0xb3, 0x34, 0x61, 0x88, 0x69, 0x0b, 0x50, 0xbd, 0x4b, 0x5d, 0x46, + 0x22, 0x2b, 0x24, 0xd4, 0x8a, 0x88, 0x1d, 0xf8, 0xce, 0xc8, 0x5e, 0x67, 0x62, 0xf3, 0x0e, 0xa1, + 0xbb, 0xc2, 0x88, 0x76, 0xa0, 0xba, 0x37, 0x54, 0x02, 0x75, 0xb1, 0xc7, 0x45, 0x71, 0x9c, 0xd6, + 0x65, 0x32, 0x47, 0xa5, 0x3c, 0x0a, 0xf9, 0x0e, 0xa1, 0xb2, 0x44, 0x91, 0x09, 0x28, 0x13, 0x83, + 0x72, 0x59, 0x7c, 0x09, 0x97, 0x95, 0x24, 0x48, 0xe5, 0xb3, 0x06, 0xfa, 0x20, 0x22, 0x8e, 0xa8, + 0x30, 0x95, 0x44, 0x81, 0x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1f, 0x35, 0xb4, 0x27, 0x47, 0x0d, 0xed, + 0xa7, 0xa7, 0x8d, 0xdc, 0xa3, 0xa7, 0x8d, 0xdc, 0xe3, 0xa7, 0x8d, 0xdc, 0x97, 0x45, 0x79, 0x34, + 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x0b, 0xeb, 0xe1, 0xdb, 0x0d, 0x00, 0x00, } diff --git a/pkg/roachpb/metadata.proto b/pkg/roachpb/metadata.proto index 383b5be2d940..ce9a1fa19ea1 100644 --- a/pkg/roachpb/metadata.proto +++ b/pkg/roachpb/metadata.proto @@ -126,13 +126,23 @@ message ReplicaIdent { // A range is described using an inclusive start key, a non-inclusive end key, // and a list of replicas where the range is stored. // -// NOTE: Care must be taken when changing the encoding of this proto -// because it is used as part of conditional put operations. +// NOTE: Care must be taken when adding or removing fields from this proto +// because we have code relies on the descriptor comparing Equal() after +// round-tripping through a previous/next version node (i.e. in mixed-version +// clusters). Note that we don't need to proto encoding to be stable since, when +// doing CPuts we use the raw bytes we've read from the DB as the expected value +// (instead of re-marshaling the proto), but unfortunately we also need the +// Equal() method to work. Also note that we configure our protos to not +// maintain unrecognized fields. +// // TODO(jeffreyxiao): All nullable fields in RangeDescriptor can be made // non-nullable if #38302 is guaranteed to be on all nodes (I.E. 20.1). message RangeDescriptor { option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = true; + // We implement the Equal method by hand so that it can ignore deprecated + // fields. This can be reverted in 21.1 once the "previous version" no longer + // populates deprecated_generation_comparable. + option (gogoproto.equal) = false; option (gogoproto.populate) = true; optional int64 range_id = 1 [(gogoproto.nullable) = false, @@ -217,6 +227,13 @@ message RangeDescriptor { // replica is gc'able or not. If it is not gc'able, then by definition the // replica applying the merge is. optional int64 generation = 6 [(gogoproto.nullable) = false, (gogoproto.casttype) = "RangeGeneration"]; + + // This field is not used any more, but we need to maintain it in 20.2 because + // 20.1 nodes need descriptors to round-trip through 20.2 nodes and compare + // Equal() when they come back. 20.2 nodes know to ignore this field when + // comparing, so the field can be removed in 21.1. + optional bool deprecated_generation_comparable = 8; + // The presence of the sticky_bit indicates that the range should not be // automatically merged by the merge queue with the range to its left. It is // set during a split operation and unset during an unsplit operation. Note @@ -233,8 +250,6 @@ message RangeDescriptor { // queue is enabled. With sticky_bit, users can manually split ranges without // diabling the merge queue. optional util.hlc.Timestamp sticky_bit = 7; - - reserved 8; } // Percentiles contains a handful of hard-coded percentiles meant to summarize