apache/seatunnel · warning

Snapshot was interrupted before completion

Error message

Snapshot was interrupted before completion

What it means

Postgres snapshot split read task logs 'Snapshot was interrupted before completion' (WARN) and rethrows InterruptedException when doExecute() is interrupted during snapshot reading. The snapshot phase fails because the thread was cancelled, not because of a data or SQL error.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/reader/snapshot/PostgresSnapshotSplitReadTask.java:109

    @Override
    public SnapshotResult<PostgresOffsetContext> execute(
            ChangeEventSource.ChangeEventSourceContext context,
            PostgresPartition partition,
            PostgresOffsetContext previousOffset)
            throws InterruptedException {
        SnapshottingTask snapshottingTask = getSnapshottingTask(partition, previousOffset);
        final SnapshotContext<PostgresPartition, PostgresOffsetContext> ctx;
        try {
            ctx = prepare(partition);
        } catch (Exception e) {
            log.error("Failed to initialize snapshot context.", e);
            throw new RuntimeException(e);
        }
        try {
            return doExecute(context, previousOffset, ctx, snapshottingTask);
        } catch (InterruptedException e) {
            log.warn("Snapshot was interrupted before completion");
            throw e;
        } catch (Exception t) {
            throw new DebeziumException(t);
        }
    }

    @Override
    protected SnapshotResult<PostgresOffsetContext> doExecute(
            ChangeEventSource.ChangeEventSourceContext context,
            PostgresOffsetContext previousOffset,
            SnapshotContext<PostgresPartition, PostgresOffsetContext> snapshotContext,
            AbstractSnapshotChangeEventSource.SnapshottingTask snapshottingTask)
            throws Exception {
        final PostgresSnapshotContext ctx = (PostgresSnapshotContext) snapshotContext;
        ctx.offset = offsetContext;

        final LsnOffset lowWatermark = PostgresUtils.currentLsn(jdbcConnection);
        log.info(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Expected during job stop/cancel — no action needed.
  2. If unexpected, inspect engine logs above this warning for the cancellation root cause (checkpoint timeout, OOM, failover).
  3. Tune checkpoint interval/timeout so snapshot tasks are not cancelled prematurely.
  4. Restart the job; snapshot resumes from stored split offsets.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    // run CDC snapshot
} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    // handle as graceful cancellation; snapshot resumes on restart
}

Prevention

When it happens

Trigger: PostgresSnapshotSplitReadTask.execute() is interrupted mid-snapshot by engine task cancellation (job stop, checkpoint timeout failover, cluster shutdown) while the reader streams the snapshot split.

Common situations: User stops the CDC job during initial snapshot; Flink/Zeta cancels tasks on restart strategy; node shutdown during long-running snapshot of large tables.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/befe9346b99a3b63. Report an issue: GitHub.