From dc361522e92838c3ac7c214abf83b08a27afd73f Mon Sep 17 00:00:00 2001 From: heyuchen Date: Tue, 13 Oct 2020 13:25:56 +0800 Subject: [PATCH] feat(split): add start_partition_split interface --- include/dsn/dist/replication/replication_ddl_client.h | 4 ++++ src/client/replication_ddl_client.cpp | 9 +++++++++ src/common/replication_common.h | 2 ++ src/meta/meta_rpc_types.h | 1 - 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/dsn/dist/replication/replication_ddl_client.h b/include/dsn/dist/replication/replication_ddl_client.h index fa6597b480..54b1b83bdd 100644 --- a/include/dsn/dist/replication/replication_ddl_client.h +++ b/include/dsn/dist/replication/replication_ddl_client.h @@ -191,6 +191,10 @@ class replication_ddl_client detect_hotkey_request &req, detect_hotkey_response &resp); + // partition split + error_with start_partition_split(const std::string &app_name, + int partition_count); + private: bool static valid_app_char(int c); diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp index 39d91902a6..0a6f4c5a76 100644 --- a/src/client/replication_ddl_client.cpp +++ b/src/client/replication_ddl_client.cpp @@ -1593,5 +1593,14 @@ error_code replication_ddl_client::detect_hotkey(const dsn::rpc_address &target, return resps.begin()->second.get_error().code(); } +error_with +replication_ddl_client::start_partition_split(const std::string &app_name, int new_partition_count) +{ + auto req = make_unique(); + req->__set_app_name(app_name); + req->__set_new_partition_count(new_partition_count); + return call_rpc_sync(start_split_rpc(std::move(req), RPC_CM_START_PARTITION_SPLIT)); +} + } // namespace replication } // namespace dsn diff --git a/src/common/replication_common.h b/src/common/replication_common.h index 3eda1b3d24..599bb50fa6 100644 --- a/src/common/replication_common.h +++ b/src/common/replication_common.h @@ -40,6 +40,8 @@ typedef rpc_holder bulk_load_rpc; typedef rpc_holder control_bulk_load_rpc; typedef rpc_holder query_bulk_load_rpc; +typedef rpc_holder start_split_rpc; + class replication_options { public: diff --git a/src/meta/meta_rpc_types.h b/src/meta/meta_rpc_types.h index 9f3c6f2bb1..e01be19eea 100644 --- a/src/meta/meta_rpc_types.h +++ b/src/meta/meta_rpc_types.h @@ -26,7 +26,6 @@ namespace replication { typedef rpc_holder app_env_rpc; typedef rpc_holder ddd_diagnose_rpc; -typedef rpc_holder start_split_rpc; typedef rpc_holder configuration_query_by_node_rpc; typedef rpc_holder