{"record":{"id":"6f799f5f1763dfae","repo":"apache/cassandra","slug":"cannot-drop-keyspace-s-as-it-contains-accord-ta","errorCode":null,"errorMessage":"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)","messagePattern":"Cannot drop keyspace '(.+?)' as it contains accord tables which are currently being dropped\\. Please wait for those operations to complete before dropping the keyspace\\. \\((.+?)\\)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/DropKeyspaceStatement.java","lineNumber":68,"sourceCode":"    {\n        return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);\n    }\n\n    @Override\n    public Keyspaces apply(ClusterMetadata metadata)\n    {\n        Guardrails.dropKeyspaceEnabled.ensureEnabled(state);\n\n        Keyspaces schema = metadata.schema.getKeyspaces();\n        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n        if (keyspace != null)\n        {\n            // check that no accord tables in the keyspace are currently in the process of being dropped\n            List<TableMetadata> pendingDrop = keyspace.tables.stream()\n                                                             .filter(t -> t.params.pendingDrop)\n                                                             .collect(Collectors.toList());\n            if (!pendingDrop.isEmpty())\n                throw ire(\"Cannot drop keyspace '%s' as it contains accord tables which are currently being dropped. \" +\n                          \"Please wait for those operations to complete before dropping the keyspace. (%s)\",\n                          keyspaceName, pendingDrop.stream()\n                                                   .map(Object::toString)\n                                                   .collect(Collectors.joining(\",\")));\n\n            List<TableMetadata> accordTables = keyspace.tables.stream()\n                                               .filter(TableMetadata::requiresAccordSupport)\n                                               .collect(Collectors.toList());\n            if (!accordTables.isEmpty())\n                throw ire(\"Cannot drop keyspace '%s' as it contains accord tables. (%s)\",\n                          keyspaceName, accordTables.stream()\n                                                   .map(Object::toString)\n                                                   .collect(Collectors.joining(\",\")));\n            return schema.without(keyspaceName);\n        }\n\n        if (ifExists)\n            return schema;","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/DropKeyspaceStatement.java#L50-L86","documentation":"DROP KEYSPACE was rejected because the keyspace contains Accord-enabled tables currently in the process of being dropped (params.pendingDrop). Dropping the keyspace now would race with those in-flight table drops, so Cassandra refuses until they complete.","triggerScenarios":"DROP KEYSPACE ks while any table in ks has params.pendingDrop == true, i.e. a DROP TABLE on an Accord transactional table was initiated but not finished.","commonSituations":"Re-issuing DROP KEYSPACE immediately after DROP TABLE on an Accord-backed table while the async drop propagates through the cluster; test teardown dropping keyspaces too quickly.","solutions":["Wait for the pending table drops to complete (tables are listed in the error), then retry DROP KEYSPACE.","Poll system_schema.tables or driver schema metadata until the listed tables disappear.","Retry DROP KEYSPACE with a backoff loop."],"exampleFix":"// before\nDROP KEYSPACE ks; // issued right after DROP TABLE ks.txn\n// after\n-- wait until pending tables vanish, then:\nDROP KEYSPACE ks;","handlingStrategy":"retry","validationCode":"boolean pending = schema.getKeyspace(ks).tables.stream()\n    .anyMatch(t -> t.params.pendingDrop);\nif (pending) scheduleRetryAfterSchemaAgreement();","typeGuard":null,"tryCatchPattern":"catch (InvalidRequestException e) { if (e.getMessage().contains(\"currently being dropped\")) { retryWithBackoff(); } else throw e; }","preventionTips":["Wait for schema agreement after dropping Accord tables before dropping the keyspace","Serialize keyspace teardown after table teardown","Monitor pendingDrop state in maintenance tooling"],"tags":["cql","schema","accord","concurrency"],"backgroundTag":"invalid-state-transition","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}