{"record":{"id":"9eb5a61c223367e9","repo":"apache/cassandra","slug":"previous-epoch-indicates-that-the-has-not-be","errorCode":null,"errorMessage":"Previous epoch {} indicates that the {} has not been initialized yet, not committing entry {}/{} at epoch {}","messagePattern":"Previous epoch (.+?) indicates that the (.+?) has not been initialized yet, not committing entry (.+?)/(.+?) at epoch (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java","lineNumber":131,"sourceCode":"        catch (Throwable t)\n        {\n            JVMStabilityInspector.inspectThrowable(t);\n            logger.error(\"Caught an exception while trying to CAS\", t);\n            return false;\n        }\n    }\n\n    public static boolean tryCommit(Entry.Id entryId,\n                                    Transformation transform,\n                                    Epoch previousEpoch,\n                                    Epoch nextEpoch)\n    {\n        try\n        {\n            // log is not initialized yet this is unexpected\n            if (previousEpoch.isBefore(FIRST))\n            {\n                logger.warn(\"Previous epoch {} indicates that the {} has not been initialized yet, \" +\n                            \"not committing entry {}/{} at epoch {}\",\n                            previousEpoch, METADATA_KEYSPACE_NAME, entryId, transform, nextEpoch);\n                return false;\n            }\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]\");","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/DistributedMetadataLogKeyspace.java#L113-L149","documentation":"A warn log in DistributedMetadataLogKeyspace.tryCommit when the previously observed epoch in the metadata log precedes the FIRST epoch, meaning the log was never initialized. The commit is skipped (returns false) because committing an entry to an uninitialized log would be invalid.","triggerScenarios":"tryCommit is invoked with a previousEpoch before FIRST — the log table is empty/not initialized but a metadata transformation commit is attempted.","commonSituations":"Broken or partially-initialized system_metadata_log table (e.g. restored from backup, truncated manually); a race where commit runs before initialization completes; corrupted metadata state after failed bootstrap.","solutions":["Ensure the metadata log is initialized (restart node so insertPreInitialize runs successfully and confirm CAS succeeds)","Check system_metadata_log contents; if empty/corrupted on a live cluster, rebuild metadata log state per support guidance","Investigate ordering: initialization must complete before any tryCommit; look for failed init logs (e.g. 'Timed out while trying to CAS' / 'Could not initialize log')","If restore-related, follow the documented snapshot/restore procedure so the metadata log is restored consistently"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// guard before committing\nEpoch prev = currentLogEpoch();\nif (prev.isBefore(Epoch.FIRST)) {\n    throw new IllegalStateException(\"Metadata log not initialized; cannot commit \" + entryId);\n}","typeGuard":"boolean logInitialized(Epoch previousEpoch) { return !previousEpoch.isBefore(Epoch.FIRST); }","tryCatchPattern":"try { boolean ok = tryCommit(...); if (!ok) retryAfterInit(); }\ncatch (CasWriteTimeoutException e) { scheduleRetry(); }","preventionTips":["Ensure insertPreInitialize succeeds before any commits (watch for its timeout warnings)","Never truncate or partially restore system_metadata_log","Follow documented snapshot/restore procedures to keep the log consistent"],"tags":["schema","metadata-log","epoch","initialization"],"backgroundTag":"invalid-state-transition","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"}