{"record":{"id":"1a20d3247931365a","repo":"apache/seatunnel","slug":"read-snapshot-for-split-s-fail","errorCode":null,"errorMessage":"Read snapshot for split %s fail","messagePattern":"Read snapshot for split (.+?) fail","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/scan/Db2SnapshotFetchTask.java","lineNumber":78,"sourceCode":"                new Db2SnapshotSplitReadTask(\n                        sourceFetchContext.getDbzConnectorConfig(),\n                        sourceFetchContext.getOffsetContext(),\n                        sourceFetchContext.getSnapshotChangeEventSourceMetrics(),\n                        sourceFetchContext.getDatabaseSchema(),\n                        sourceFetchContext.getDataConnection(),\n                        sourceFetchContext.getDispatcher(),\n                        split);\n        SnapshotSplitChangeEventSourceContext changeEventSourceContext =\n                new SnapshotSplitChangeEventSourceContext();\n\n        SnapshotResult<Db2OffsetContext> snapshotResult =\n                snapshotSplitReadTask.execute(\n                        changeEventSourceContext,\n                        sourceFetchContext.getPartition(),\n                        sourceFetchContext.getOffsetContext());\n        if (!snapshotResult.isCompletedOrSkipped()) {\n            taskRunning = false;\n            throw new IllegalStateException(\n                    String.format(\"Read snapshot for split %s fail\", split));\n        }\n\n        boolean changed =\n                changeEventSourceContext\n                        .getHighWatermark()\n                        .isAfter(changeEventSourceContext.getLowWatermark());\n        if (!context.isExactlyOnce()) {\n            taskRunning = false;\n            if (changed) {\n                log.debug(\"Skip merge changelog(exactly-once) for snapshot split {}\", split);\n            }\n            return;\n        }\n\n        final IncrementalSplit backfillSplit = createBackFillLsnSplit(changeEventSourceContext);\n        // optimization that skip the binlog read when the low watermark equals high\n        // watermark","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/reader/fetch/scan/Db2SnapshotFetchTask.java#L60-L96","documentation":"Db2SnapshotFetchTask.execute runs the snapshot split read task and requires the result to be completed or skipped. If the returned SnapshotResult is neither, the snapshot did not finish successfully, so the task marks itself not running and fails with this IllegalStateException naming the split.","triggerScenarios":"SnapshotSplitReadTask.execute returns a SnapshotResult whose status is not COMPLETED or SKIPPED — e.g. the underlying snapshot read was cancelled, aborted due to schema change, or interrupted mid-split.","commonSituations":"Concurrent DDL on the snapshot table invalidating the read; checkpoint cancellation shutting down the change event source; DB2 connection loss aborting the snapshot query; job restart racing with split completion.","solutions":["Retry the job so the failed split is re-executed from its checkpointed position","Check DB2 server logs for lock waits, errors, or DDL during the snapshot window","Avoid schema changes (DDL) on tables while a snapshot is running","Increase checkpoint/timeout budgets if the snapshot is being cancelled prematurely"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { runPipeline(); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Read snapshot for split\")) { restartFromCheckpoint(); } }","preventionTips":["Do not run DDL on tables during snapshotting","Ensure checkpoints are enabled and stable","Monitor DB2 for lock contention during snapshot"],"tags":["db2","cdc","snapshot","illegal-state"],"backgroundTag":"internal-invariant-violation","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"}