-
Notifications
You must be signed in to change notification settings - Fork 59
feat(op_status_lock): add a command to unlock meta_op_status manually #1014
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1712,5 +1712,23 @@ replication_ddl_client::query_app_manual_compact(const std::string &app_name) | |
query_manual_compact_rpc(std::move(req), RPC_CM_QUERY_MANUAL_COMPACT_STATUS)); | ||
} | ||
|
||
dsn::error_code replication_ddl_client::unlock_meta_op_status() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
{ | ||
std::shared_ptr<unlock_meta_op_status_request> req = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
std::make_shared<unlock_meta_op_status_request>(); | ||
|
||
auto resp_task = request_meta<unlock_meta_op_status_request>(RPC_CM_UNLOCK_META_OP_STATUS, req); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this blank line |
||
resp_task->wait(); | ||
if (resp_task->error() != ERR_OK) { | ||
return resp_task->error(); | ||
} | ||
|
||
unlock_meta_op_status_response resp; | ||
::dsn::unmarshall(resp_task->get_response(), resp); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove ::dsn:: |
||
std::cout << "unlock_meta_op_status: " << resp.err.to_string() << std::endl; | ||
return resp.err; | ||
} | ||
|
||
} // namespace replication | ||
} // namespace dsn |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -276,9 +276,11 @@ bool meta_service::try_lock_meta_op_status(meta_op_status op_status) | |
return true; | ||
} | ||
|
||
void meta_service::unlock_meta_op_status() | ||
void meta_service::unlock_meta_op_status(bool is_manual) | ||
{ | ||
ddebug_f("UNLOCK meta op status from {}", enum_to_string(_meta_op_status.load())); | ||
ddebug_f("UNLOCK meta op status from {}, is_manual {}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wrote as you say, but modified by clang-format. It is not bad in multi lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean add a |
||
enum_to_string(_meta_op_status.load()), | ||
is_manual); | ||
_meta_op_status.store(meta_op_status::FREE); | ||
} | ||
|
||
|
@@ -546,6 +548,9 @@ void meta_service::register_rpc_handlers() | |
register_rpc_handler_with_rpc_holder(RPC_CM_QUERY_MANUAL_COMPACT_STATUS, | ||
"query_manual_compact_status", | ||
&meta_service::on_query_manual_compact_status); | ||
register_rpc_handler_with_rpc_holder(RPC_CM_UNLOCK_META_OP_STATUS, | ||
"unlock_meta_op_status", | ||
&meta_service::on_unlock_meta_op_status); | ||
} | ||
|
||
int meta_service::check_leader(dsn::message_ex *req, dsn::rpc_address *forward_address) | ||
|
@@ -693,9 +698,20 @@ void meta_service::on_query_cluster_info(configuration_cluster_info_rpc rpc) | |
response.values.push_back(fmt::format("{:.{}f}", total_stddev, 2)); | ||
response.keys.push_back("cluster_name"); | ||
response.values.push_back(get_current_cluster_name()); | ||
response.keys.push_back("meta_op_status"); | ||
response.values.push_back(enum_to_string(get_op_status())); | ||
response.err = dsn::ERR_OK; | ||
} | ||
|
||
void meta_service::on_unlock_meta_op_status(unlock_meta_op_status_rpc rpc) | ||
{ | ||
if (!check_status(rpc)) { | ||
return; | ||
} | ||
unlock_meta_op_status(true); | ||
rpc.response().err = ERR_OK; | ||
} | ||
|
||
// client => meta server | ||
void meta_service::on_query_configuration_by_index(configuration_query_by_index_rpc rpc) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,7 +162,7 @@ class meta_service : public serverlet<meta_service> | |
size_t get_alive_node_count() const; | ||
|
||
bool try_lock_meta_op_status(meta_op_status op_status); | ||
void unlock_meta_op_status(); | ||
void unlock_meta_op_status(bool is_manual = false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for debug log |
||
meta_op_status get_op_status() const { return _meta_op_status.load(); } | ||
|
||
private: | ||
|
@@ -195,6 +195,7 @@ class meta_service : public serverlet<meta_service> | |
|
||
// cluster info | ||
void on_query_cluster_info(configuration_cluster_info_rpc rpc); | ||
void on_unlock_meta_op_status(unlock_meta_op_status_rpc rpc); | ||
|
||
// meta control | ||
void on_control_meta_level(configuration_meta_control_rpc rpc); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
dsn::