{"record":{"id":"14280e48ee4ebaaf","repo":"apache/cassandra","slug":"txn-ops-is-a-write-only-table","errorCode":null,"errorMessage":"TXN_OPS + \" is a write-only table\"","messagePattern":"TXN_OPS \\+ \" is a write-only table\"","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java","lineNumber":1773,"sourceCode":"                this.description = description;\n            }\n        }\n        private TxnOpsTable()\n        {\n            super(parse(VIRTUAL_ACCORD_DEBUG, TXN_OPS,\n                        \"Update Accord Command State\",\n                        \"CREATE TABLE %s (\\n\" +\n                        \"  txn_id text,\\n\" +\n                        \"  command_store_id int,\\n\" +\n                        \"  op text,\" +\n                        \"  PRIMARY KEY (txn_id, command_store_id)\" +\n                        ')', UTF8Type.instance), FAIL, UNSORTED);\n        }\n\n        @Override\n        protected void collect(PartitionsCollector collector)\n        {\n            throw new UnsupportedOperationException(TXN_OPS + \" is a write-only table\");\n        }\n\n        @Override\n        protected void applyRowUpdate(Object[] partitionKeys, Object[] clusteringKeys, ColumnMetadata[] columns, Object[] values)\n        {\n            TxnId txnId = TxnId.parse((String) partitionKeys[0]);\n            int commandStoreId = (Integer) clusteringKeys[0];\n\n            TxnOp op = tryParse(values[0], true, TxnOp.class, TxnOp::valueOf);\n\n            switch (op)\n            {\n                default: throw new UnhandledEnum(op);\n                case LOCALLY_ERASE_VESTIGIAL:\n                    cleanup(txnId, commandStoreId, Cleanup.VESTIGIAL);\n                    break;\n                case LOCALLY_INVALIDATE:\n                    cleanup(txnId, commandStoreId, Cleanup.INVALIDATE);","sourceCodeStart":1755,"sourceCodeEnd":1791,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java#L1755-L1791","documentation":"The AccordDebugKeyspace virtual table `system_views.accord_txn_ops` only accepts writes (INSERTs that enqueue debug transaction operations); it has no read path. Any SELECT against it throws UnsupportedOperationException because collect() is deliberately unimplemented for this write-only table.","triggerScenarios":"Running any SELECT query (cqlsh or driver) against the TXN_OPS virtual table, e.g. `SELECT * FROM system_views.accord_txn_ops;`, which invokes the table's collect(PartitionsCollector) method.","commonSituations":"A developer inspects the table with SELECT first to see what's in it before inserting a debug operation, assuming virtual tables are always readable; also scripts or monitoring that enumerate all rows of every virtual table in system_views.","solutions":["Do not SELECT from this table; it is write-only by design - only INSERT rows to enqueue transaction debug operations.","Read the effects of enqueued operations from the intended output tables (e.g. accord_debug tables) instead.","If a read view is needed, contribute a separate readable virtual table upstream rather than patching collect()."],"exampleFix":"// before\nSELECT * FROM system_views.accord_txn_ops;\n// after\n-- write-only table: enqueue an op instead\nINSERT INTO system_views.accord_txn_ops (txn_id, op) VALUES ('<txnId>', 'APPLY');","handlingStrategy":"validation","validationCode":"// Treat accord_txn_ops as insert-only\nif (query.trim().toUpperCase().startsWith(\"SELECT\") && query.contains(\"accord_txn_ops\"))\n    throw new IllegalArgumentException(\"accord_txn_ops is write-only; do not SELECT from it\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember op-queue virtual tables (accord_*_ops) are write-only by design.","Read operation effects from readable accord debug tables instead.","Document the insert-only contract in runbooks that use these tables."],"tags":["virtual-table","unsupported-read","accord-debug"],"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"}