apache/cassandra · critical · UnsupportedOperationException

Commitlog segment is too old to open; upgrade to 1.2.5+ firs

Error message

Commitlog segment is too old to open; upgrade to 1.2.5+ first

What it means

In extactFromFileName, the file-name regex captures an optional version group (group 3). If the name matches overall but has no version component, the segment predates Cassandra 1.2.5's versioned file naming and is unreadable, so an UnsupportedOperationException is thrown instructing an intermediate upgrade.

Source

Thrown at src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java:214

        Matcher matcher = extactFromFileName(name);
        long id = Long.parseLong(matcher.group(3).split(SEPARATOR)[1]);
        return new CommitLogDescriptor(Integer.parseInt(matcher.group(2)), id, null, new EncryptionContext());
    }

    public static long idFromFileName(String name)
    {
        Matcher matcher = extactFromFileName(name);
        return Long.parseLong(matcher.group(3).split(SEPARATOR)[1]);
    }

    private static Matcher extactFromFileName(String name)
    {
        Matcher matcher = COMMIT_LOG_FILE_PATTERN.matcher(name);
        if (!matcher.matches())
            throw new RuntimeException("Cannot parse the version of the file: " + name);

        if (matcher.group(3) == null)
            throw new UnsupportedOperationException("Commitlog segment is too old to open; upgrade to 1.2.5+ first");

        return matcher;
    }

    public int getMessagingVersion()
    {
        switch (version)
        {
            case VERSION_30:
                return MessagingService.VERSION_30;
            case VERSION_40:
                return MessagingService.VERSION_40;
            case VERSION_50:
                return MessagingService.VERSION_50;
            case VERSION_60:
                return MessagingService.VERSION_60;
            default:
                throw new IllegalStateException("Unknown commitlog version " + version);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Upgrade in steps: run Cassandra 1.2.5+ (or a supported intermediate like 2.1/3.0 depending on path) to replay and convert the old segments.
  2. Discard the ancient segments and restore data from a newer backup/snapshot instead.
  3. Confirm the archive directory only contains 1.2.5+ named segments; move 1.1-era files elsewhere.
  4. Extract needed data with the original old Cassandra version and re-import via sstableloader.

Example fix

// before: 'CommitLog-1345678.log' (no version) on Cassandra 4.x -> UnsupportedOperationException
// after: replay on intermediate 1.2.5+ first, or use sstableloader from the old cluster's SSTables
Defensive patterns

Strategy: validation

Validate before calling

Matcher m = CommitLogDescriptor.COMMIT_LOG_FILE_PATTERN.matcher(name);
if (m.matches() && m.group(3) == null)
    logger.warn("{} is a pre-1.2.5 commit log; unsupported", name);

Try / catch

try { CommitLogDescriptor.fromFileName(name); } catch (UnsupportedOperationException e) { logger.error("Segment predates 1.2.5: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling fromFileName/possiblyRestore paths on a commit log file whose name lacks a version field (e.g. 'CommitLog-12345.log' without the version segment), i.e. produced by Cassandra < 1.2.5.

Common situations: Restoring extremely old backups into a modern cluster, migrating data from a 1.1-era installation directly to 3.x/4.x, or old archived segments kept around far beyond a supported upgrade path.

Related errors


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