{"record":{"id":"6c64eb530cf96168","repo":"apache/seatunnel","slug":"thread-interrupted-6c64eb","errorCode":null,"errorMessage":"Thread interrupted","messagePattern":"Thread interrupted","errorType":"exception","errorClass":"InterruptedException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java","lineNumber":185,"sourceCode":"                            \"SELECT %s FROM %s\",\n                            quoteIdentifier(columnName), tableIdentifier(table.getTablePath()));\n        }\n\n        try (Statement stmt =\n                connection.createStatement(\n                        ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)) {\n            stmt.setFetchSize(Integer.MIN_VALUE);\n            try (ResultSet rs = stmt.executeQuery(sampleQuery)) {\n                int count = 0;\n                List<Object> results = new ArrayList<>();\n\n                while (rs.next()) {\n                    count++;\n                    if (count % samplingRate == 0) {\n                        results.add(rs.getObject(1));\n                    }\n                    if (Thread.currentThread().isInterrupted()) {\n                        throw new InterruptedException(\"Thread interrupted\");\n                    }\n                }\n                Object[] resultsArray = results.toArray();\n                Arrays.sort(resultsArray);\n                return resultsArray;\n            }\n        }\n    }\n\n    @Override\n    public Long approximateRowCntStatement(Connection connection, JdbcSourceTable table)\n            throws SQLException {\n\n        // 1. If no query is configured, use TABLE STATUS.\n        // 2. If a query is configured but does not contain a WHERE clause and tablePath is\n        // configured , use TABLE STATUS.\n        // 3. If a query is configured with a WHERE clause, or a query statement is configured but\n        // tablePath is TablePath.DEFAULT, use COUNT(*).","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/oceanbase/OceanBaseMysqlDialect.java#L167-L203","documentation":"OceanBaseMysqlDialect.sampleDataFromColumn iterates sampled column values and throws InterruptedException as soon as the worker thread's interrupt flag is set, aborting split-boundary sampling for cooperative cancellation. Like its MySQL counterpart, this is an expected cancellation signal rather than a data/query failure.","triggerScenarios":"The sampling ResultSet loop in sampleDataFromColumn observes Thread.currentThread().isInterrupted() — raised when SeaTunnel cancels/interrupts the task during job stop, failover, or shutdown while enumerating splits on an OceanBase (MySQL-mode) table.","commonSituations":"Cancelling a job mid split-enumeration on large OceanBase tables; checkpoint timeout triggering task interruption; application shutdown interrupting worker threads.","solutions":["Ignore if it coincides with an intentional job cancel/stop.","Hunt for upstream code swallowing InterruptedException without restoring the interrupt flag if it appears spuriously.","Increase samplingRate or bound the sample query to make interruption fast and reduce cancellation races.","In wrapping code, re-interrupt the thread and propagate instead of silently retrying."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { dialect.sampleDataFromColumn(...); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new RuntimeException(\"Sampling interrupted\", e); }","preventionTips":["Treat interruption during split sampling as expected cancellation","Restore interrupt status when catching InterruptedException","Keep sample queries bounded to reduce cancellation latency"],"tags":["jdbc","oceanbase","interruption","cancellation"],"backgroundTag":"thread-interrupted","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"}