From ea62f7c8484d3da0d64cec9e33b6da25d204ce70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Fri, 8 Dec 2023 06:02:50 -0500 Subject: [PATCH] tools/scylla-nodetool: implement the decommission command --- test/nodetool/test_nodeops.py | 12 ++++++++++++ tools/scylla-nodetool.cc | 15 +++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 test/nodetool/test_nodeops.py diff --git a/test/nodetool/test_nodeops.py b/test/nodetool/test_nodeops.py new file mode 100644 index 0000000000..e4cbdc51c8 --- /dev/null +++ b/test/nodetool/test_nodeops.py @@ -0,0 +1,12 @@ +# +# Copyright 2023-present ScyllaDB +# +# SPDX-License-Identifier: AGPL-3.0-or-later +# + +from rest_api_mock import expected_request + + +def test_decommission(nodetool): + nodetool("decommission", expected_requests=[ + expected_request("POST", "/storage_service/decommission")]) diff --git a/tools/scylla-nodetool.cc b/tools/scylla-nodetool.cc index 70d639ecab..9ec2953835 100644 --- a/tools/scylla-nodetool.cc +++ b/tools/scylla-nodetool.cc @@ -347,6 +347,11 @@ void compactionhistory_operation(scylla_rest_client& client, const bpo::variable } } + +void decommission_operation(scylla_rest_client& client, const bpo::variables_map& vm) { + client.post("/storage_service/decommission"); +} + void disableautocompaction_operation(scylla_rest_client& client, const bpo::variables_map& vm) { if (!vm.count("keyspace")) { for (const auto& keyspace : get_keyspaces(client)) { @@ -773,6 +778,16 @@ Fore more information, see: https://opensource.docs.scylladb.com/stable/operatin }, compactionhistory_operation }, + { + { + "decommission", + "Deactivate a selected node by streaming its data to the next node in the ring", +R"( +Fore more information, see: https://opensource.docs.scylladb.com/stable/operating-scylla/nodetool-commands/decommission.html +)", + }, + decommission_operation + }, { { "disableautocompaction",