{"record":{"id":"754b31b685ee5e7a","repo":"apache/cassandra","slug":"counters-are-not-supported-with-accord-for-table","errorCode":null,"errorMessage":"Counters are not supported with Accord for table %s.%s","messagePattern":"Counters are not supported with Accord for table (.+?)\\.(.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java","lineNumber":651,"sourceCode":"\n            TableParams paramsForValidation = attrs.asNewTableParams(keyspaceName);\n            validateDefaultTimeToLive(paramsForValidation);\n            validateMinimumTrainingFrequencyForDictionaryCompressor(paramsForValidation);\n        }\n\n        private TableParams validateAndUpdateTransactionalMigration(boolean isCounter, TableParams prev, TableParams next)\n        {\n            if (next.transactionalMode.accordIsEnabled && SchemaConstants.isSystemKeyspace(keyspaceName))\n                throw ire(\"Cannot enable accord on system tables (%s.%s)\", keyspaceName, tableName);\n\n            boolean modeChange = prev.transactionalMode != next.transactionalMode;\n            boolean wasMigrating = prev.transactionalMigrationFrom.isMigrating();\n            boolean explicitlySetMigrationFrom = attrs.hasOption(Option.TRANSACTIONAL_MIGRATION_FROM);\n            // set table to migrating\n            TransactionalMigrationFromMode newMigrateFrom = TransactionalMigrationFromMode.fromMode(prev.transactionalMode, next.transactionalMode);\n\n            if (isCounter && (next.transactionalMode != TransactionalMode.off || newMigrateFrom != TransactionalMigrationFromMode.none || next.transactionalMigrationFrom != TransactionalMigrationFromMode.none))\n                throw ire(format(ACCORD_COUNTER_TABLES_UNSUPPORTED, keyspaceName, tableName));\n\n            boolean forceMigrationChange = modeChange && explicitlySetMigrationFrom && next.transactionalMigrationFrom != newMigrateFrom;\n\n            if (modeChange && next.transactionalMode.accordIsEnabled && !DatabaseDescriptor.getAccordTransactionsEnabled())\n                throw ire(format(\"Cannot change transactional mode to %s for %s.%s with accord.enabled set to false\",\n                                 next.transactionalMode, keyspaceName, tableName));\n\n            // user is manually updating migration mode, don't interfere\n            if (forceMigrationChange)\n            {\n                logger.warn(\"Forcing unsafe migration change from {} to {} with transaction mode {}\", prev.transactionalMigrationFrom, next.transactionalMigrationFrom, next.transactionalMode);\n                return next;\n            }\n\n            if (!modeChange)\n                return next;\n\n            // if the user is trying to revert to the mode being migrated from, allow it. The migration states will be inverted when","sourceCodeStart":633,"sourceCodeEnd":669,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java#L633-L669","documentation":"Counter tables are incompatible with Accord transactions and with any transactional migration state. In validateAndUpdateTransactionalMigration (AlterTableStatement.java:651), if the table is a counter table and the next transactionalMode is not 'off' or any migration-from mode is set, this InvalidRequest is thrown.","triggerScenarios":"ALTER TABLE on a counter table setting transactional_mode to any Accord-enabled value, or setting transactional_migration_from on a counter table.","commonSituations":"Attempting to migrate a legacy counter table to Accord-based transactions; bulk schema scripts that apply transactional_mode to every table including counters.","solutions":["Keep transactional_mode = 'off' on counter tables","Convert the counter table to a regular table (or a separate design) before adopting Accord","Filter counter tables out of scripts that set transactional_mode"],"exampleFix":"// before\nALTER TABLE metrics.counters WITH transactional_mode = 'accord';\n// after\nALTER TABLE metrics.gauges WITH transactional_mode = 'accord'; // non-counter table","handlingStrategy":"validation","validationCode":"TableMetadata t = Schema.instance.getTableMetadata(ks, table); if (t.isCounter() && params.transactionalMode != TransactionalMode.off) { /* reject: Accord unsupported on counters */ }","typeGuard":null,"tryCatchPattern":"try { session.execute(alterStmt); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"Counters are not supported with Accord\")) { /* keep counters on transactional_mode = off */ } else throw e; }","preventionTips":["Check table type (counter vs regular) before applying transactional_mode changes","Segment schema scripts by table kind","Design Accord adoption to start with non-counter tables"],"tags":["cassandra","accord","counter-table","transactional-mode","schema"],"backgroundTag":"unsupported-operation","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"}