apache/seatunnel · error · IotdbConnectorException

FLUSH_DATA_FAILED

FLUSH_DATA_FAILED

Error message

Writing records to IoTDB failed.

What it means

Thrown by flush() when inserting the Tablet into IoTDB fails on every retry attempt (IoTDBConnectionException or StatementExecutionException) up to sinkConfig.getMaxRetries(). All buffered records for the batch are effectively lost for this attempt; in streaming mode this typically fails the writer/task. The final exception carries the last underlying cause.

Source

Thrown at seatunnel-connectors-v2/connector-iotdb-v2/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdbv2/sink/relational/IoTDBv2RelationalSinkClient.java:226

    }

    synchronized void flush() {
        checkFlushException();
        if (batchList.isEmpty()) {
            return;
        }

        int maxRetries = sinkConfig.getMaxRetries();
        for (int i = 0; i <= maxRetries; i++) {
            try {
                for (Tablet tablet : batchList) {
                    tableSession.insert(tablet);
                }
                break;
            } catch (IoTDBConnectionException | StatementExecutionException e) {
                log.error("Writing records to IoTDB failed, retry times = {}", i, e);
                if (i >= sinkConfig.getMaxRetries()) {
                    throw new IotdbConnectorException(
                            CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,
                            "Writing records to IoTDB failed.",
                            e);
                }
                try {
                    long backoff =
                            Math.min(
                                    sinkConfig.getRetryBackoffMultiplierMs() * i,
                                    sinkConfig.getMaxRetryBackoffMs());
                    Thread.sleep(backoff);
                } catch (InterruptedException ex) {
                    Thread.currentThread().interrupt();
                    throw new IotdbConnectorException(
                            CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,
                            "Unable to flush; interrupted while doing another attempt.",
                            e);
                }
            }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the wrapped cause: IoTDBConnectionException => connectivity; StatementExecutionException => SQL/schema issue, fix accordingly
  2. Increase max_retries and retry backoff settings in sink config to tolerate transient outages
  3. Verify the target table schema matches the records being written (column names/types)
  4. Reduce batch size if inserts are rejected for size reasons
  5. Ensure IoTDB capacity: check server logs for throttle/reject messages and disk space

Example fix

// before
sink {
  IoTDB-v2 {
    max_retries = 3
  }
}
// after
sink {
  IoTDB-v2 {
    max_retries = 10
    retry_backoff_multiplier_ms = 200
    max_retry_backoff_ms = 60000
  }
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-check connectivity and target table existence
boolean ok = ncProbe(iotdbHost, 6667) && sessionExistsTable(database, tableName);

Try / catch

try {
    client.flush();
} catch (IotdbConnectorException e) {
    if (e.getCause() instanceof StatementExecutionException) {
        // fix schema/SQL problem; retries won't help
    } else if (e.getCause() instanceof IoTDBConnectionException) {
        // wait for recovery then retrigger / rely on checkpoint restart
    }
    throw e;
}

Prevention

When it happens

Trigger: tableSession.insert(tablet) repeatedly fails: database/table dropped or schema conflicts, statement exceeds size limits, type mismatch on column values, server overload, or connection lost and stays lost for all retries.

Common situations: IoTDB restarted or under heavy load during the job; table schema changed (column added/renamed) mid-run causing StatementExecutionException; batch too large hitting max_insert size; network partition between worker and IoTDB longer than the retry window.

Related errors


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