From be5a18c07db741f4da4ebbc5610f7e9ef22d45fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Botond=20D=C3=A9nes?= Date: Thu, 14 Mar 2024 03:24:39 -0400 Subject: [PATCH] tools/scylla-nodetool: repair: set the jobThreads request parameter Although ScyllaDB ignores this request parameter, the Java nodetools sets it, so it is better to have the native one do the same for symmetry. It makes testing easier. Discovered with the more strict request matching introduced in the next patches. --- test/nodetool/test_repair.py | 7 ++++++- tools/scylla-nodetool.cc | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/nodetool/test_repair.py b/test/nodetool/test_repair.py index 604340fdf0..6c97b982ad 100644 --- a/test/nodetool/test_repair.py +++ b/test/nodetool/test_repair.py @@ -478,6 +478,11 @@ def test_repair_unused_options(request, nodetool, jobs, full): if full: args.append(full) + if jobs: + job_threads = jobs[1] + else: + job_threads = "1" + res = nodetool(*args, expected_requests=[ expected_request("GET", "/storage_service/keyspaces", response=["ks"]), JMX_COLUMN_FAMILIES_REQUEST, @@ -492,7 +497,7 @@ def test_repair_unused_options(request, nodetool, jobs, full): "incremental": "false", "pullRepair": "false", "primaryRange": "false", - "jobThreads": "1"}, + "jobThreads": job_threads}, response=1), expected_request("GET", "/storage_service/repair_async/ks", params={"id": "1"}, response="SUCCESSFUL")]) diff --git a/tools/scylla-nodetool.cc b/tools/scylla-nodetool.cc index 50b0c05b13..c486dfa76d 100644 --- a/tools/scylla-nodetool.cc +++ b/tools/scylla-nodetool.cc @@ -1326,6 +1326,10 @@ void repair_operation(scylla_rest_client& client, const bpo::variables_map& vm) repair_params["primaryRange"] = "true"; } + if (vm.contains("job-threads")) { + repair_params["jobThreads"] = fmt::to_string(vm["job-threads"].as()); + } + auto log = [&] (fmt::format_string fmt, Args&&... param) { const auto msg = fmt::format(fmt, param...); using clock = std::chrono::system_clock; @@ -3075,7 +3079,7 @@ Fore more information, see: https://opensource.docs.scylladb.com/stable/operatin typed_option<>("in-local-dc", "Constrain repair to the local datacenter only"), typed_option>("in-hosts", "Constrain repair to the specific host(s)"), typed_option<>("ignore-unreplicated-keyspaces", "Ignore keyspaces which are not replicated, without this repair will fail on such keyspaces"), - typed_option("job-threads,j", "Number of threads to run repair on. "), + typed_option("job-threads,j", "Number of threads to run repair on"), typed_option<>("partitioner-range", "Repair only the first range returned by the partitioner"), typed_option<>("pull", "Fix local node only"), typed_option<>("sequential", "Perform repair sequentially"),