From c77de305487b976fbfcedf5de6a56ed82e9acf63 Mon Sep 17 00:00:00 2001 From: Elliott Sims Date: Fri, 8 Mar 2024 23:05:09 -0600 Subject: [PATCH 1/4] Set segment count per node to consistent value across defaults and docs Per https://github.com/thelastpickle/cassandra-reaper/issues/1192 the default should be 64. So, set that everywhere, including docs --- docs/docs/configuration/reaper_specific/index.html | 2 +- src/docs/content/docs/configuration/reaper_specific.md | 2 +- .../main/java/io/cassandrareaper/service/RepairRunService.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/docs/configuration/reaper_specific/index.html b/docs/docs/configuration/reaper_specific/index.html index 7fce058e4..1f7dedd5a 100644 --- a/docs/docs/configuration/reaper_specific/index.html +++ b/docs/docs/configuration/reaper_specific/index.html @@ -523,7 +523,7 @@

scheduleDaysBetween

segmentCountPerNode

Type: Integer

-

Default: 16

+

Default: 64

Defines the default amount of repair segments to create for newly registered Cassandra repair runs, for each node in the cluster. When running a repair run by Reaper, each segment is repaired separately by the Reaper process, until all the segments in a token ring are repaired. The count might be slightly off the defined value, as clusters residing in multiple data centers require additional small token ranges in addition to the expected. This value can be overwritten when executing a repair run via Reaper.

In a 10 nodes cluster, setting a value of 20 segments per node will generate a repair run that splits the work into 200 token subranges. This number can vary due to vnodes (before 1.2.0, Reaper cannot create a segment with multiple token ranges, so the number of segments will be at least the total number of vnodes in the cluster). As Reaper tries to size segments evenly, the presence of very small token ranges can lead to have more segments than expected.

diff --git a/src/docs/content/docs/configuration/reaper_specific.md b/src/docs/content/docs/configuration/reaper_specific.md index e5d3d70dd..5a50893b8 100644 --- a/src/docs/content/docs/configuration/reaper_specific.md +++ b/src/docs/content/docs/configuration/reaper_specific.md @@ -352,7 +352,7 @@ Defines the amount of days to wait between scheduling new repairs. The value con Type: *Integer* -Default: *16* +Default: *64* Defines the default amount of repair segments to create for newly registered Cassandra repair runs, for each node in the cluster. When running a repair run by Reaper, each segment is repaired separately by the Reaper process, until all the segments in a token ring are repaired. The count might be slightly off the defined value, as clusters residing in multiple data centers require additional small token ranges in addition to the expected. This value can be overwritten when executing a repair run via Reaper. diff --git a/src/server/src/main/java/io/cassandrareaper/service/RepairRunService.java b/src/server/src/main/java/io/cassandrareaper/service/RepairRunService.java index 46aebcceb..b0d8a23e1 100644 --- a/src/server/src/main/java/io/cassandrareaper/service/RepairRunService.java +++ b/src/server/src/main/java/io/cassandrareaper/service/RepairRunService.java @@ -62,7 +62,7 @@ public final class RepairRunService { public static final Splitter COMMA_SEPARATED_LIST_SPLITTER = Splitter.on(',').trimResults(CharMatcher.anyOf(" ()[]\"'")).omitEmptyStrings(); - public static final int DEFAULT_SEGMENT_COUNT_PER_NODE = 16; + public static final int DEFAULT_SEGMENT_COUNT_PER_NODE = 64; private static final Logger LOG = LoggerFactory.getLogger(RepairRunService.class); From 354d14e23ab88416e925dd6649ee750850cfb9ec Mon Sep 17 00:00:00 2001 From: Elliott Sims Date: Sun, 10 Mar 2024 22:13:10 -0500 Subject: [PATCH 2/4] Also fix test that assumed 16-segment default --- .../java/io/cassandrareaper/service/RepairRunServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java index 8d7b618f2..2e2015628 100644 --- a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java +++ b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java @@ -196,7 +196,7 @@ public void computeGlobalSegmentCountSingleTokenPerNodeTest() { public void computeGlobalSegmentCount256TokenPerNodeTest() { Map, List> rangeToEndpoint = Maps.newHashMap(); - for (int i = 0; i < 768; i++) { + for (int i = 0; i < 3072; i++) { rangeToEndpoint.put( Arrays.asList(i + "", (i + 1) + ""), Arrays.asList("node1", "node2", "node3")); } From 39ae32ee716654bd1a9dcc22af4fb39b2b100ef5 Mon Sep 17 00:00:00 2001 From: Elliott Sims Date: Sun, 10 Mar 2024 22:28:13 -0500 Subject: [PATCH 3/4] Properly fix computeGlobalSegmentCount256TokenPerNodeTest After reading the actual function, this makes more sense as a fix. --- .../java/io/cassandrareaper/service/RepairRunServiceTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java index 2e2015628..9ee9bfc57 100644 --- a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java +++ b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java @@ -196,7 +196,7 @@ public void computeGlobalSegmentCountSingleTokenPerNodeTest() { public void computeGlobalSegmentCount256TokenPerNodeTest() { Map, List> rangeToEndpoint = Maps.newHashMap(); - for (int i = 0; i < 3072; i++) { + for (int i = 0; i < 768; i++) { rangeToEndpoint.put( Arrays.asList(i + "", (i + 1) + ""), Arrays.asList("node1", "node2", "node3")); } @@ -206,7 +206,7 @@ public void computeGlobalSegmentCount256TokenPerNodeTest() { endpointToRange.put("node2", Lists.newArrayList()); endpointToRange.put("node3", Lists.newArrayList()); - assertEquals(48, RepairRunService.computeGlobalSegmentCount(0, endpointToRange)); + assertEquals(192, RepairRunService.computeGlobalSegmentCount(0, endpointToRange)); } @Test From 427acc1972d5f9f018d99e6becc7c0987d2ee7e4 Mon Sep 17 00:00:00 2001 From: Elliott Sims Date: Sun, 10 Mar 2024 22:38:06 -0500 Subject: [PATCH 4/4] Also fix computeGlobalSegmentCountSingleTokenPerNodeTest --- .../java/io/cassandrareaper/service/RepairRunServiceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java index 9ee9bfc57..20af6113f 100644 --- a/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java +++ b/src/server/src/test/java/io/cassandrareaper/service/RepairRunServiceTest.java @@ -189,7 +189,7 @@ public void computeGlobalSegmentCountSingleTokenPerNodeTest() { endpointToRange.put("node2", Lists.newArrayList()); endpointToRange.put("node3", Lists.newArrayList()); - assertEquals(48, RepairRunService.computeGlobalSegmentCount(0, endpointToRange)); + assertEquals(192, RepairRunService.computeGlobalSegmentCount(0, endpointToRange)); } @Test