{"record":{"id":"d2cb56d59e4b5f17","repo":"apache/seatunnel","slug":"not-supported-create-new-offset-by-filename-and-po-d2cb56","errorCode":null,"errorMessage":"not supported create new Offset by filename and position.","messagePattern":"not supported create new Offset by filename and position\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/offset/LsnOffsetFactory.java","lineNumber":69,"sourceCode":"    }\n\n    @Override\n    public Offset latest() {\n        try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {\n            return SqlServerUtils.currentLsn((SqlServerConnection) jdbcConnection);\n        } catch (Exception e) {\n            throw new RuntimeException(\"Read the binlog offset error\", e);\n        }\n    }\n\n    @Override\n    public Offset specific(Map<String, String> offset) {\n        return LsnOffset.valueOf(offset);\n    }\n\n    @Override\n    public Offset specific(String filename, Long position) {\n        throw new UnsupportedOperationException(\n                \"not supported create new Offset by filename and position.\");\n    }\n\n    @Override\n    public Offset timestamp(long timestamp) {\n        try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {\n            return SqlServerUtils.timestampToLsn(\n                    (SqlServerConnection) jdbcConnection,\n                    timestamp,\n                    sourceConfig.getServerTimeZone());\n        } catch (Exception e) {\n            throw new RuntimeException(\"Convert timestamp to LSN offset error\", e);\n        }\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":85,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/offset/LsnOffsetFactory.java#L51-L85","documentation":"LsnOffsetFactory.specific(String filename, Long position) is unimplemented for SQL Server because LSN offsets are not filename/position pairs (that model is binlog/log-file specific). Calling it always throws UnsupportedOperationException.","triggerScenarios":"Any code path (typically a restore-from-offset API or framework fallback that identifies offsets by filename+position) invokes specific(filename, position) on the SQL Server offset factory.","commonSituations":"Porting logic written for MySQL binlog filenames to SQL Server; framework code that assumes the filename/position offset model; manual checkpoint restore attempts using file-based offsets.","solutions":["Use LsnOffsetFactory.specific(Map<String,String> offset) with an LSN-based offset map instead","Restore from a saved SeaTunnel CDC offset containing the LSN key rather than filename/position","Re-run from snapshot/latest if no valid LSN offset exists","Do not call the filename/position overload in SQL Server code paths"],"exampleFix":"// before\nOffset o = offsetFactory.specific(\"000001.log\", 42L); // throws\n// after\nMap<String,String> off = new HashMap<>();\noff.put(\"lsn\", \"00000026:00000ab8:0003\");\nOffset o = offsetFactory.specific(off);","handlingStrategy":"type-guard","validationCode":"// only use filename/position offsets for engines that support them (e.g. MySQL binlog)\nif (offsetFactory instanceof LsnOffsetFactory) {\n    // must use specific(Map<String,String>) with LSN keys\n}","typeGuard":"boolean supportsFilenamePosition(OffsetFactory f) {\n    return !(f instanceof LsnOffsetFactory); // SQL Server factory rejects it\n}","tryCatchPattern":"try {\n    offset = factory.specific(filename, position);\n} catch (UnsupportedOperationException e) {\n    Map<String,String> lsnOffset = loadLsnOffsetFromCheckpoint();\n    offset = factory.specific(lsnOffset);\n}","preventionTips":["Use the Map-based specific() overload with LSN keys for SQL Server","Restore state from SeaTunnel checkpoints rather than manual file/position offsets","Never copy MySQL binlog-offset restore logic to the SQL Server connector","Guard framework code that assumes the filename/position offset model"],"tags":["sqlserver","cdc","offset","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}