Skip to content

Commit b88a160

Browse files
visualYJDrock-git
authored andcommitted
[fix][coordinator] Fixup create region error when replica equal zero
1 parent 5c04441 commit b88a160

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/server/coordinator_service.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ BRPC_VALIDATE_GFLAG(async_hello, brpc::PassValidate);
5656
DEFINE_int32(hello_latency_ms, 0, "hello latency seconds");
5757
BRPC_VALIDATE_GFLAG(hello_latency_ms, brpc::NonNegativeInteger);
5858

59+
DECLARE_int32(default_replica_num);
60+
5961
void DoCoordinatorHello(google::protobuf::RpcController * /*controller*/, const pb::coordinator::HelloRequest *request,
6062
pb::coordinator::HelloResponse *response, TrackClosure *done,
6163
std::shared_ptr<CoordinatorControl> coordinator_control,
@@ -1212,6 +1214,9 @@ void DoCreateRegion(google::protobuf::RpcController * /*controller*/,
12121214
const std::string &region_name = request->region_name();
12131215
const std::string &resource_tag = request->resource_tag();
12141216
int64_t replica_num = request->replica_num();
1217+
if (replica_num < 1) {
1218+
replica_num = FLAGS_default_replica_num;
1219+
}
12151220
const pb::common::Range &range = request->range();
12161221
pb::common::RawEngine raw_engine = request->raw_engine();
12171222
pb::common::StorageEngine store_engine = request->store_engine();

0 commit comments

Comments
 (0)