apache/cassandra · error · InvalidRequestException

Cannot DROP COMPACT STORAGE as some nodes in the cluster

Error message

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.

What it means

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.

Solutions

  1. Upgrade all remaining nodes to 4.0+ (`nodetool version`, `nodetool describecluster`), then run `nodetool upgradesstables` cluster-wide and retry.
  2. Run `nodetool upgradesstables` on nodes still reporting 2.x sstables before retrying.
  3. As an explicit last resort, use the `--force-compact-storage-on` option (see surrounding code) after understanding the risk.
  4. Retry the ALTER TABLE once every node reports 4.0+ and upgraded SSTables.

Example fix

// before
session.execute("ALTER TABLE ks.tbl DROP COMPACT STORAGE;"); // node 'old1' on 3.11
// after
// 1. upgrade 'old1' to 4.0
// 2. nodetool upgradesstables (cluster-wide)
// then
session.execute("ALTER TABLE ks.tbl DROP COMPACT STORAGE;");
Defensive patterns

Strategy: validation

Validate before calling

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");

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/c626ac9c040645f8. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java:815

                        if (has2xSStables)
                            with2xSStables.add(node);
                    }
                    catch (IllegalArgumentException e)
                    {
                        // Means VersionType::fromString didn't parse a version correctly. Which shouldn't happen, we shouldn't
                        // have garbage in Gossip. But crashing the request is not ideal, so we log the error but ignore the
                        // node otherwise.
                        noSpamLogger.error("Unexpected error parsing sstable versions from gossip for {} (gossiped value " +
                                           "is '{}'). This is a bug and should be reported. Cannot ensure that {} has no " +
                                           "non-upgraded 2.x sstables anymore. If after this DROP COMPACT STORAGE some old " +
                                           "sstables cannot be read anymore, please use `upgradesstables` with the " +
                                           "`--force-compact-storage-on` option.", node, sstableVersionsString, node);
                    }
                }
            }

            if (!before4.isEmpty())
                throw new InvalidRequestException(format("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.", before4));
            if (!with2xSStables.isEmpty())
                throw new InvalidRequestException(format("Cannot DROP COMPACT STORAGE as some nodes in the cluster (%s) " +
                                                         "has some non-upgraded 2.x sstables. Please run `upgradesstables` " +
                                                         "on those nodes before retrying", with2xSStables));
        }
    }

    public static class AlterConstraints extends AlterTableStatement
    {
        final ColumnIdentifier columnName;
        final ColumnConstraints.Raw constraints;
        final boolean ifColumnExists;

        AlterConstraints(String keyspaceName, String tableName, boolean ifTableExists, boolean ifColumnExists, ColumnIdentifier columnName, ColumnConstraints.Raw constraints)
        {
            super(keyspaceName, tableName, ifTableExists);

View on GitHub (pinned to 88fd0f6a0e)