feat: add PrepareRollback, RollingBack to procedure state (#142)

* feat: add `CommitRollback`, `RollingBack` to procedure state

* refactor: rename to `PrepareRollback`
This commit is contained in:
Weny Xu
2024-04-08 17:30:44 +08:00
committed by GitHub
parent 1bd2398b68
commit c00c73b76e
5 changed files with 90 additions and 55 deletions
+15 -12
View File
@@ -99,17 +99,18 @@ const char descriptor_table_protodef_greptime_2fv1_2fmeta_2fprocedure_2eproto[]
"esponse\0220\n\006header\030\001 \001(\0132 .greptime.v1.me"
"ta.ResponseHeader\0221\n\006status\030\002 \001(\0162!.grep"
"time.v1.meta.ProcedureStatus\022\r\n\005error\030\003 "
"\001(\t*B\n\017ProcedureStatus\022\013\n\007Running\020\000\022\010\n\004D"
"one\020\001\022\014\n\010Retrying\020\002\022\n\n\006Failed\020\0032\226\002\n\020Proc"
"edureService\022Z\n\005query\022\'.greptime.v1.meta"
".QueryProcedureRequest\032(.greptime.v1.met"
"a.ProcedureStateResponse\022J\n\003ddl\022 .grepti"
"me.v1.meta.DdlTaskRequest\032!.greptime.v1."
"meta.DdlTaskResponse\022Z\n\007migrate\022&.grepti"
"me.v1.meta.MigrateRegionRequest\032\'.grepti"
"me.v1.meta.MigrateRegionResponseB<Z:gith"
"ub.com/GreptimeTeam/greptime-proto/go/gr"
"eptime/v1/metab\006proto3"
"\001(\t*h\n\017ProcedureStatus\022\013\n\007Running\020\000\022\010\n\004D"
"one\020\001\022\014\n\010Retrying\020\002\022\n\n\006Failed\020\003\022\023\n\017Prepa"
"reRollback\020\004\022\017\n\013RollingBack\020\0052\226\002\n\020Proced"
"ureService\022Z\n\005query\022\'.greptime.v1.meta.Q"
"ueryProcedureRequest\032(.greptime.v1.meta."
"ProcedureStateResponse\022J\n\003ddl\022 .greptime"
".v1.meta.DdlTaskRequest\032!.greptime.v1.me"
"ta.DdlTaskResponse\022Z\n\007migrate\022&.greptime"
".v1.meta.MigrateRegionRequest\032\'.greptime"
".v1.meta.MigrateRegionResponseB<Z:github"
".com/GreptimeTeam/greptime-proto/go/grep"
"time/v1/metab\006proto3"
;
static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fmeta_2fprocedure_2eproto_deps[3] = {
&::descriptor_table_greptime_2fv1_2fmeta_2fcommon_2eproto,
@@ -118,7 +119,7 @@ static const ::_pbi::DescriptorTable* const descriptor_table_greptime_2fv1_2fmet
};
static ::_pbi::once_flag descriptor_table_greptime_2fv1_2fmeta_2fprocedure_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_greptime_2fv1_2fmeta_2fprocedure_2eproto = {
false, false, 822, descriptor_table_protodef_greptime_2fv1_2fmeta_2fprocedure_2eproto,
false, false, 860, descriptor_table_protodef_greptime_2fv1_2fmeta_2fprocedure_2eproto,
"greptime/v1/meta/procedure.proto",
&descriptor_table_greptime_2fv1_2fmeta_2fprocedure_2eproto_once, descriptor_table_greptime_2fv1_2fmeta_2fprocedure_2eproto_deps, 3, 2,
schemas, file_default_instances, TableStruct_greptime_2fv1_2fmeta_2fprocedure_2eproto::offsets,
@@ -144,6 +145,8 @@ bool ProcedureStatus_IsValid(int value) {
case 1:
case 2:
case 3:
case 4:
case 5:
return true;
default:
return false;
+3 -1
View File
@@ -73,12 +73,14 @@ enum ProcedureStatus : int {
Done = 1,
Retrying = 2,
Failed = 3,
PrepareRollback = 4,
RollingBack = 5,
ProcedureStatus_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
ProcedureStatus_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
};
bool ProcedureStatus_IsValid(int value);
constexpr ProcedureStatus ProcedureStatus_MIN = Running;
constexpr ProcedureStatus ProcedureStatus_MAX = Failed;
constexpr ProcedureStatus ProcedureStatus_MAX = RollingBack;
constexpr int ProcedureStatus_ARRAYSIZE = ProcedureStatus_MAX + 1;
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* ProcedureStatus_descriptor();
+32 -23
View File
@@ -31,6 +31,8 @@ const (
ProcedureStatus_Done ProcedureStatus = 1
ProcedureStatus_Retrying ProcedureStatus = 2
ProcedureStatus_Failed ProcedureStatus = 3
ProcedureStatus_PrepareRollback ProcedureStatus = 4
ProcedureStatus_RollingBack ProcedureStatus = 5
)
// Enum value maps for ProcedureStatus.
@@ -40,12 +42,16 @@ var (
1: "Done",
2: "Retrying",
3: "Failed",
4: "PrepareRollback",
5: "RollingBack",
}
ProcedureStatus_value = map[string]int32{
"Running": 0,
"Done": 1,
"Retrying": 2,
"Failed": 3,
"PrepareRollback": 4,
"RollingBack": 5,
}
)
@@ -224,33 +230,36 @@ var file_greptime_v1_meta_procedure_proto_rawDesc = []byte{
0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65,
0x64, 0x75, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, 0x42, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x63,
0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x2a, 0x68, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x63,
0x65, 0x64, 0x75, 0x72, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x52,
0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x44, 0x6f, 0x6e, 0x65,
0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x65, 0x74, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x10, 0x02,
0x12, 0x0a, 0x0a, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x03, 0x32, 0x96, 0x02, 0x0a,
0x10, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x12, 0x5a, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x27, 0x2e, 0x67, 0x72, 0x65,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x51, 0x75,
0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x28, 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,
0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a,
0x03, 0x64, 0x64, 0x6c, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e,
0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x44, 0x64, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d,
0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x44, 0x64, 0x6c, 0x54, 0x61, 0x73,
0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5a, 0x0a, 0x07, 0x6d, 0x69, 0x67,
0x72, 0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e,
0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52,
0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67,
0x12, 0x0a, 0x0a, 0x06, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f,
0x50, 0x72, 0x65, 0x70, 0x61, 0x72, 0x65, 0x52, 0x6f, 0x6c, 0x6c, 0x62, 0x61, 0x63, 0x6b, 0x10,
0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x52, 0x6f, 0x6c, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x63, 0x6b,
0x10, 0x05, 0x32, 0x96, 0x02, 0x0a, 0x10, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75, 0x72, 0x65,
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5a, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79,
0x12, 0x27, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d,
0x65, 0x74, 0x61, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x64, 0x75,
0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 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, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x03, 0x64, 0x64, 0x6c, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x65,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x44, 0x64,
0x6c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x67,
0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e,
0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 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,
0x44, 0x64, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x5a, 0x0a, 0x07, 0x6d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x67, 0x72, 0x65,
0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4d, 0x69,
0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x72, 0x65, 0x70, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x76, 0x31,
0x2e, 0x6d, 0x65, 0x74, 0x61, 0x2e, 0x4d, 0x69, 0x67, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 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 (
@@ -35,6 +35,14 @@ public final class Procedure {
* <code>Failed = 3;</code>
*/
Failed(3),
/**
* <code>PrepareRollback = 4;</code>
*/
PrepareRollback(4),
/**
* <code>RollingBack = 5;</code>
*/
RollingBack(5),
UNRECOGNIZED(-1),
;
@@ -54,6 +62,14 @@ public final class Procedure {
* <code>Failed = 3;</code>
*/
public static final int Failed_VALUE = 3;
/**
* <code>PrepareRollback = 4;</code>
*/
public static final int PrepareRollback_VALUE = 4;
/**
* <code>RollingBack = 5;</code>
*/
public static final int RollingBack_VALUE = 5;
public final int getNumber() {
@@ -84,6 +100,8 @@ public final class Procedure {
case 1: return Done;
case 2: return Retrying;
case 3: return Failed;
case 4: return PrepareRollback;
case 5: return RollingBack;
default: return null;
}
}
@@ -1875,17 +1893,18 @@ public final class Procedure {
"esponse\0220\n\006header\030\001 \001(\0132 .greptime.v1.me" +
"ta.ResponseHeader\0221\n\006status\030\002 \001(\0162!.grep" +
"time.v1.meta.ProcedureStatus\022\r\n\005error\030\003 " +
"\001(\t*B\n\017ProcedureStatus\022\013\n\007Running\020\000\022\010\n\004D" +
"one\020\001\022\014\n\010Retrying\020\002\022\n\n\006Failed\020\0032\226\002\n\020Proc" +
"edureService\022Z\n\005query\022\'.greptime.v1.meta" +
".QueryProcedureRequest\032(.greptime.v1.met" +
"a.ProcedureStateResponse\022J\n\003ddl\022 .grepti" +
"me.v1.meta.DdlTaskRequest\032!.greptime.v1." +
"meta.DdlTaskResponse\022Z\n\007migrate\022&.grepti" +
"me.v1.meta.MigrateRegionRequest\032\'.grepti" +
"me.v1.meta.MigrateRegionResponseB<Z:gith" +
"ub.com/GreptimeTeam/greptime-proto/go/gr" +
"eptime/v1/metab\006proto3"
"\001(\t*h\n\017ProcedureStatus\022\013\n\007Running\020\000\022\010\n\004D" +
"one\020\001\022\014\n\010Retrying\020\002\022\n\n\006Failed\020\003\022\023\n\017Prepa" +
"reRollback\020\004\022\017\n\013RollingBack\020\0052\226\002\n\020Proced" +
"ureService\022Z\n\005query\022\'.greptime.v1.meta.Q" +
"ueryProcedureRequest\032(.greptime.v1.meta." +
"ProcedureStateResponse\022J\n\003ddl\022 .greptime" +
".v1.meta.DdlTaskRequest\032!.greptime.v1.me" +
"ta.DdlTaskResponse\022Z\n\007migrate\022&.greptime" +
".v1.meta.MigrateRegionRequest\032\'.greptime" +
".v1.meta.MigrateRegionResponseB<Z:github" +
".com/GreptimeTeam/greptime-proto/go/grep" +
"time/v1/metab\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
+2
View File
@@ -17,6 +17,8 @@ enum ProcedureStatus {
Done = 1;
Retrying = 2;
Failed = 3;
PrepareRollback = 4;
RollingBack = 5;
}
message QueryProcedureRequest {