{"record":{"id":"8899ef3bb7beef41","repo":"apache/cassandra","slug":"gave-up-waiting-on-journal-index-to-be-ready","errorCode":null,"errorMessage":"Gave up waiting on journal index to be ready","messagePattern":"Gave up waiting on journal index to be ready","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/accord/journal/RangeSearchManager.java","lineNumber":170,"sourceCode":"        Index tableIndex = cfs.indexManager.getIndexByName(AccordKeyspace.JOURNAL_INDEX_NAME);\n        RetryStrategy retry = DatabaseDescriptor.getAccord().retry_journal_index_ready.retry();\n        for (int i = 0; !cfs.indexManager.isIndexQueryable(tableIndex); i++)\n        {\n            logger.debug(\"Journal index {} is not ready wait... waiting\", AccordKeyspace.JOURNAL_INDEX_NAME);\n            maybeWait(retry, i);\n        }\n    }\n\n    /**\n     * This method is here to make it easier for org.apache.cassandra.distributed.test.accord.journal.JournalAccessRouteIndexOnStartupRaceTest\n     * to check when we need to do waiting\n     */\n    @VisibleForTesting\n    private static void maybeWait(RetryStrategy retry, int i)\n    {\n        long waitTime = retry.computeWait(i, TimeUnit.MICROSECONDS);\n        if (waitTime == -1)\n            throw new IllegalStateException(\"Gave up waiting on journal index to be ready\");\n        try\n        {\n            TimeUnit.MICROSECONDS.sleep(waitTime);\n        }\n        catch (InterruptedException e)\n        {\n            throw new UncheckedInterruptedException(e);\n        }\n    }\n\n    /**\n     * When using {@link PartitionRangeReadCommand} we need to work with {@link RowFilter} which works with columns.\n     * But the index doesn't care about table based queries and needs to be queried using the fields in the index, to\n     * support that this enum exists.  This enum represents the fields present in the index and can be used to apply\n     * filters to the index.\n     */\n    public enum SyntheticColumn\n    {","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/accord/journal/RangeSearchManager.java#L152-L188","documentation":"RangeSearchManager.maybeWait sleeps between retries while waiting for the Accord journal index to become ready. When the supplied RetryStrategy returns -1 (no more retries) on iteration i, it throws IllegalStateException 'Gave up waiting on journal index to be ready'. This indicates the journal index remained unavailable after exhausting the retry budget.","triggerScenarios":"Starting Accord service / journal replay when the journal index fails to initialize or rebuild quickly enough; each start() call via maybeWait retries and finally aborts when computeWait returns -1.","commonSituations":"Slow disks or very large journal index rebuild at startup; I/O errors preventing index readiness; misconfigured retry strategy in tests (visible via @VisibleForTesting).","solutions":["Inspect earlier logs for the underlying reason the journal index is not becoming ready (I/O errors, corrupt files).","Increase the journal index readiness RetryStrategy (more attempts/longer max wait) via configuration or test harness.","Repair or restore the Accord journal data directory; consider wiping/rebuilding the journal if data loss is acceptable.","Ensure sufficient disk I/O headroom so index loading completes within the retry window."],"exampleFix":"// before: default tight retry budget\nRetryStrategy.NO_RETRY\n// after: allow bounded retries with backoff\nRetryStrategy.exponentialBackoff(10, TimeUnit.SECONDS.toMicros(1), TimeUnit.MINUTES.toMicros(5))","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { startAccord(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"journal index\")) { LOG.error(\"Journal index never became ready; check disk/IO and prior log lines for root cause\"); throw e; } }","preventionTips":["Provision adequate disk I/O so the journal index loads within the retry window.","Monitor startup logs for repeated journal-index retries.","Configure a generous RetryStrategy for large/slow deployments.","Fix underlying I/O errors promptly — retries only mask them."],"tags":["accord","journal","timeout","startup"],"backgroundTag":"request-timeout","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}