From b4d301184eb0d01fd4d1042fcc7c5dfb54f3c1e3 Mon Sep 17 00:00:00 2001 From: Weny Xu Date: Thu, 17 Oct 2024 13:13:26 +0800 Subject: [PATCH] feat: rename `replay_timeout_secs` to `timeout_secs` (#191) * feat: add `flush_timeout_secs` to `MigrateRegionRequest` * chore: use `timeout_secs` * feat: introduce `DowngradingLeader` --- c++/greptime/v1/meta/heartbeat.pb.cc | 21 ++--- c++/greptime/v1/meta/heartbeat.pb.h | 3 +- c++/greptime/v1/meta/region.pb.cc | 56 ++++++------- c++/greptime/v1/meta/region.pb.h | 42 +++++----- go/greptime/v1/meta/heartbeat.pb.go | 48 ++++++----- go/greptime/v1/meta/region.pb.go | 48 +++++------ .../greptime/v1/meta/HeartbeatOuterClass.java | 39 +++++++-- .../main/java/greptime/v1/meta/Region.java | 84 +++++++++---------- proto/greptime/v1/meta/heartbeat.proto | 4 + proto/greptime/v1/meta/region.proto | 2 +- 10 files changed, 191 insertions(+), 156 deletions(-) diff --git a/c++/greptime/v1/meta/heartbeat.pb.cc b/c++/greptime/v1/meta/heartbeat.pb.cc index b7e6607e..5f4c5e60 100644 --- a/c++/greptime/v1/meta/heartbeat.pb.cc +++ b/c++/greptime/v1/meta/heartbeat.pb.cc @@ -354,22 +354,22 @@ const char descriptor_table_protodef_greptime_2fv1_2fmeta_2fheartbeat_2eproto[] ".greptime.v1.meta.Peer\"|\n\016MailboxMessage" "\022\n\n\002id\030\001 \001(\004\022\017\n\007subject\030\002 \001(\t\022\014\n\004from\030\003 " "\001(\t\022\n\n\002to\030\004 \001(\t\022\030\n\020timestamp_millis\030\005 \001(" - "\003\022\016\n\004json\030\006 \001(\tH\000B\t\n\007payload*&\n\nRegionRo" - "le\022\n\n\006Leader\020\000\022\014\n\010Follower\020\0012\277\001\n\tHeartbe" - "at\022Z\n\tHeartbeat\022\".greptime.v1.meta.Heart" - "beatRequest\032#.greptime.v1.meta.Heartbeat" - "Response\"\000(\0010\001\022V\n\tAskLeader\022\".greptime.v" - "1.meta.AskLeaderRequest\032#.greptime.v1.me" - "ta.AskLeaderResponse\"\000B::min(), RegionRole_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() }; bool RegionRole_IsValid(int value); constexpr RegionRole RegionRole_MIN = Leader; -constexpr RegionRole RegionRole_MAX = Follower; +constexpr RegionRole RegionRole_MAX = DowngradingLeader; constexpr int RegionRole_ARRAYSIZE = RegionRole_MAX + 1; const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* RegionRole_descriptor(); diff --git a/c++/greptime/v1/meta/region.pb.cc b/c++/greptime/v1/meta/region.pb.cc index 1f2f57a0..b57fe0ca 100644 --- a/c++/greptime/v1/meta/region.pb.cc +++ b/c++/greptime/v1/meta/region.pb.cc @@ -29,7 +29,7 @@ PROTOBUF_CONSTEXPR MigrateRegionRequest::MigrateRegionRequest( , /*decltype(_impl_.region_id_)*/uint64_t{0u} , /*decltype(_impl_.from_peer_)*/uint64_t{0u} , /*decltype(_impl_.to_peer_)*/uint64_t{0u} - , /*decltype(_impl_.replay_timeout_secs_)*/0u + , /*decltype(_impl_.timeout_secs_)*/0u , /*decltype(_impl_._cached_size_)*/{}} {} struct MigrateRegionRequestDefaultTypeInternal { PROTOBUF_CONSTEXPR MigrateRegionRequestDefaultTypeInternal() @@ -72,7 +72,7 @@ const uint32_t TableStruct_greptime_2fv1_2fmeta_2fregion_2eproto::offsets[] PROT PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionRequest, _impl_.region_id_), PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionRequest, _impl_.from_peer_), PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionRequest, _impl_.to_peer_), - PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionRequest, _impl_.replay_timeout_secs_), + PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionRequest, _impl_.timeout_secs_), ~0u, // no _has_bits_ PROTOBUF_FIELD_OFFSET(::greptime::v1::meta::MigrateRegionResponse, _internal_metadata_), ~0u, // no _extensions_ @@ -95,22 +95,22 @@ static const ::_pb::Message* const file_default_instances[] = { const char descriptor_table_protodef_greptime_2fv1_2fmeta_2fregion_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = "\n\035greptime/v1/meta/region.proto\022\020greptim" "e.v1.meta\032\035greptime/v1/meta/common.proto" - "\"\233\001\n\024MigrateRegionRequest\022/\n\006header\030\001 \001(" + "\"\224\001\n\024MigrateRegionRequest\022/\n\006header\030\001 \001(" "\0132\037.greptime.v1.meta.RequestHeader\022\021\n\tre" "gion_id\030\003 \001(\004\022\021\n\tfrom_peer\030\004 \001(\004\022\017\n\007to_p" - "eer\030\005 \001(\004\022\033\n\023replay_timeout_secs\030\006 \001(\r\"u" - "\n\025MigrateRegionResponse\0220\n\006header\030\001 \001(\0132" - " .greptime.v1.meta.ResponseHeader\022*\n\003pid" - "\030\002 \001(\0132\035.greptime.v1.meta.ProcedureIdB(from._internal_metadata_); @@ -166,8 +166,8 @@ MigrateRegionRequest::MigrateRegionRequest(const MigrateRegionRequest& from) _this->_impl_.header_ = new ::greptime::v1::meta::RequestHeader(*from._impl_.header_); } ::memcpy(&_impl_.region_id_, &from._impl_.region_id_, - static_cast(reinterpret_cast(&_impl_.replay_timeout_secs_) - - reinterpret_cast(&_impl_.region_id_)) + sizeof(_impl_.replay_timeout_secs_)); + static_cast(reinterpret_cast(&_impl_.timeout_secs_) - + reinterpret_cast(&_impl_.region_id_)) + sizeof(_impl_.timeout_secs_)); // @@protoc_insertion_point(copy_constructor:greptime.v1.meta.MigrateRegionRequest) } @@ -180,7 +180,7 @@ inline void MigrateRegionRequest::SharedCtor( , decltype(_impl_.region_id_){uint64_t{0u}} , decltype(_impl_.from_peer_){uint64_t{0u}} , decltype(_impl_.to_peer_){uint64_t{0u}} - , decltype(_impl_.replay_timeout_secs_){0u} + , decltype(_impl_.timeout_secs_){0u} , /*decltype(_impl_._cached_size_)*/{} }; } @@ -214,8 +214,8 @@ void MigrateRegionRequest::Clear() { } _impl_.header_ = nullptr; ::memset(&_impl_.region_id_, 0, static_cast( - reinterpret_cast(&_impl_.replay_timeout_secs_) - - reinterpret_cast(&_impl_.region_id_)) + sizeof(_impl_.replay_timeout_secs_)); + reinterpret_cast(&_impl_.timeout_secs_) - + reinterpret_cast(&_impl_.region_id_)) + sizeof(_impl_.timeout_secs_)); _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); } @@ -257,10 +257,10 @@ const char* MigrateRegionRequest::_InternalParse(const char* ptr, ::_pbi::ParseC } else goto handle_unusual; continue; - // uint32 replay_timeout_secs = 6; + // uint32 timeout_secs = 6; case 6: if (PROTOBUF_PREDICT_TRUE(static_cast(tag) == 48)) { - _impl_.replay_timeout_secs_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); + _impl_.timeout_secs_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr); CHK_(ptr); } else goto handle_unusual; @@ -319,10 +319,10 @@ uint8_t* MigrateRegionRequest::_InternalSerialize( target = ::_pbi::WireFormatLite::WriteUInt64ToArray(5, this->_internal_to_peer(), target); } - // uint32 replay_timeout_secs = 6; - if (this->_internal_replay_timeout_secs() != 0) { + // uint32 timeout_secs = 6; + if (this->_internal_timeout_secs() != 0) { target = stream->EnsureSpace(target); - target = ::_pbi::WireFormatLite::WriteUInt32ToArray(6, this->_internal_replay_timeout_secs(), target); + target = ::_pbi::WireFormatLite::WriteUInt32ToArray(6, this->_internal_timeout_secs(), target); } if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) { @@ -363,9 +363,9 @@ size_t MigrateRegionRequest::ByteSizeLong() const { total_size += ::_pbi::WireFormatLite::UInt64SizePlusOne(this->_internal_to_peer()); } - // uint32 replay_timeout_secs = 6; - if (this->_internal_replay_timeout_secs() != 0) { - total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_replay_timeout_secs()); + // uint32 timeout_secs = 6; + if (this->_internal_timeout_secs() != 0) { + total_size += ::_pbi::WireFormatLite::UInt32SizePlusOne(this->_internal_timeout_secs()); } return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_); @@ -399,8 +399,8 @@ void MigrateRegionRequest::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, c if (from._internal_to_peer() != 0) { _this->_internal_set_to_peer(from._internal_to_peer()); } - if (from._internal_replay_timeout_secs() != 0) { - _this->_internal_set_replay_timeout_secs(from._internal_replay_timeout_secs()); + if (from._internal_timeout_secs() != 0) { + _this->_internal_set_timeout_secs(from._internal_timeout_secs()); } _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_); } @@ -420,8 +420,8 @@ void MigrateRegionRequest::InternalSwap(MigrateRegionRequest* other) { using std::swap; _internal_metadata_.InternalSwap(&other->_internal_metadata_); ::PROTOBUF_NAMESPACE_ID::internal::memswap< - PROTOBUF_FIELD_OFFSET(MigrateRegionRequest, _impl_.replay_timeout_secs_) - + sizeof(MigrateRegionRequest::_impl_.replay_timeout_secs_) + PROTOBUF_FIELD_OFFSET(MigrateRegionRequest, _impl_.timeout_secs_) + + sizeof(MigrateRegionRequest::_impl_.timeout_secs_) - PROTOBUF_FIELD_OFFSET(MigrateRegionRequest, _impl_.header_)>( reinterpret_cast(&_impl_.header_), reinterpret_cast(&other->_impl_.header_)); diff --git a/c++/greptime/v1/meta/region.pb.h b/c++/greptime/v1/meta/region.pb.h index 5f85c15b..5e0c88fc 100644 --- a/c++/greptime/v1/meta/region.pb.h +++ b/c++/greptime/v1/meta/region.pb.h @@ -192,7 +192,7 @@ class MigrateRegionRequest final : kRegionIdFieldNumber = 3, kFromPeerFieldNumber = 4, kToPeerFieldNumber = 5, - kReplayTimeoutSecsFieldNumber = 6, + kTimeoutSecsFieldNumber = 6, }; // .greptime.v1.meta.RequestHeader header = 1; bool has_header() const; @@ -239,13 +239,13 @@ class MigrateRegionRequest final : void _internal_set_to_peer(uint64_t value); public: - // uint32 replay_timeout_secs = 6; - void clear_replay_timeout_secs(); - uint32_t replay_timeout_secs() const; - void set_replay_timeout_secs(uint32_t value); + // uint32 timeout_secs = 6; + void clear_timeout_secs(); + uint32_t timeout_secs() const; + void set_timeout_secs(uint32_t value); private: - uint32_t _internal_replay_timeout_secs() const; - void _internal_set_replay_timeout_secs(uint32_t value); + uint32_t _internal_timeout_secs() const; + void _internal_set_timeout_secs(uint32_t value); public: // @@protoc_insertion_point(class_scope:greptime.v1.meta.MigrateRegionRequest) @@ -260,7 +260,7 @@ class MigrateRegionRequest final : uint64_t region_id_; uint64_t from_peer_; uint64_t to_peer_; - uint32_t replay_timeout_secs_; + uint32_t timeout_secs_; mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; }; union { Impl_ _impl_; }; @@ -599,24 +599,24 @@ inline void MigrateRegionRequest::set_to_peer(uint64_t value) { // @@protoc_insertion_point(field_set:greptime.v1.meta.MigrateRegionRequest.to_peer) } -// uint32 replay_timeout_secs = 6; -inline void MigrateRegionRequest::clear_replay_timeout_secs() { - _impl_.replay_timeout_secs_ = 0u; +// uint32 timeout_secs = 6; +inline void MigrateRegionRequest::clear_timeout_secs() { + _impl_.timeout_secs_ = 0u; } -inline uint32_t MigrateRegionRequest::_internal_replay_timeout_secs() const { - return _impl_.replay_timeout_secs_; +inline uint32_t MigrateRegionRequest::_internal_timeout_secs() const { + return _impl_.timeout_secs_; } -inline uint32_t MigrateRegionRequest::replay_timeout_secs() const { - // @@protoc_insertion_point(field_get:greptime.v1.meta.MigrateRegionRequest.replay_timeout_secs) - return _internal_replay_timeout_secs(); +inline uint32_t MigrateRegionRequest::timeout_secs() const { + // @@protoc_insertion_point(field_get:greptime.v1.meta.MigrateRegionRequest.timeout_secs) + return _internal_timeout_secs(); } -inline void MigrateRegionRequest::_internal_set_replay_timeout_secs(uint32_t value) { +inline void MigrateRegionRequest::_internal_set_timeout_secs(uint32_t value) { - _impl_.replay_timeout_secs_ = value; + _impl_.timeout_secs_ = value; } -inline void MigrateRegionRequest::set_replay_timeout_secs(uint32_t value) { - _internal_set_replay_timeout_secs(value); - // @@protoc_insertion_point(field_set:greptime.v1.meta.MigrateRegionRequest.replay_timeout_secs) +inline void MigrateRegionRequest::set_timeout_secs(uint32_t value) { + _internal_set_timeout_secs(value); + // @@protoc_insertion_point(field_set:greptime.v1.meta.MigrateRegionRequest.timeout_secs) } // ------------------------------------------------------------------- diff --git a/go/greptime/v1/meta/heartbeat.pb.go b/go/greptime/v1/meta/heartbeat.pb.go index ade354bf..90f53502 100644 --- a/go/greptime/v1/meta/heartbeat.pb.go +++ b/go/greptime/v1/meta/heartbeat.pb.go @@ -41,6 +41,10 @@ const ( RegionRole_Leader RegionRole = 0 // Readonly region. RegionRole_Follower RegionRole = 1 + // A downgrading region, which is in the process of downgrading from Leader to Follower. + // + // This role is used to prevent the region from being written during the downgrade process. + RegionRole_DowngradingLeader RegionRole = 2 ) // Enum value maps for RegionRole. @@ -48,10 +52,12 @@ var ( RegionRole_name = map[int32]string{ 0: "Leader", 1: "Follower", + 2: "DowngradingLeader", } RegionRole_value = map[string]int32{ - "Leader": 0, - "Follower": 1, + "Leader": 0, + "Follower": 1, + "DowngradingLeader": 2, } ) @@ -882,26 +888,28 @@ var file_greptime_v1_meta_heartbeat_proto_rawDesc = []byte{ 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x14, 0x0a, 0x04, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x04, 0x6a, - 0x73, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x26, + 0x73, 0x6f, 0x6e, 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x2a, 0x3d, 0x0a, 0x0a, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x6f, 0x6c, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x46, 0x6f, 0x6c, 0x6c, - 0x6f, 0x77, 0x65, 0x72, 0x10, 0x01, 0x32, 0xbf, 0x01, 0x0a, 0x09, 0x48, 0x65, 0x61, 0x72, 0x74, - 0x62, 0x65, 0x61, 0x74, 0x12, 0x5a, 0x0a, 0x09, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, - 0x74, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, - 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, - 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, - 0x12, 0x56, 0x0a, 0x09, 0x41, 0x73, 0x6b, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x22, 0x2e, - 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, - 0x2e, 0x41, 0x73, 0x6b, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, - 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x41, 0x73, 0x6b, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, - 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, - 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x77, 0x65, 0x72, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x44, 0x6f, 0x77, 0x6e, 0x67, 0x72, + 0x61, 0x64, 0x69, 0x6e, 0x67, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x10, 0x02, 0x32, 0xbf, 0x01, + 0x0a, 0x09, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x5a, 0x0a, 0x09, 0x48, + 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x48, 0x65, 0x61, 0x72, + 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, + 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, + 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x09, 0x41, 0x73, 0x6b, 0x4c, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, + 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x41, 0x73, 0x6b, 0x4c, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x41, 0x73, 0x6b, 0x4c, + 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, + 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, + 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/go/greptime/v1/meta/region.pb.go b/go/greptime/v1/meta/region.pb.go index 4bf3d730..03f7a76c 100644 --- a/go/greptime/v1/meta/region.pb.go +++ b/go/greptime/v1/meta/region.pb.go @@ -39,11 +39,11 @@ type MigrateRegionRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` - RegionId uint64 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` - FromPeer uint64 `protobuf:"varint,4,opt,name=from_peer,json=fromPeer,proto3" json:"from_peer,omitempty"` - ToPeer uint64 `protobuf:"varint,5,opt,name=to_peer,json=toPeer,proto3" json:"to_peer,omitempty"` - ReplayTimeoutSecs uint32 `protobuf:"varint,6,opt,name=replay_timeout_secs,json=replayTimeoutSecs,proto3" json:"replay_timeout_secs,omitempty"` + Header *RequestHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + RegionId uint64 `protobuf:"varint,3,opt,name=region_id,json=regionId,proto3" json:"region_id,omitempty"` + FromPeer uint64 `protobuf:"varint,4,opt,name=from_peer,json=fromPeer,proto3" json:"from_peer,omitempty"` + ToPeer uint64 `protobuf:"varint,5,opt,name=to_peer,json=toPeer,proto3" json:"to_peer,omitempty"` + TimeoutSecs uint32 `protobuf:"varint,6,opt,name=timeout_secs,json=timeoutSecs,proto3" json:"timeout_secs,omitempty"` } func (x *MigrateRegionRequest) Reset() { @@ -106,9 +106,9 @@ func (x *MigrateRegionRequest) GetToPeer() uint64 { return 0 } -func (x *MigrateRegionRequest) GetReplayTimeoutSecs() uint32 { +func (x *MigrateRegionRequest) GetTimeoutSecs() uint32 { if x != nil { - return x.ReplayTimeoutSecs + return x.TimeoutSecs } return 0 } @@ -176,7 +176,7 @@ var file_greptime_v1_meta_region_proto_rawDesc = []byte{ 0x10, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x1a, 0x1d, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0xd2, 0x01, 0x0a, 0x14, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, + 0x22, 0xc5, 0x01, 0x0a, 0x14, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x71, @@ -186,22 +186,22 @@ var file_greptime_v1_meta_region_proto_rawDesc = []byte{ 0x1b, 0x0a, 0x09, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x6f, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x74, - 0x6f, 0x50, 0x65, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x13, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x5f, - 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, 0x73, 0x65, 0x63, 0x73, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x11, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, - 0x74, 0x53, 0x65, 0x63, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x15, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, - 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x38, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x20, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, - 0x74, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, 0x61, 0x64, 0x65, - 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x03, 0x70, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, - 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x64, - 0x75, 0x72, 0x65, 0x49, 0x64, 0x52, 0x03, 0x70, 0x69, 0x64, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, - 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2d, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, - 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x50, 0x65, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x5f, 0x73, 0x65, 0x63, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x69, 0x6d, + 0x65, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x63, 0x73, 0x22, 0x82, 0x01, 0x0a, 0x15, 0x4d, 0x69, 0x67, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x38, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, + 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x03, + 0x70, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x67, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, + 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x49, 0x64, 0x52, 0x03, 0x70, 0x69, 0x64, 0x42, 0x3c, 0x5a, + 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x47, 0x72, 0x65, 0x70, + 0x74, 0x69, 0x6d, 0x65, 0x54, 0x65, 0x61, 0x6d, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, + 0x65, 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x72, 0x65, 0x70, 0x74, + 0x69, 0x6d, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( diff --git a/java/src/main/java/greptime/v1/meta/HeartbeatOuterClass.java b/java/src/main/java/greptime/v1/meta/HeartbeatOuterClass.java index 919330d8..47c736c9 100644 --- a/java/src/main/java/greptime/v1/meta/HeartbeatOuterClass.java +++ b/java/src/main/java/greptime/v1/meta/HeartbeatOuterClass.java @@ -35,6 +35,16 @@ public enum RegionRole * Follower = 1; */ Follower(1), + /** + *
+     * A downgrading region, which is in the process of downgrading from Leader to Follower.
+     * 
+     * This role is used to prevent the region from being written during the downgrade process.
+     * 
+ * + * DowngradingLeader = 2; + */ + DowngradingLeader(2), UNRECOGNIZED(-1), ; @@ -54,6 +64,16 @@ public enum RegionRole * Follower = 1; */ public static final int Follower_VALUE = 1; + /** + *
+     * A downgrading region, which is in the process of downgrading from Leader to Follower.
+     * 
+     * This role is used to prevent the region from being written during the downgrade process.
+     * 
+ * + * DowngradingLeader = 2; + */ + public static final int DowngradingLeader_VALUE = 2; public final int getNumber() { @@ -82,6 +102,7 @@ public static RegionRole forNumber(int value) { switch (value) { case 0: return Leader; case 1: return Follower; + case 2: return DowngradingLeader; default: return null; } } @@ -10391,15 +10412,15 @@ public greptime.v1.meta.HeartbeatOuterClass.MailboxMessage getDefaultInstanceFor ".greptime.v1.meta.Peer\"|\n\016MailboxMessage" + "\022\n\n\002id\030\001 \001(\004\022\017\n\007subject\030\002 \001(\t\022\014\n\004from\030\003 " + "\001(\t\022\n\n\002to\030\004 \001(\t\022\030\n\020timestamp_millis\030\005 \001(" + - "\003\022\016\n\004json\030\006 \001(\tH\000B\t\n\007payload*&\n\nRegionRo" + - "le\022\n\n\006Leader\020\000\022\014\n\010Follower\020\0012\277\001\n\tHeartbe" + - "at\022Z\n\tHeartbeat\022\".greptime.v1.meta.Heart" + - "beatRequest\032#.greptime.v1.meta.Heartbeat" + - "Response\"\000(\0010\001\022V\n\tAskLeader\022\".greptime.v" + - "1.meta.AskLeaderRequest\032#.greptime.v1.me" + - "ta.AskLeaderResponse\"\000Buint32 replay_timeout_secs = 6; - * @return The replayTimeoutSecs. + * uint32 timeout_secs = 6; + * @return The timeoutSecs. */ - int getReplayTimeoutSecs(); + int getTimeoutSecs(); } /** * Protobuf type {@code greptime.v1.meta.MigrateRegionRequest} @@ -132,7 +132,7 @@ private MigrateRegionRequest( } case 48: { - replayTimeoutSecs_ = input.readUInt32(); + timeoutSecs_ = input.readUInt32(); break; } default: { @@ -228,15 +228,15 @@ public long getToPeer() { return toPeer_; } - public static final int REPLAY_TIMEOUT_SECS_FIELD_NUMBER = 6; - private int replayTimeoutSecs_; + public static final int TIMEOUT_SECS_FIELD_NUMBER = 6; + private int timeoutSecs_; /** - * uint32 replay_timeout_secs = 6; - * @return The replayTimeoutSecs. + * uint32 timeout_secs = 6; + * @return The timeoutSecs. */ @java.lang.Override - public int getReplayTimeoutSecs() { - return replayTimeoutSecs_; + public int getTimeoutSecs() { + return timeoutSecs_; } private byte memoizedIsInitialized = -1; @@ -265,8 +265,8 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (toPeer_ != 0L) { output.writeUInt64(5, toPeer_); } - if (replayTimeoutSecs_ != 0) { - output.writeUInt32(6, replayTimeoutSecs_); + if (timeoutSecs_ != 0) { + output.writeUInt32(6, timeoutSecs_); } unknownFields.writeTo(output); } @@ -293,9 +293,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeUInt64Size(5, toPeer_); } - if (replayTimeoutSecs_ != 0) { + if (timeoutSecs_ != 0) { size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(6, replayTimeoutSecs_); + .computeUInt32Size(6, timeoutSecs_); } size += unknownFields.getSerializedSize(); memoizedSize = size; @@ -323,8 +323,8 @@ public boolean equals(final java.lang.Object obj) { != other.getFromPeer()) return false; if (getToPeer() != other.getToPeer()) return false; - if (getReplayTimeoutSecs() - != other.getReplayTimeoutSecs()) return false; + if (getTimeoutSecs() + != other.getTimeoutSecs()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -349,8 +349,8 @@ public int hashCode() { hash = (37 * hash) + TO_PEER_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( getToPeer()); - hash = (37 * hash) + REPLAY_TIMEOUT_SECS_FIELD_NUMBER; - hash = (53 * hash) + getReplayTimeoutSecs(); + hash = (37 * hash) + TIMEOUT_SECS_FIELD_NUMBER; + hash = (53 * hash) + getTimeoutSecs(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -496,7 +496,7 @@ public Builder clear() { toPeer_ = 0L; - replayTimeoutSecs_ = 0; + timeoutSecs_ = 0; return this; } @@ -532,7 +532,7 @@ public greptime.v1.meta.Region.MigrateRegionRequest buildPartial() { result.regionId_ = regionId_; result.fromPeer_ = fromPeer_; result.toPeer_ = toPeer_; - result.replayTimeoutSecs_ = replayTimeoutSecs_; + result.timeoutSecs_ = timeoutSecs_; onBuilt(); return result; } @@ -593,8 +593,8 @@ public Builder mergeFrom(greptime.v1.meta.Region.MigrateRegionRequest other) { if (other.getToPeer() != 0L) { setToPeer(other.getToPeer()); } - if (other.getReplayTimeoutSecs() != 0) { - setReplayTimeoutSecs(other.getReplayTimeoutSecs()); + if (other.getTimeoutSecs() != 0) { + setTimeoutSecs(other.getTimeoutSecs()); } this.mergeUnknownFields(other.unknownFields); onChanged(); @@ -837,33 +837,33 @@ public Builder clearToPeer() { return this; } - private int replayTimeoutSecs_ ; + private int timeoutSecs_ ; /** - * uint32 replay_timeout_secs = 6; - * @return The replayTimeoutSecs. + * uint32 timeout_secs = 6; + * @return The timeoutSecs. */ @java.lang.Override - public int getReplayTimeoutSecs() { - return replayTimeoutSecs_; + public int getTimeoutSecs() { + return timeoutSecs_; } /** - * uint32 replay_timeout_secs = 6; - * @param value The replayTimeoutSecs to set. + * uint32 timeout_secs = 6; + * @param value The timeoutSecs to set. * @return This builder for chaining. */ - public Builder setReplayTimeoutSecs(int value) { + public Builder setTimeoutSecs(int value) { - replayTimeoutSecs_ = value; + timeoutSecs_ = value; onChanged(); return this; } /** - * uint32 replay_timeout_secs = 6; + * uint32 timeout_secs = 6; * @return This builder for chaining. */ - public Builder clearReplayTimeoutSecs() { + public Builder clearTimeoutSecs() { - replayTimeoutSecs_ = 0; + timeoutSecs_ = 0; onChanged(); return this; } @@ -1767,15 +1767,15 @@ public greptime.v1.meta.Region.MigrateRegionResponse getDefaultInstanceForType() java.lang.String[] descriptorData = { "\n\035greptime/v1/meta/region.proto\022\020greptim" + "e.v1.meta\032\035greptime/v1/meta/common.proto" + - "\"\233\001\n\024MigrateRegionRequest\022/\n\006header\030\001 \001(" + + "\"\224\001\n\024MigrateRegionRequest\022/\n\006header\030\001 \001(" + "\0132\037.greptime.v1.meta.RequestHeader\022\021\n\tre" + "gion_id\030\003 \001(\004\022\021\n\tfrom_peer\030\004 \001(\004\022\017\n\007to_p" + - "eer\030\005 \001(\004\022\033\n\023replay_timeout_secs\030\006 \001(\r\"u" + - "\n\025MigrateRegionResponse\0220\n\006header\030\001 \001(\0132" + - " .greptime.v1.meta.ResponseHeader\022*\n\003pid" + - "\030\002 \001(\0132\035.greptime.v1.meta.ProcedureIdB