apache/seatunnel · error · ClickhouseConnectorException
COMMON_FLUSH_DATA_FAILED
COMMON_FLUSH_DATA_FAILED
Error message
Clickhouse execute batch statement error
What it means
ClickhouseSinkWriter.flush wraps any exception from executing the accumulated JDBC batch against ClickHouse (network issues, SQL/schema mismatch, duplicate keys, server errors) into a ClickhouseConnectorException, failing the write.
Source
Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/client/ClickhouseSinkWriter.java:134
flush();
}
private void addIntoBatch(SeaTunnelRow row, JdbcBatchStatementExecutor clickHouseStatement) {
try {
clickHouseStatement.addToBatch(row);
} catch (SQLException e) {
throw new ClickhouseConnectorException(
CommonErrorCodeDeprecated.SQL_OPERATION_FAILED,
"Add row data into batch error",
e);
}
}
private void flush(JdbcBatchStatementExecutor clickHouseStatement) {
try {
clickHouseStatement.executeBatch();
} catch (Exception e) {
throw new ClickhouseConnectorException(
CommonErrorCodeDeprecated.FLUSH_DATA_FAILED,
"Clickhouse execute batch statement error",
e);
}
}
private void flush() {
for (ClickhouseBatchStatement batchStatement : statementMap.values()) {
try (ClickHouseConnectionImpl needClosedConnection =
batchStatement.getClickHouseConnection();
JdbcBatchStatementExecutor needClosedStatement =
batchStatement.getJdbcBatchStatementExecutor()) {
IntHolder intHolder = batchStatement.getIntHolder();
if (intHolder.getValue() > 0) {
flush(needClosedStatement);
intHolder.setValue(0);
}
} catch (SQLException e) {View on GitHub (pinned to cf67b549a7)
Solutions
- Read the wrapped cause exception for the server-side error message
- Increase batch_size / flush interval to reduce 'Too many parts' pressure
- Increase ClickHouse max_insert_block_size/memory limits or reduce writer parallelism
- Verify connectivity and table write permissions; enable retry for transient failures
Defensive patterns
Strategy: retry
Try / catch
try { writer.flush(); } catch (ClickhouseConnectorException e) {
if (e.getCode().equals(CommonErrorCodeDeprecated.FLUSH_DATA_FAILED)) {
Throwable cause = e.getCause(); // inspect server error, then retry with backoff
}
} Prevention
- Tune batch_size/flush interval to avoid ClickHouse 'Too many parts'
- Monitor ClickHouse memory limits and insert block sizes
- Ensure stable connectivity and idempotent/retryable sink behavior
When it happens
Trigger: executeBatch fails during flush() called from write(), flushPendingStatements, or checkpoint flush: syntax errors in generated INSERT, server-side rejection (too many parts, memory limit, dedup conflicts), or connection loss.
Common situations: ClickHouse 'Too many parts' from frequent small flushes, 'Memory limit exceeded' on large batches, table is read-only, or network interruption to the ClickHouse server.
Related errors
- COMMON_SQL_OPERATION_FAILED
- Flush data into clickhouse file error
- clickhouse local file not exists
- Failed to execute query: %s
- FLUSH_DATA_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/66a52d11adb8bbde.
Report an issue: GitHub.