apache/seatunnel · info · InterruptedException

Interrupted while emitting initial DROP TABLE events

Error message

Interrupted while emitting initial DROP TABLE events

What it means

readTableStructure() replays 'DROP TABLE IF EXISTS' DDL events for each captured table into the in-memory schema snapshot. Before each event it checks whether the connector's change event source is still running (sourceContext.isRunning()); if the source was stopped/cancelled mid-loop it throws InterruptedException with this message. This is a cooperative cancellation of the snapshot, not a data error.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlSnapshotChangeEventSource.java:441

                    "All eligible tables schema should be captured, capturing: {}",
                    capturedSchemaTables);
        }
        final Map<String, List<TableId>> tablesToRead =
                capturedSchemaTables.stream()
                        .collect(
                                Collectors.groupingBy(
                                        TableId::catalog, LinkedHashMap::new, Collectors.toList()));
        final Set<String> databases = tablesToRead.keySet();

        // Record default charset
        addSchemaEvent(
                snapshotContext,
                "",
                connection.setStatementFor(connection.readMySqlCharsetSystemVariables()));

        for (TableId tableId : capturedSchemaTables) {
            if (!sourceContext.isRunning()) {
                throw new InterruptedException(
                        "Interrupted while emitting initial DROP TABLE events");
            }
            addSchemaEvent(
                    snapshotContext, tableId.catalog(), "DROP TABLE IF EXISTS " + quote(tableId));
        }

        final Map<String, DatabaseLocales> databaseCharsets = connection.readDatabaseCollations();
        for (String database : databases) {
            if (!sourceContext.isRunning()) {
                throw new InterruptedException(
                        "Interrupted while reading structure of schema " + databases);
            }

            LOGGER.info("Reading structure of database '{}'", database);
            addSchemaEvent(snapshotContext, database, "DROP DATABASE IF EXISTS " + quote(database));
            final StringBuilder createDatabaseDddl =
                    new StringBuilder("CREATE DATABASE " + quote(database));
            final DatabaseLocales defaultDatabaseLocales = databaseCharsets.get(database);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. No code fix is needed — this is expected cancellation; simply restart/resubmit the job and the snapshot will resume from the last committed offset.
  2. If it fires unintentionally, check upstream logs for the event that stopped the source (task failure, cancel request, rebalance).
  3. Speed up or shrink the snapshot (fewer tables, snapshot.parallelism tuning) to reduce the window where stopping interrupts schema reading.
  4. Ensure a stable cluster/job configuration to avoid spurious rebalances during large snapshots.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    runSnapshot();
} catch (InterruptedException e) {
    if (e.getMessage().contains("Interrupted while emitting initial DROP TABLE events")) {
        // expected cancellation: job was stopped mid-snapshot; safe to restart,
        // the snapshot resumes from the last committed offset.
        log.info("Snapshot cancelled by stop signal; will resume on restart.");
    } else {
        Thread.currentThread().interrupt();
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling readTableStructure() during snapshot while the job is cancelled, the task is stopped for checkpoint/restart, the connector's running flag flips to false (e.g. stop signal, failure elsewhere in the pipeline), or the thread is interrupted while iterating capturedSchemaTables.

Common situations: User cancels the SeaTunnel job during a long snapshot; cluster rebalancing or task failure stops the source mid-schema-read; checkpoint-driven restart of the CDC source; job resubmission while a previous snapshot is in progress.

Related errors


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