From ac025e471e4285dd43caf4f9eef2d337bfd547f9 Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Tue, 20 Feb 2024 21:52:35 +0800 Subject: [PATCH] meta.dump --- src/meta/server_state.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp index 32737a9663..ea75e5d48e 100644 --- a/src/meta/server_state.cpp +++ b/src/meta/server_state.cpp @@ -145,24 +145,13 @@ void server_state::register_cli_commands() _cmds.emplace_back(dsn::command_manager::instance().register_single_command( "meta.dump", "Dump app_states of meta server to a local file", - "-t|--target target_file", + "", [this](const std::vector &args) { - dsn::error_code err; - if (args.size() != 2) { - err = ERR_INVALID_PARAMETERS; - } else { - const char *target_file = nullptr; - for (int i = 0; i < args.size(); i += 2) { - if (args[i] == "-t" || args[i] == "--target") - target_file = args[i + 1].c_str(); - } - if (target_file == nullptr) { - err = ERR_INVALID_PARAMETERS; - } else { - err = this->dump_from_remote_storage(target_file, false); - } + if (args.size() != 1) { + return ERR_INVALID_PARAMETERS.to_string(); } - return std::string(err.to_string()); + + return dump_from_remote_storage(args[0].c_str(), false).to_string(); })); _cmds.emplace_back(dsn::command_manager::instance().register_bool_command(