dcapwell commented on code in PR #3574:
URL: https://github.com/apache/cassandra/pull/3574#discussion_r1778816937


##########
src/java/org/apache/cassandra/cql3/statements/schema/DropKeyspaceStatement.java:
##########
@@ -45,8 +50,30 @@ public Keyspaces apply(ClusterMetadata metadata)
         Guardrails.dropKeyspaceEnabled.ensureEnabled(state);
 
         Keyspaces schema = metadata.schema.getKeyspaces();
-        if (schema.containsKeyspace(keyspaceName))
+        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
+        if (keyspace != null)
+        {
+            // check that no accord tables in the keyspace are currently in 
the process of being dropped
+            List<TableMetadata> pendingDrop = keyspace.tables.stream()
+                                                             .filter(t -> 
t.params.pendingDrop)
+                                                             
.collect(Collectors.toList());
+            if (!pendingDrop.isEmpty())
+                throw ire("Cannot drop keyspace '%s' as it contains accord 
tables which are currently being dropped. " +
+                          "Please wait for those operations to complete before 
dropping the keyspace. (%s)",
+                          keyspaceName, pendingDrop.stream()
+                                                   .map(Object::toString)
+                                                   
.collect(Collectors.joining(",")));
+
+            List<TableMetadata> accordTables = keyspace.tables.stream()
+                                               
.filter(TableMetadata::isAccordEnabled)
+                                               .collect(Collectors.toList());
+            if (!accordTables.isEmpty())

Review Comment:
   is accord matches dropping, but dropping is more informative that something 
is inflight and normal `DROP TABLE` won't work... so showing those first is 
better for operators.  This then shows all tables not being dropped that need 
to be dropped first



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to