This is an automated email from the ASF dual-hosted git repository.
wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new 2ff8c027c feat(ddl_client): add failure logs when backup or restore
command failed (#1701)
2ff8c027c is described below
commit 2ff8c027c09cba7f059d815beb1d9caec03a7efc
Author: Yingchun Lai <[email protected]>
AuthorDate: Wed Nov 29 19:33:34 2023 +0800
feat(ddl_client): add failure logs when backup or restore command failed
(#1701)
- Print `hint_message` when `add_backup_policy`, `disable_backup_policy`,
`enable_backup_policy` or `update_backup_policy` failed. The hint messages
are currently used in admin-cli only.
- Return corresponding error code when `query_restore` failed.
---
src/client/replication_ddl_client.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/client/replication_ddl_client.cpp
b/src/client/replication_ddl_client.cpp
index 32a780982..e08661305 100644
--- a/src/client/replication_ddl_client.cpp
+++ b/src/client/replication_ddl_client.cpp
@@ -1048,6 +1048,7 @@ dsn::error_code
replication_ddl_client::add_backup_policy(const std::string &pol
::dsn::unmarshall(resp_task->get_response(), resp);
if (resp.err != ERR_OK) {
+ std::cout << "add backup policy failed: " << resp.hint_message <<
std::endl;
return resp.err;
} else {
std::cout << "add backup policy succeed, policy_name = " <<
policy_name << std::endl;
@@ -1095,6 +1096,7 @@ dsn::error_code
replication_ddl_client::disable_backup_policy(const std::string
configuration_modify_backup_policy_response resp;
::dsn::unmarshall(resp_task->get_response(), resp);
if (resp.err != ERR_OK) {
+ std::cout << "disable backup policy failed: " << resp.hint_message <<
std::endl;
return resp.err;
} else {
std::cout << "disable policy result: " << resp.err.to_string() <<
std::endl;
@@ -1123,6 +1125,7 @@ dsn::error_code
replication_ddl_client::enable_backup_policy(const std::string &
configuration_modify_backup_policy_response resp;
::dsn::unmarshall(resp_task->get_response(), resp);
if (resp.err != ERR_OK) {
+ std::cout << "enable backup policy failed: " << resp.hint_message <<
std::endl;
return resp.err;
} else if (resp.err == ERR_BUSY) {
std::cout << "policy is under backup, please try disable later" <<
std::endl;
@@ -1274,6 +1277,7 @@ replication_ddl_client::update_backup_policy(const
std::string &policy_name,
configuration_modify_backup_policy_response resp;
::dsn::unmarshall(resp_task->get_response(), resp);
if (resp.err != ERR_OK) {
+ std::cout << "modify backup policy failed: " << resp.hint_message <<
std::endl;
return resp.err;
} else {
std::cout << "Modify policy result: " << resp.err.to_string() <<
std::endl;
@@ -1350,6 +1354,8 @@ dsn::error_code
replication_ddl_client::query_restore(int32_t restore_app_id, bo
} else if (response.err == ERR_APP_DROPPED) {
std::cout << "restore failed, because some partition's data is damaged
on cold backup media"
<< std::endl;
+ } else {
+ return response.err;
}
return ERR_OK;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]