{"record":{"id":"f934771e0a152a5c","repo":"apache/cassandra","slug":"timed-out-while-trying-to-append-item-to-the-log","errorCode":null,"errorMessage":"Timed out while trying to append item to the log","messagePattern":"Timed out while trying to append item to the log","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java","lineNumber":153,"sourceCode":"            }\n\n            ByteBuffer serializedTransform = transform.kind().toVersionedBytes(transform);\n            String query = String.format(\"INSERT INTO %s.%s (epoch, entry_id, transformation, kind) \" +\n                                         \"VALUES (?, ?, ?, ?) \" +\n                                         \"IF NOT EXISTS;\",\n                                         METADATA_KEYSPACE_NAME, TABLE_NAME);\n            UntypedResultSet result = QueryProcessor.execute(query,\n                                                             ConsistencyLevel.QUORUM,\n                                                             nextEpoch.getEpoch(),\n                                                             entryId.entryId,\n                                                             serializedTransform,\n                                                             transform.kind().id);\n\n            return result.one().getBoolean(\"[applied]\");\n        }\n        catch (CasWriteTimeoutException t)\n        {\n            logger.warn(\"Timed out while trying to append item to the log\", t);\n            return false;\n        }\n        catch (Throwable t)\n        {\n            logger.error(\"Caught an exception while trying to CAS\", t);\n            return false;\n        }\n    }\n\n    private static final LogReader localLogReader = new DistributedTableLogReader(ConsistencyLevel.NODE_LOCAL);\n    private static final LogReader serialLogReader = new DistributedTableLogReader(ConsistencyLevel.SERIAL);\n\n    public static LogState getLogState(Epoch since, boolean consistentFetch)\n    {\n        return (consistentFetch ? serialLogReader : localLogReader).getLogState(since);\n    }\n\n    public static class DistributedTableLogReader implements LogReader","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java#L135-L171","documentation":"A warn log in DistributedMetadataLogKeyspace.tryCommit when the CAS append of a metadata log entry times out (CasWriteTimeoutException). The method returns false, so the metadata transformation commit is not recorded and the caller must retry.","triggerScenarios":"A CAS write appending an entry to the metadata log exceeds the write timeout at the requested consistency level — quorum replicas slow or unavailable during a schema/metadata change.","commonSituations":"Schema changes (CREATE/ALTER/DROP) issued while replicas are degraded; GC pauses or disk stalls on log replicas; too-low write_request_timeout_in_ms.","solutions":["Ensure a quorum of log replicas is healthy and retry the schema/metadata operation","Increase cassandra.write_request_timeout_in_ms for large/slow clusters","Check replica GC/disk health and repair any node outages","Retry the operation — the returned false indicates the caller retries the commit"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// check replica health before schema-mutating operations\nif (!RangeCommands.sufficientLiveNodesForSelectStar(logTable, ConsistencyLevel.QUORUM))\n    throw new IllegalStateException(\"Not enough live nodes for metadata log append\");","typeGuard":null,"tryCatchPattern":"try { committed = tryCommit(prevEpoch, transform, entryId, nextEpoch); }\ncatch (CasWriteTimeoutException e) {\n    logger.warn(\"Append timed out; retrying commit\", e);\n    return false; // caller retries\n}","preventionTips":["Retry metadata commits — timeout returns false and callers should re-attempt","Maintain quorum availability during schema changes","Increase write_request_timeout_in_ms on large/slow clusters","Watch replica GC and disk health"],"tags":["cas","metadata-log","timeout","schema"],"backgroundTag":"cas-write-timeout","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"}