apache/cassandra · error · InvalidRequestException

DROP COMPACT STORAGE is disabled. Enable in cassandra.yaml…

Error message

DROP COMPACT STORAGE is disabled. Enable in cassandra.yaml to use.

What it means

DROP COMPACT STORAGE is a destructive, once-only schema operation gated behind a cassandra.yaml flag (enable_drop_compact_storage). If the flag is not enabled, the ALTER TABLE ... DROP COMPACT STORAGE statement fails immediately with this InvalidRequestException, protecting operators from accidental data-layout rewrites.

Solutions

  1. Set `enable_drop_compact_storage: true` in cassandra.yaml on the node and restart, then retry the ALTER TABLE.
  2. Enable it temporarily only for the migration window and disable afterwards to prevent accidental drops.
  3. Verify the table is actually a compact table (`table.isCompactTable()`) — otherwise the flag change is pointless.
  4. Take a snapshot before running DROP COMPACT STORAGE.

Example fix

// before (cassandra.yaml)
enable_drop_compact_storage: false
// after
enable_drop_compact_storage: true
// then restart node and run:
// ALTER TABLE ks.tbl DROP COMPACT STORAGE;
Defensive patterns

Strategy: validation

Validate before calling

boolean enabled = StorageService.instance.isDropCompactStorageEnabled(); if (!enabled) throw new IllegalStateException("set enable_drop_compact_storage: true in cassandra.yaml and restart first");

Try / catch

try { session.execute("ALTER TABLE ks.tbl DROP COMPACT STORAGE"); } catch (InvalidRequestException e) { if (e.getMessage().contains("DROP COMPACT STORAGE is disabled")) { enableFlagAndRestart(); retry(); } else throw e; }

Prevention

When it happens

Trigger: Executing `ALTER TABLE ks.tbl DROP COMPACT STORAGE;` on a node where cassandra.yaml does not set `enable_drop_compact_storage: true`.

Common situations: Post-3.x upgrade cleanup: operators migrating thrift-era COMPACT STORAGE tables to 4.0 syntax but forgetting the yaml flag (default false), often hit during scripted migrations.

Related errors


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

Appendix: source

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

    private static class DropCompactStorage extends AlterTableStatement
    {
        private static final Logger logger = LoggerFactory.getLogger(AlterTableStatement.class);
        private static final NoSpamLogger noSpamLogger = NoSpamLogger.getLogger(logger, 5L, TimeUnit.MINUTES);
        private DropCompactStorage(String keyspaceName, String tableName, boolean ifTableExists)
        {
            super(keyspaceName, tableName, ifTableExists);
        }

        @Override
        public boolean compatibleWith(ClusterMetadata metadata)
        {
            return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);
        }

        public KeyspaceMetadata apply(Epoch epoch, KeyspaceMetadata keyspace, TableMetadata table, ClusterMetadata metadata)
        {
            if (!DatabaseDescriptor.enableDropCompactStorage())
                throw new InvalidRequestException("DROP COMPACT STORAGE is disabled. Enable in cassandra.yaml to use.");

            if (!table.isCompactTable())
                throw AlterTableStatement.ire("Cannot DROP COMPACT STORAGE on table without COMPACT STORAGE");

            validateCanDropCompactStorage();

            Set<Flag> flags = table.isCounter()
                            ? ImmutableSet.of(Flag.COMPOUND, Flag.COUNTER)
                            : ImmutableSet.of(Flag.COMPOUND);

            return keyspace.withSwapped(keyspace.tables.withSwapped(table.unbuild().flags(flags).build()));
        }

        /**
         * Throws if DROP COMPACT STORAGE cannot be used (yet) because the cluster is not sufficiently upgraded. To be able
         * to use DROP COMPACT STORAGE, we need to ensure that no pre-3.0 sstables exists in the cluster, as we won't be
         * able to read them anymore once COMPACT STORAGE is dropped (see CASSANDRA-15897). In practice, this method checks
         * 3 things:

View on GitHub (pinned to 88fd0f6a0e)