feat: rename replay_timeout_secs to timeout_secs (#191)

* feat: add `flush_timeout_secs` to `MigrateRegionRequest`

* chore: use `timeout_secs`

* feat: introduce `DowngradingLeader`
This commit is contained in:
Weny Xu
2024-10-17 13:13:26 +08:00
committed by GitHub
parent 796ce9b003
commit b4d301184e
10 changed files with 191 additions and 156 deletions
@@ -35,6 +35,16 @@ public final class HeartbeatOuterClass {
* <code>Follower = 1;</code>
*/
Follower(1),
/**
* <pre>
* 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.
* </pre>
*
* <code>DowngradingLeader = 2;</code>
*/
DowngradingLeader(2),
UNRECOGNIZED(-1),
;
@@ -54,6 +64,16 @@ public final class HeartbeatOuterClass {
* <code>Follower = 1;</code>
*/
public static final int Follower_VALUE = 1;
/**
* <pre>
* 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.
* </pre>
*
* <code>DowngradingLeader = 2;</code>
*/
public static final int DowngradingLeader_VALUE = 2;
public final int getNumber() {
@@ -82,6 +102,7 @@ public final class HeartbeatOuterClass {
switch (value) {
case 0: return Leader;
case 1: return Follower;
case 2: return DowngradingLeader;
default: return null;
}
}
@@ -10391,15 +10412,15 @@ com.google.protobuf.ByteString defaultValue);
".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<Z:github.com/Gre" +
"ptimeTeam/greptime-proto/go/greptime/v1/" +
"metab\006proto3"
"\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\001\022\025\n\021Downgrad" +
"ingLeader\020\0022\277\001\n\tHeartbeat\022Z\n\tHeartbeat\022\"" +
".greptime.v1.meta.HeartbeatRequest\032#.gre" +
"ptime.v1.meta.HeartbeatResponse\"\000(\0010\001\022V\n" +
"\tAskLeader\022\".greptime.v1.meta.AskLeaderR" +
"equest\032#.greptime.v1.meta.AskLeaderRespo" +
"nse\"\000B<Z:github.com/GreptimeTeam/greptim" +
"e-proto/go/greptime/v1/metab\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
+42 -42
View File
@@ -52,10 +52,10 @@ public final class Region {
long getToPeer();
/**
* <code>uint32 replay_timeout_secs = 6;</code>
* @return The replayTimeoutSecs.
* <code>uint32 timeout_secs = 6;</code>
* @return The timeoutSecs.
*/
int getReplayTimeoutSecs();
int getTimeoutSecs();
}
/**
* Protobuf type {@code greptime.v1.meta.MigrateRegionRequest}
@@ -132,7 +132,7 @@ public final class Region {
}
case 48: {
replayTimeoutSecs_ = input.readUInt32();
timeoutSecs_ = input.readUInt32();
break;
}
default: {
@@ -228,15 +228,15 @@ public final class Region {
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_;
/**
* <code>uint32 replay_timeout_secs = 6;</code>
* @return The replayTimeoutSecs.
* <code>uint32 timeout_secs = 6;</code>
* @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 final class Region {
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 final class Region {
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 final class Region {
!= 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 final class Region {
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 final class Region {
toPeer_ = 0L;
replayTimeoutSecs_ = 0;
timeoutSecs_ = 0;
return this;
}
@@ -532,7 +532,7 @@ public final class Region {
result.regionId_ = regionId_;
result.fromPeer_ = fromPeer_;
result.toPeer_ = toPeer_;
result.replayTimeoutSecs_ = replayTimeoutSecs_;
result.timeoutSecs_ = timeoutSecs_;
onBuilt();
return result;
}
@@ -593,8 +593,8 @@ public final class Region {
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 final class Region {
return this;
}
private int replayTimeoutSecs_ ;
private int timeoutSecs_ ;
/**
* <code>uint32 replay_timeout_secs = 6;</code>
* @return The replayTimeoutSecs.
* <code>uint32 timeout_secs = 6;</code>
* @return The timeoutSecs.
*/
@java.lang.Override
public int getReplayTimeoutSecs() {
return replayTimeoutSecs_;
public int getTimeoutSecs() {
return timeoutSecs_;
}
/**
* <code>uint32 replay_timeout_secs = 6;</code>
* @param value The replayTimeoutSecs to set.
* <code>uint32 timeout_secs = 6;</code>
* @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;
}
/**
* <code>uint32 replay_timeout_secs = 6;</code>
* <code>uint32 timeout_secs = 6;</code>
* @return This builder for chaining.
*/
public Builder clearReplayTimeoutSecs() {
public Builder clearTimeoutSecs() {
replayTimeoutSecs_ = 0;
timeoutSecs_ = 0;
onChanged();
return this;
}
@@ -1767,15 +1767,15 @@ public final class Region {
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<Z" +
":github.com/GreptimeTeam/greptime-proto/" +
"go/greptime/v1/metab\006proto3"
"eer\030\005 \001(\004\022\024\n\014timeout_secs\030\006 \001(\r\"u\n\025Migra" +
"teRegionResponse\0220\n\006header\030\001 \001(\0132 .grept" +
"ime.v1.meta.ResponseHeader\022*\n\003pid\030\002 \001(\0132" +
"\035.greptime.v1.meta.ProcedureIdB<Z:github" +
".com/GreptimeTeam/greptime-proto/go/grep" +
"time/v1/metab\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
@@ -1787,7 +1787,7 @@ public final class Region {
internal_static_greptime_v1_meta_MigrateRegionRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_greptime_v1_meta_MigrateRegionRequest_descriptor,
new java.lang.String[] { "Header", "RegionId", "FromPeer", "ToPeer", "ReplayTimeoutSecs", });
new java.lang.String[] { "Header", "RegionId", "FromPeer", "ToPeer", "TimeoutSecs", });
internal_static_greptime_v1_meta_MigrateRegionResponse_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_greptime_v1_meta_MigrateRegionResponse_fieldAccessorTable = new