apache/seatunnel · error · IotdbConnectorException
CommonErrorCodeDeprecated.FLUSH_DATA_FAILED
CommonErrorCodeDeprecated.FLUSH_DATA_FAILED
Error message
Writing records to IoTDB failed.
What it means
The IoTDB sink writer failed to insert batched records into Apache IoTDB. IoTDBSinkClient.flush() retries insertTablet/insertAlignedTablet calls on IoTDBConnectionException or StatementExecutionException; after exhausting sinkConfig.maxRetries it wraps the last exception in IotdbConnectorException with FLUSH_DATA_FAILED. This aborts the write so the engine can fail/restart the task rather than silently lose records.
Source
Thrown at seatunnel-connectors-v2/connector-iotdb/src/main/java/org/apache/seatunnel/connectors/seatunnel/iotdb/sink/IoTDBSinkClient.java:144
try {
if (batchRecords.getTypesList().isEmpty()) {
session.insertRecords(
batchRecords.getDeviceIds(),
batchRecords.getTimestamps(),
batchRecords.getMeasurementsList(),
batchRecords.getStringValuesList());
} else {
session.insertRecords(
batchRecords.getDeviceIds(),
batchRecords.getTimestamps(),
batchRecords.getMeasurementsList(),
batchRecords.getTypesList(),
batchRecords.getValuesList());
}
} 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
- Verify IoTDB connectivity (host, port, user, password, rpc_port) with a quick session test from the SeaTunnel node.
- Increase sink maxRetries / retry backoff options so transient outages are survived.
- Check IoTDB server logs for the underlying StatementExecutionException cause and fix the offending SQL/tablet schema.
- Ensure the IoTDB cluster is up and network/firewall allows the connection; restart stale sessions.
- Upgrade/check connector and IoTDB client versions for compatibility.
Example fix
// before
sink {
IoTDB {
node_urls = "localhost:6667"
}
}
// after
sink {
IoTDB {
node_urls = "iotdb-host:6667"
username = "root"
password = "root"
max_retries = 10
retry_backoff_multiplier_ms = 500
max_retry_backoff_ms = 10000
}
} Defensive patterns
Strategy: retry
Validate before calling
try (var session = new Session.Builder().host(nodes[0].split(":")[0]).port(Integer.parseInt(nodes[0].split(":")[1])).username(user).password(pass).build()) { session.open(false); session.close(); } Try / catch
catch (IotdbConnectorException e) { if (e.getErrorCode() == CommonErrorCodeDeprecated.FLUSH_DATA_FAILED) { /* alert, checkpoint-restart, or fail job */ } } Prevention
- Validate IoTDB host/port/credentials with a test session before job launch
- Set generous maxRetries and backoff options for transient outages
- Monitor IoTDB server health and load
- Keep connector and IoTDB client versions compatible
When it happens
Trigger: session.executeBatchStatement/insert call throws IoTDBConnectionException or StatementExecutionException on every attempt and the loop index reaches sinkConfig.getMaxRetries(); called from write() (buffer full) or close().
Common situations: IoTDB host/port wrong or node down; session expired or dropped by server idle timeout; wrong username/password; SQL/tablet schema mismatch (bad measurement types or unsupported SQL); IoTDB under heavy load causing timeouts.
Related errors
- FLUSH_DATA_FAILED
- FLUSH_DATA_FAILED
- IotdbConnectorErrorCode.INITIALIZE_CLIENT_FAILED
- IotdbConnectorErrorCode.CLOSE_CLIENT_FAILED
- SEND_RECORD_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e9aa2bbc2dbf212c.
Report an issue: GitHub.