Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat(split): add meta control split #679

Merged
merged 6 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/dsn/dist/replication/replication.codes.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ MAKE_EVENT_CODE_RPC(RPC_CM_DUPLICATION_SYNC, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_UPDATE_APP_ENV, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_DDD_DIAGNOSE, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_START_PARTITION_SPLIT, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_CONTROL_PARTITION_SPLIT, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_REGISTER_CHILD_REPLICA, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_START_BULK_LOAD, TASK_PRIORITY_COMMON)
MAKE_EVENT_CODE_RPC(RPC_CM_CONTROL_BULK_LOAD, TASK_PRIORITY_COMMON)
Expand Down
5 changes: 5 additions & 0 deletions include/dsn/dist/replication/replication_ddl_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ class replication_ddl_client
// partition split
error_with<start_partition_split_response> start_partition_split(const std::string &app_name,
int partition_count);
error_with<control_split_response>
control_partition_split(const std::string &app_name,
split_control_type::type control_type,
const int32_t parent_pidx,
const int32_t old_partition_count);
Comment on lines +204 to +208
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to consider reimplement the shell command in admin-cli. But certainly, it's not urgent, and the reimplementation will be simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right~ I have already added three interfaces easier to use.


private:
bool static valid_app_char(int c);
Expand Down
145 changes: 145 additions & 0 deletions include/dsn/dist/replication/replication_types.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions src/client/replication_ddl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1604,5 +1604,19 @@ replication_ddl_client::start_partition_split(const std::string &app_name, int n
return call_rpc_sync(start_split_rpc(std::move(req), RPC_CM_START_PARTITION_SPLIT));
}

error_with<control_split_response>
replication_ddl_client::control_partition_split(const std::string &app_name,
split_control_type::type control_type,
const int32_t parent_pidx,
const int32_t old_partition_count)
{
auto req = make_unique<control_split_request>();
req->__set_app_name(app_name);
req->__set_control_type(control_type);
req->__set_parent_pidx(parent_pidx);
req->__set_old_partition_count(old_partition_count);
return call_rpc_sync(control_split_rpc(std::move(req), RPC_CM_CONTROL_PARTITION_SPLIT));
}

} // namespace replication
} // namespace dsn
1 change: 1 addition & 0 deletions src/common/replication_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef rpc_holder<control_bulk_load_request, control_bulk_load_response> contro
typedef rpc_holder<query_bulk_load_request, query_bulk_load_response> query_bulk_load_rpc;

typedef rpc_holder<start_partition_split_request, start_partition_split_response> start_split_rpc;
typedef rpc_holder<control_split_request, control_split_response> control_split_rpc;

class replication_options
{
Expand Down
Loading