apache/cassandra · error · UnsupportedOperationException

Not yet safe to use NON_DURABLE ReplayMode

Error message

Not yet safe to use NON_DURABLE ReplayMode

What it means

Replay.replay maps a ReplayMode onto the internal replayer mode. The NON_DURABLE mode is explicitly unimplemented: after assigning the enum value the code unconditionally throws UnsupportedOperationException 'Not yet safe to use NON_DURABLE ReplayMode'. This is an intentional guard preventing use of a feature that is not yet safe.

Source

Thrown at src/java/org/apache/cassandra/service/accord/journal/Replay.java:65

import static accord.local.RedundantStatus.Property.LOCALLY_DURABLE_TO_COMMAND_STORE;
import static accord.local.RedundantStatus.Property.LOCALLY_DURABLE_TO_DATA_STORE;
import static org.apache.cassandra.service.accord.JournalKey.Type.COMMAND_DIFF;
import static org.apache.cassandra.utils.FBUtilities.getAvailableProcessors;

public class Replay
{
    private static final Logger logger = LoggerFactory.getLogger(Replay.class);

    static boolean replay(AccordJournal journal, ReplayMode replayMode, CommandStore[] commandStores, Object param)
    {
        AbstractReplayer.Mode accordReplayerMode;
        switch (replayMode)
        {
            default: throw new UnhandledEnum(replayMode);
            case NON_DURABLE:
                accordReplayerMode = AbstractReplayer.Mode.NON_DURABLE;
                throw new UnsupportedOperationException("Not yet safe to use NON_DURABLE ReplayMode");
            case PART_NON_DURABLE:
                accordReplayerMode = AbstractReplayer.Mode.PART_NON_DURABLE;
                break;
            case ALL:
            case RESET:
                accordReplayerMode = AbstractReplayer.Mode.ALL;
        }

        Invariants.require(param == null || param.getClass() == Long2LongHashMap.class, "Param should be null or a map of commandStoreId->minSegmentId");
        final Long2LongHashMap minSegments = param == null || journal.rangeSearch != null ? new Long2LongHashMap(0L) : (Long2LongHashMap) param;
        if (journal.rangeSearch != null)
            logger.warn("journal_sai index enabled, which means safe replay markers do not reduce replay work");

        // TODO (expected): make the parallelisms configurable
        // Replay is performed in parallel, where at most X commands can be in flight, across at most Y commands stores.
        // That is, you can limit replay parallelism to 1 command store at a time, but load multiple commands within that data store,
        // _or_ have multiple commands being loaded accross multiple data stores.
        final Semaphore commandParallelism = Semaphore.newSemaphore(getAvailableProcessors());

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use ReplayMode.PART_NON_DURABLE, ALL, or RESET instead of NON_DURABLE.
  2. Remove NON_DURABLE from any scripts/tooling driving journal replay.
  3. Upgrade to a Cassandra version where NON_DURABLE replay is implemented, if it becomes available.

Example fix

// before
Replay.replay(ReplayMode.NON_DURABLE, ...);
// after
Replay.replay(ReplayMode.PART_NON_DURABLE, ...);
Defensive patterns

Strategy: type-guard

Validate before calling

if (mode == ReplayMode.NON_DURABLE) throw new IllegalArgumentException("NON_DURABLE replay is not implemented; use PART_NON_DURABLE/ALL/RESET");

Type guard

boolean replayModeSupported(ReplayMode m) { return m != ReplayMode.NON_DURABLE; }

Try / catch

try { replay(mode); } catch (UnsupportedOperationException e) { LOG.error("ReplayMode rejected: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Invoking journal replay with ReplayMode.NON_DURABLE, e.g. via the internal replay/journal control path or diagnostic tooling that selects the replay mode.

Common situations: Developers experimenting with replay modes during Accord journal debugging; tooling or scripts that pass NON_DURABLE expecting it to work; using a branch where the feature is not yet landed.

Related errors


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