Skip to content

Commit 7802743

Browse files
committed
Fix issue when running cms reconfiguration with paxos repair disabled
Patch by marcuse; reviewed by Sam Tunnicliffe for CASSANDRA-20869
1 parent 0212713 commit 7802743

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
5.1
2+
* Fix issue when running cms reconfiguration with paxos repair disabled (CASSANDRA-20869)
23
* Added additional parameter to JVM shutdown to allow for logs to be properly shutdown (CASSANDRA-20978)
34
* Improve isGossipOnlyMember and location lookup performance (CASSANDRA-21039)
45
* Refactor the way we check if a transformation is allowed to be committed during upgrades (CASSANDRA-21043)

src/java/org/apache/cassandra/service/ActiveRepairService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.IOException;
2121
import java.net.UnknownHostException;
2222
import java.util.ArrayList;
23-
import java.util.Arrays;
2423
import java.util.Collection;
2524
import java.util.Collections;
2625
import java.util.HashMap;
@@ -118,7 +117,6 @@
118117
import org.apache.cassandra.utils.concurrent.AsyncPromise;
119118
import org.apache.cassandra.utils.concurrent.Future;
120119
import org.apache.cassandra.utils.concurrent.FutureCombiner;
121-
import org.apache.cassandra.utils.concurrent.ImmediateFuture;
122120

123121
import static com.google.common.collect.Iterables.concat;
124122
import static com.google.common.collect.Iterables.transform;
@@ -1190,13 +1188,13 @@ public List<Supplier<Future<?>>> repairPaxosForTopologyChangeAsync(String ksName
11901188
if (!paxosRepairEnabled())
11911189
{
11921190
logger.warn("Not running paxos repair for topology change because paxos repair has been disabled");
1193-
return Arrays.asList(() -> ImmediateFuture.success(null));
1191+
return Collections.emptyList();
11941192
}
11951193

11961194
if (ranges.isEmpty())
11971195
{
11981196
logger.warn("Not running paxos repair for topology change because there are no ranges to repair");
1199-
return Arrays.asList(() -> ImmediateFuture.success(null));
1197+
return Collections.emptyList();
12001198
}
12011199
ClusterMetadata metadata = ClusterMetadata.current();
12021200
List<TableMetadata> tables = Lists.newArrayList(metadata.schema.getKeyspaces().getNullable(ksName).tables);

src/java/org/apache/cassandra/tcm/sequences/ReconfigureCMS.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.function.Supplier;
3131

3232
import com.google.common.collect.ImmutableSet;
33+
import com.google.common.collect.Lists;
3334
import org.slf4j.Logger;
3435
import org.slf4j.LoggerFactory;
3536

@@ -198,7 +199,7 @@ public SequenceState executeNext()
198199
{
199200
String message = "Some data streaming failed. Use nodetool to check CMS reconfiguration state and resume. " +
200201
"For more, see `nodetool help cms reconfigure`.";
201-
logger.warn(message);
202+
logger.warn(message, t);
202203
return SequenceState.error(new RuntimeException(message));
203204
}
204205
}
@@ -344,10 +345,10 @@ static void repairPaxosForCMSTopologyChange()
344345
// overlapping quorums invariant holds.
345346

346347
Retry retry = Retry.withNoTimeLimit(TCMMetrics.instance.repairPaxosTopologyRetries);
347-
List<Supplier<Future<?>>> remaining = ActiveRepairService.instance()
348-
.repairPaxosForTopologyChangeAsync(SchemaConstants.METADATA_KEYSPACE_NAME,
349-
Collections.singletonList(entireRange),
350-
"CMS reconfiguration");
348+
List<Supplier<Future<?>>> remaining = Lists.newArrayList(ActiveRepairService.instance()
349+
.repairPaxosForTopologyChangeAsync(SchemaConstants.METADATA_KEYSPACE_NAME,
350+
Collections.singletonList(entireRange),
351+
"CMS reconfiguration"));
351352

352353
while (true)
353354
{

test/distributed/org/apache/cassandra/distributed/test/log/ReconfigureCMSTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,19 @@ public void cmsTopologyChangePaxosTest() throws Throwable
308308
}
309309
}
310310

311+
@Test
312+
public void testReconfigurePaxosRepairDisabled() throws IOException
313+
{
314+
try (Cluster cluster = builder().withNodes(3)
315+
.withConfig(c -> c.with(Feature.NETWORK)
316+
.set("paxos_repair_enabled", "false"))
317+
.withoutVNodes()
318+
.start())
319+
{
320+
cluster.get(1).nodetoolResult("cms", "reconfigure", "3").asserts().success();
321+
}
322+
}
323+
311324
private PaxosRepairHistory paxosRepairHistory(IInvokableInstance instance)
312325
{
313326
Object[][] rows = instance.executeInternal("select points from system.paxos_repair_history " +

0 commit comments

Comments
 (0)