apache/seatunnel · warning · CatalogException

Truncate table interrupted

Error message

Truncate table interrupted

What it means

Thrown by BigQueryCatalog.truncateTable when bigquery.query(queryConfig) throws InterruptedException while running the TRUNCATE TABLE statement. The thread's interrupt flag is restored before wrapping the interruption in a CatalogException. It signals the truncate job was cancelled because the thread was interrupted (e.g. job cancellation or shutdown), not a BigQuery data error.

Source

Thrown at seatunnel-connectors-v2/connector-bigquery/src/main/java/org/apache/seatunnel/connectors/bigquery/catalog/BigQueryCatalog.java:374

    public void truncateTable(TablePath tablePath, boolean ignoreIfNotExists)
            throws TableNotExistException, CatalogException {
        if (!tableExists(tablePath)) {
            if (ignoreIfNotExists) {
                return;
            }
            throw new TableNotExistException(catalogName, tablePath);
        }
        String query =
                String.format(
                        "TRUNCATE TABLE `%s.%s` ;",
                        getDatasetName(tablePath), tablePath.getTableName());
        QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query).build();
        try {
            bigquery.query(queryConfig);
            log.info("BigQuery Table '{}' truncated successfully.", tablePath.getFullName());
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new CatalogException("Truncate table interrupted", e);
        } catch (Exception e) {
            throw new CatalogException(
                    "Failed to truncate BigQuery table: " + tablePath.getFullName(), e);
        }
    }

    @Override
    public boolean isExistsData(TablePath tablePath) {
        if (!tableExists(tablePath)) {
            return false;
        }
        String query =
                String.format(
                        "SELECT 1 FROM `%s.%s` LIMIT 1 ;",
                        getDatasetName(tablePath), tablePath.getTableName());
        QueryJobConfiguration queryConfig = QueryJobConfiguration.newBuilder(query).build();
        try {
            return bigquery.query(queryConfig).iterateAll().iterator().hasNext();

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify whether the interruption was an intentional cancellation (job stop) — if so, no code fix is needed
  2. Re-run the job if the truncate must complete; the truncate may or may not have been applied, so check table state in BigQuery
  3. Avoid long blocking work in threads that can be interrupted, or handle InterruptedException at a higher level instead of retrying blindly
Defensive patterns

Strategy: try-catch

Try / catch

try {
    catalog.truncateTable(tablePath, false);
} catch (CatalogException e) {
    if (Thread.currentThread().isInterrupted()) {
        LOG.warn("Truncate cancelled due to interruption");
        return; // job is being cancelled
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling truncateTable when the thread is interrupted while synchronously waiting for the BigQuery TRUNCATE TABLE query job to complete — typically during SeaTunnel job cancellation, engine shutdown, or a deadline watchdog interrupting the task thread.

Common situations: User cancels a running SeaTunnel job that triggers save-mode truncate; Zeta engine task termination during checkpoint/stop; executor shutdown mid-catalog operation.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


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