{"record":{"id":"01ab30ac2aedd899","repo":"apache/seatunnel","slug":"interrupted-while-emitting-initial-drop-table-even","errorCode":null,"errorMessage":"Interrupted while emitting initial DROP TABLE events","messagePattern":"Interrupted while emitting initial DROP TABLE events","errorType":"exception","errorClass":"InterruptedException","httpStatus":null,"severity":"info","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlSnapshotChangeEventSource.java","lineNumber":441,"sourceCode":"                    \"All eligible tables schema should be captured, capturing: {}\",\n                    capturedSchemaTables);\n        }\n        final Map<String, List<TableId>> tablesToRead =\n                capturedSchemaTables.stream()\n                        .collect(\n                                Collectors.groupingBy(\n                                        TableId::catalog, LinkedHashMap::new, Collectors.toList()));\n        final Set<String> databases = tablesToRead.keySet();\n\n        // Record default charset\n        addSchemaEvent(\n                snapshotContext,\n                \"\",\n                connection.setStatementFor(connection.readMySqlCharsetSystemVariables()));\n\n        for (TableId tableId : capturedSchemaTables) {\n            if (!sourceContext.isRunning()) {\n                throw new InterruptedException(\n                        \"Interrupted while emitting initial DROP TABLE events\");\n            }\n            addSchemaEvent(\n                    snapshotContext, tableId.catalog(), \"DROP TABLE IF EXISTS \" + quote(tableId));\n        }\n\n        final Map<String, DatabaseLocales> databaseCharsets = connection.readDatabaseCollations();\n        for (String database : databases) {\n            if (!sourceContext.isRunning()) {\n                throw new InterruptedException(\n                        \"Interrupted while reading structure of schema \" + databases);\n            }\n\n            LOGGER.info(\"Reading structure of database '{}'\", database);\n            addSchemaEvent(snapshotContext, database, \"DROP DATABASE IF EXISTS \" + quote(database));\n            final StringBuilder createDatabaseDddl =\n                    new StringBuilder(\"CREATE DATABASE \" + quote(database));\n            final DatabaseLocales defaultDatabaseLocales = databaseCharsets.get(database);","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/io/debezium/connector/mysql/MySqlSnapshotChangeEventSource.java#L423-L459","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["No code fix is needed — this is expected cancellation; simply restart/resubmit the job and the snapshot will resume from the last committed offset.","If it fires unintentionally, check upstream logs for the event that stopped the source (task failure, cancel request, rebalance).","Speed up or shrink the snapshot (fewer tables, snapshot.parallelism tuning) to reduce the window where stopping interrupts schema reading.","Ensure a stable cluster/job configuration to avoid spurious rebalances during large snapshots."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    runSnapshot();\n} catch (InterruptedException e) {\n    if (e.getMessage().contains(\"Interrupted while emitting initial DROP TABLE events\")) {\n        // expected cancellation: job was stopped mid-snapshot; safe to restart,\n        // the snapshot resumes from the last committed offset.\n        log.info(\"Snapshot cancelled by stop signal; will resume on restart.\");\n    } else {\n        Thread.currentThread().interrupt();\n        throw e;\n    }\n}","preventionTips":["Avoid cancelling/restarting the job during large snapshots; schedule stops between snapshot phases.","Monitor source context state changes if embedding the connector programmatically.","Reduce snapshot duration (table filtering, parallelism) so restarts are cheap.","Treat this exception as benign cancellation; alert on it only if no stop was requested."],"tags":["mysql","cdc","snapshot","interruption","cancellation"],"backgroundTag":"operation-interrupted","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}