This is an automated email from the ASF dual-hosted git repository.
brandonwilliams pushed a commit to branch cassandra-3.11
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/cassandra-3.11 by this push:
new b18a9f0 Validate existence of DCs when repairing
b18a9f0 is described below
commit b18a9f03377059d9caae8894e8734c2380344b66
Author: Jan Karlsson <[email protected]>
AuthorDate: Tue Mar 1 09:32:33 2022 +0100
Validate existence of DCs when repairing
Patch by Jan Karlsson; reviewed by bereng and brandonwilliams for
CASSANDRA-17407
---
CHANGES.txt | 1 +
src/java/org/apache/cassandra/service/StorageService.java | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/CHANGES.txt b/CHANGES.txt
index 155d11f..c6708f5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
3.11.13
+ * Validate existence of DCs when repairing (CASSANDRA-17407)
* dropping of a materialized view creates a snapshot with dropped- prefix
(CASSANDRA-17415)
Merged from 3.0:
* filter out NULL_VERSION entries from peers table in ConfiguredLimit
(CASSANDRA-16518)
diff --git a/src/java/org/apache/cassandra/service/StorageService.java
b/src/java/org/apache/cassandra/service/StorageService.java
index 49f3835..c7e0713 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -3779,6 +3779,13 @@ public class StorageService extends
NotificationBroadcasterSupport implements IE
{
throw new IllegalArgumentException("the local data center must be
part of the repair");
}
+ Set<String> existingDatacenters =
tokenMetadata.cloneOnlyTokenMap().getTopology().getDatacenterEndpoints().keys().elementSet();
+ List<String> datacenters = new ArrayList<>(options.getDataCenters());
+ if (!existingDatacenters.containsAll(datacenters))
+ {
+ datacenters.removeAll(existingDatacenters);
+ throw new IllegalArgumentException("data center(s) " +
datacenters.toString() + " not found");
+ }
RepairRunnable task = new RepairRunnable(this, cmd, options, keyspace);
task.addProgressListener(progressSupport);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]