{"record":{"id":"289eacefdc9749e0","repo":"apache/cassandra","slug":"commitlog-segment-is-too-old-to-open-upgrade-to-1","errorCode":null,"errorMessage":"Commitlog segment is too old to open; upgrade to 1.2.5+ first","messagePattern":"Commitlog segment is too old to open; upgrade to 1\\.2\\.5\\+ first","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"critical","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java","lineNumber":214,"sourceCode":"        Matcher matcher = extactFromFileName(name);\n        long id = Long.parseLong(matcher.group(3).split(SEPARATOR)[1]);\n        return new CommitLogDescriptor(Integer.parseInt(matcher.group(2)), id, null, new EncryptionContext());\n    }\n\n    public static long idFromFileName(String name)\n    {\n        Matcher matcher = extactFromFileName(name);\n        return Long.parseLong(matcher.group(3).split(SEPARATOR)[1]);\n    }\n\n    private static Matcher extactFromFileName(String name)\n    {\n        Matcher matcher = COMMIT_LOG_FILE_PATTERN.matcher(name);\n        if (!matcher.matches())\n            throw new RuntimeException(\"Cannot parse the version of the file: \" + name);\n\n        if (matcher.group(3) == null)\n            throw new UnsupportedOperationException(\"Commitlog segment is too old to open; upgrade to 1.2.5+ first\");\n\n        return matcher;\n    }\n\n    public int getMessagingVersion()\n    {\n        switch (version)\n        {\n            case VERSION_30:\n                return MessagingService.VERSION_30;\n            case VERSION_40:\n                return MessagingService.VERSION_40;\n            case VERSION_50:\n                return MessagingService.VERSION_50;\n            case VERSION_60:\n                return MessagingService.VERSION_60;\n            default:\n                throw new IllegalStateException(\"Unknown commitlog version \" + version);","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogDescriptor.java#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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.","Discard the ancient segments and restore data from a newer backup/snapshot instead.","Confirm the archive directory only contains 1.2.5+ named segments; move 1.1-era files elsewhere.","Extract needed data with the original old Cassandra version and re-import via sstableloader."],"exampleFix":"// before: 'CommitLog-1345678.log' (no version) on Cassandra 4.x -> UnsupportedOperationException\n// after: replay on intermediate 1.2.5+ first, or use sstableloader from the old cluster's SSTables","handlingStrategy":"validation","validationCode":"Matcher m = CommitLogDescriptor.COMMIT_LOG_FILE_PATTERN.matcher(name);\nif (m.matches() && m.group(3) == null)\n    logger.warn(\"{} is a pre-1.2.5 commit log; unsupported\", name);","typeGuard":null,"tryCatchPattern":"try { CommitLogDescriptor.fromFileName(name); } catch (UnsupportedOperationException e) { logger.error(\"Segment predates 1.2.5: {}\", e.getMessage()); }","preventionTips":["Migrate very old clusters via sstableloader, not commit log replay","Purge 1.1-era archives from restore directories","Document backup provenance (source version) for each archive"],"tags":["commitlog","legacy","upgrade","filename"],"backgroundTag":"unsupported-version","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"}