{"record":{"id":"c626ac9c040645f8","repo":"apache/cassandra","slug":"cannot-drop-compact-storage-as-some-nodes-in-the-c","errorCode":null,"errorMessage":"Cannot DROP COMPACT STORAGE as some nodes in the cluster (%s) are not on 4.0+ yet. Please upgrade those nodes and run `upgradesstables` before retrying.","messagePattern":"Cannot DROP COMPACT STORAGE as some nodes in the cluster \\((.+?)\\) are not on 4\\.0\\+ yet\\. Please upgrade those nodes and run `upgradesstables` before retrying\\.","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java","lineNumber":815,"sourceCode":"                        if (has2xSStables)\n                            with2xSStables.add(node);\n                    }\n                    catch (IllegalArgumentException e)\n                    {\n                        // Means VersionType::fromString didn't parse a version correctly. Which shouldn't happen, we shouldn't\n                        // have garbage in Gossip. But crashing the request is not ideal, so we log the error but ignore the\n                        // node otherwise.\n                        noSpamLogger.error(\"Unexpected error parsing sstable versions from gossip for {} (gossiped value \" +\n                                           \"is '{}'). This is a bug and should be reported. Cannot ensure that {} has no \" +\n                                           \"non-upgraded 2.x sstables anymore. If after this DROP COMPACT STORAGE some old \" +\n                                           \"sstables cannot be read anymore, please use `upgradesstables` with the \" +\n                                           \"`--force-compact-storage-on` option.\", node, sstableVersionsString, node);\n                    }\n                }\n            }\n\n            if (!before4.isEmpty())\n                throw new InvalidRequestException(format(\"Cannot DROP COMPACT STORAGE as some nodes in the cluster (%s) \" +\n                                                         \"are not on 4.0+ yet. Please upgrade those nodes and run \" +\n                                                         \"`upgradesstables` before retrying.\", before4));\n            if (!with2xSStables.isEmpty())\n                throw new InvalidRequestException(format(\"Cannot DROP COMPACT STORAGE as some nodes in the cluster (%s) \" +\n                                                         \"has some non-upgraded 2.x sstables. Please run `upgradesstables` \" +\n                                                         \"on those nodes before retrying\", with2xSStables));\n        }\n    }\n\n    public static class AlterConstraints extends AlterTableStatement\n    {\n        final ColumnIdentifier columnName;\n        final ColumnConstraints.Raw constraints;\n        final boolean ifColumnExists;\n\n        AlterConstraints(String keyspaceName, String tableName, boolean ifTableExists, boolean ifColumnExists, ColumnIdentifier columnName, ColumnConstraints.Raw constraints)\n        {\n            super(keyspaceName, tableName, ifTableExists);","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java#L797-L833","documentation":"DROP COMPACT STORAGE requires the entire cluster to be on Cassandra 4.0+ with all 2.x-format SSTables upgraded, because it changes the on-disk layout cluster-wide. If any node is pre-4.0 (or still holds non-upgraded 2.x sstables), validation aborts the operation listing the offending nodes.","triggerScenarios":"Running `ALTER TABLE ks.tbl DROP COMPACT STORAGE;` while schema agreement/cluster introspection shows nodes on <4.0 versions, after other per-node checks (sstable versions) collected `before4` nodes.","commonSituations":"Rolling upgrades: attempting compact-storage migration while one or more nodes still run 3.x; also hit when a node was skipped in the upgrade and still stores legacy 2.x sstables.","solutions":["Upgrade all remaining nodes to 4.0+ (`nodetool version`, `nodetool describecluster`), then run `nodetool upgradesstables` cluster-wide and retry.","Run `nodetool upgradesstables` on nodes still reporting 2.x sstables before retrying.","As an explicit last resort, use the `--force-compact-storage-on` option (see surrounding code) after understanding the risk.","Retry the ALTER TABLE once every node reports 4.0+ and upgraded SSTables."],"exampleFix":"// before\nsession.execute(\"ALTER TABLE ks.tbl DROP COMPACT STORAGE;\"); // node 'old1' on 3.11\n// after\n// 1. upgrade 'old1' to 4.0\n// 2. nodetool upgradesstables (cluster-wide)\n// then\nsession.execute(\"ALTER TABLE ks.tbl DROP COMPACT STORAGE;\");","handlingStrategy":"validation","validationCode":"boolean allOn4 = clusterNodes.stream().allMatch(n -> n.versionAtLeast(\"4.0\")); if (!allOn4) throw new IllegalStateException(\"upgrade all nodes to 4.0+ and run upgradesstables first\");","typeGuard":null,"tryCatchPattern":"try { session.execute(\"ALTER TABLE ks.tbl DROP COMPACT STORAGE\"); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"are not on 4.0+ yet\")) { finishRollingUpgrade(); runUpgradesstables(); retry(); } else throw e; }","preventionTips":["Verify `nodetool describecluster` shows uniform 4.0+ versions before compact-storage migration","Run `nodetool upgradesstables` cluster-wide after the rolling upgrade","Include a cluster-version preflight step in migration runbooks"],"tags":["upgrade","compact-storage","cluster-consistency","versioning"],"backgroundTag":"unsupported-platform","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"}