apache/cassandra · warning

Error notifying dictionary trained listener for

Error message

Error notifying dictionary trained listener for {}.{}

What it means

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.

Solutions

  1. Inspect the stack trace following the warning to find the listener's underlying exception.
  2. Verify the table still exists; if it was dropped concurrently, the warning is benign.
  3. Check disk health and the dictionary storage directory if the listener persists dictionaries.
  4. Retraining will re-trigger the listener; fix the underlying cause and let the next training cycle publish the dictionary.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    listener.accept(dictionary);
} catch (Exception e) {
    logger.warn("Error notifying dictionary trained listener for {}.{}", ks, table, e);
}

Prevention

When it happens

Trigger: 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.

Common situations: Table dropped concurrently right as training completes; IO errors writing trained dictionary; node shutting down mid-training callback; bugs in custom listener code paths.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/47e490c75427058e. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/db/compression/ZstdDictionaryTrainer.java:365

    }

    /**
     * Notifies the registered listener that a dictionary has been trained.
     *
     * @param dictionary the newly trained dictionary
     */
    private void notifyDictionaryTrainedListener(CompressionDictionary dictionary)
    {
        Consumer<CompressionDictionary> listener = this.dictionaryTrainedListener;
        if (listener != null)
        {
            try
            {
                listener.accept(dictionary);
            }
            catch (Exception e)
            {
                logger.warn("Error notifying dictionary trained listener for {}.{}", keyspaceName, tableName, e);
            }
        }
    }

    @Override
    public void close()
    {
        if (closed)
            return;

        closed = true;
        currentTrainingStatus = TrainingStatus.NOT_STARTED;

        synchronized (this)
        {
            // Permanent shutdown: clear all state and prevent restart
            totalSampleSize.set(0);
            sampleCount.set(0);

View on GitHub (pinned to 88fd0f6a0e)