From 9d823e959269846acb5eb654be93d6579866b3a3 Mon Sep 17 00:00:00 2001 From: Chaoguang Lin Date: Thu, 17 Jun 2021 19:13:07 +0000 Subject: [PATCH] remove unnecessary version check in fdbcli --- fdbcli/fdbcli.actor.cpp | 44 ++++++++++++----------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/fdbcli/fdbcli.actor.cpp b/fdbcli/fdbcli.actor.cpp index d7ef0103c3..0081c7a4f9 100644 --- a/fdbcli/fdbcli.actor.cpp +++ b/fdbcli/fdbcli.actor.cpp @@ -3766,11 +3766,8 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { printf("\n"); } else if (tokencmp(tokens[1], "all")) { for (auto it : address_interface) { - if (db->apiVersionAtLeast(700)) - BinaryReader::fromStringRef(it.second.first, IncludeVersion()) - .reboot.send(RebootRequest()); - else - tr->set(LiteralStringRef("\xff\xff/reboot_worker"), it.second.first); + BinaryReader::fromStringRef(it.second.first, IncludeVersion()) + .reboot.send(RebootRequest()); } if (address_interface.size() == 0) { fprintf(stderr, @@ -3790,13 +3787,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { if (!is_error) { for (int i = 1; i < tokens.size(); i++) { - if (db->apiVersionAtLeast(700)) - BinaryReader::fromStringRef( - address_interface[tokens[i]].first, IncludeVersion()) - .reboot.send(RebootRequest()); - else - tr->set(LiteralStringRef("\xff\xff/reboot_worker"), - address_interface[tokens[i]].first); + BinaryReader::fromStringRef(address_interface[tokens[i]].first, + IncludeVersion()) + .reboot.send(RebootRequest()); } printf("Attempted to kill %zu processes\n", tokens.size() - 1); } @@ -3853,13 +3846,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { tr->setOption(FDBTransactionOptions::TIMEOUT, StringRef((uint8_t*)&timeout_ms, sizeof(int64_t))); for (int i = 2; i < tokens.size(); i++) { - if (db->apiVersionAtLeast(700)) - BinaryReader::fromStringRef( - address_interface[tokens[i]].first, IncludeVersion()) - .reboot.send(RebootRequest(false, false, seconds)); - else - tr->set(LiteralStringRef("\xff\xff/suspend_worker"), - address_interface[tokens[i]].first); + BinaryReader::fromStringRef( + address_interface[tokens[i]].first, IncludeVersion()) + .reboot.send(RebootRequest(false, false, seconds)); } printf("Attempted to suspend %zu processes\n", tokens.size() - 2); } @@ -4155,11 +4144,8 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { printf("\n"); } else if (tokencmp(tokens[1], "all")) { for (auto it : address_interface) { - if (db->apiVersionAtLeast(700)) - BinaryReader::fromStringRef(it.second.first, IncludeVersion()) - .reboot.send(RebootRequest(false, true)); - else - tr->set(LiteralStringRef("\xff\xff/reboot_and_check_worker"), it.second.first); + BinaryReader::fromStringRef(it.second.first, IncludeVersion()) + .reboot.send(RebootRequest(false, true)); } if (address_interface.size() == 0) { fprintf(stderr, @@ -4179,13 +4165,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { if (!is_error) { for (int i = 1; i < tokens.size(); i++) { - if (db->apiVersionAtLeast(700)) - BinaryReader::fromStringRef( - address_interface[tokens[i]].first, IncludeVersion()) - .reboot.send(RebootRequest(false, true)); - else - tr->set(LiteralStringRef("\xff\xff/reboot_and_check_worker"), - address_interface[tokens[i]].first); + BinaryReader::fromStringRef(address_interface[tokens[i]].first, + IncludeVersion()) + .reboot.send(RebootRequest(false, true)); } printf("Attempted to kill and check %zu processes\n", tokens.size() - 1); }