{"record":{"id":"47e490c75427058e","repo":"apache/cassandra","slug":"error-notifying-dictionary-trained-listener-for","errorCode":null,"errorMessage":"Error notifying dictionary trained listener for {}.{}","messagePattern":"Error notifying dictionary trained listener for (.+?)\\.(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/compression/ZstdDictionaryTrainer.java","lineNumber":365,"sourceCode":"    }\n\n    /**\n     * Notifies the registered listener that a dictionary has been trained.\n     *\n     * @param dictionary the newly trained dictionary\n     */\n    private void notifyDictionaryTrainedListener(CompressionDictionary dictionary)\n    {\n        Consumer<CompressionDictionary> listener = this.dictionaryTrainedListener;\n        if (listener != null)\n        {\n            try\n            {\n                listener.accept(dictionary);\n            }\n            catch (Exception e)\n            {\n                logger.warn(\"Error notifying dictionary trained listener for {}.{}\", keyspaceName, tableName, e);\n            }\n        }\n    }\n\n    @Override\n    public void close()\n    {\n        if (closed)\n            return;\n\n        closed = true;\n        currentTrainingStatus = TrainingStatus.NOT_STARTED;\n\n        synchronized (this)\n        {\n            // Permanent shutdown: clear all state and prevent restart\n            totalSampleSize.set(0);\n            sampleCount.set(0);","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compression/ZstdDictionaryTrainer.java#L347-L383","documentation":"ZstdDictionaryTrainer.notifyDictionaryTrainedListener logs this warning when the registered listener (Consumer<CompressionDictionary>) throws after a dictionary is successfully trained. The dictionary itself was trained fine; only the post-training callback failed, typically because the listener persists the dictionary and that side effect failed.","triggerScenarios":"trainDictionary completes, then listener.accept(dictionary) throws — e.g. the listener attempts to write the dictionary to the dictionary cache/store or sstable metadata and hits an IO exception, schema change, or shutdown in progress.","commonSituations":"Table dropped concurrently right as training completes; IO errors writing trained dictionary; node shutting down mid-training callback; bugs in custom listener code paths.","solutions":["Inspect the stack trace following the warning to find the listener's underlying exception.","Verify the table still exists; if it was dropped concurrently, the warning is benign.","Check disk health and the dictionary storage directory if the listener persists dictionaries.","Retraining will re-trigger the listener; fix the underlying cause and let the next training cycle publish the dictionary."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    listener.accept(dictionary);\n} catch (Exception e) {\n    logger.warn(\"Error notifying dictionary trained listener for {}.{}\", ks, table, e);\n}","preventionTips":["Make listener side effects (persistence) idempotent so retraining can safely retry.","Guard listeners against the table being dropped concurrently.","Avoid long blocking work in listener callbacks.","Check disk health of the dictionary storage location."],"tags":["cassandra","zstd","compression","listener-callback"],"backgroundTag":"callback-invocation-failed","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"}