This is an automated email from the ASF dual-hosted git repository.
yuchenhe 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 82e35ce7 feat(bulk_load): support clear last bulk load state interface
(#968)
82e35ce7 is described below
commit 82e35ce7b4edceedb8911705db367a47be93d0d0
Author: HeYuchen <[email protected]>
AuthorDate: Wed May 18 15:40:45 2022 +0800
feat(bulk_load): support clear last bulk load state interface (#968)
---
rdsn | 2 +-
src/shell/commands.h | 2 ++
src/shell/commands/bulk_load.cpp | 37 +++++++++++++++++++++++++++++++++++++
src/shell/main.cpp | 3 +++
4 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/rdsn b/rdsn
index 47fd85c2..3eb720b2 160000
--- a/rdsn
+++ b/rdsn
@@ -1 +1 @@
-Subproject commit 47fd85c29bd446495388e1ab3a46bd741c99c443
+Subproject commit 3eb720b28ae2739fc882243264eb0a917eeca459
diff --git a/src/shell/commands.h b/src/shell/commands.h
index d4e36a78..f1bb9ee8 100644
--- a/src/shell/commands.h
+++ b/src/shell/commands.h
@@ -273,6 +273,8 @@ bool restart_bulk_load(command_executor *e, shell_context
*sc, arguments args);
bool cancel_bulk_load(command_executor *e, shell_context *sc, arguments args);
+bool clear_bulk_load(command_executor *e, shell_context *sc, arguments args);
+
// == detect hotkey (see 'commands/detect_hotkey.cpp') == //
bool detect_hotkey(command_executor *e, shell_context *sc, arguments args);
diff --git a/src/shell/commands/bulk_load.cpp b/src/shell/commands/bulk_load.cpp
index 48256262..62200bd7 100644
--- a/src/shell/commands/bulk_load.cpp
+++ b/src/shell/commands/bulk_load.cpp
@@ -417,3 +417,40 @@ bool query_bulk_load_status(command_executor *e,
shell_context *sc, arguments ar
return true;
}
+
+bool clear_bulk_load(command_executor *e, shell_context *sc, arguments args)
+{
+ static struct option long_options[] = {{"app_name", required_argument, 0,
'a'}, {0, 0, 0, 0}};
+ std::string app_name;
+
+ optind = 0;
+ while (true) {
+ int option_index = 0;
+ int c;
+ c = getopt_long(args.argc, args.argv, "a:", long_options,
&option_index);
+ if (c == -1)
+ break;
+ switch (c) {
+ case 'a':
+ app_name = optarg;
+ break;
+ default:
+ return false;
+ }
+ }
+
+ auto err_resp = sc->ddl_client->clear_bulk_load(app_name);
+ dsn::error_s err = err_resp.get_error();
+ std::string hint_msg;
+ if (err.is_ok()) {
+ err = dsn::error_s::make(err_resp.get_value().err);
+ hint_msg = err_resp.get_value().hint_msg;
+ }
+ if (!err.is_ok()) {
+ fmt::print(stderr, "clear bulk load failed, error={} [hint:\"{}\"]\n",
err, hint_msg);
+ } else {
+ fmt::print(stdout, "{}\n", hint_msg);
+ }
+
+ return true;
+}
diff --git a/src/shell/main.cpp b/src/shell/main.cpp
index e761fd08..0f152675 100644
--- a/src/shell/main.cpp
+++ b/src/shell/main.cpp
@@ -483,6 +483,9 @@ static command_executor commands[] = {
"<-a --app_name str> [-f --forced]",
cancel_bulk_load,
},
+ {
+ "clear_bulk_load", "clear app bulk load result", "<-a --app_name
str>", clear_bulk_load,
+ },
{
"detect_hotkey",
"start or stop hotkey detection on a replica of a replica server",
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]