apache/seatunnel · error · JdbcConnectorException
TRANSACTION_OPERATION_FAILED
TRANSACTION_OPERATION_FAILED
Error message
commit failed,
What it means
JdbcSinkWriter.prepareCommitInternal flushes buffered rows and commits the current transaction (when auto-commit is off / XA is in use). If Connection.commit() (or the internal commitIfNeeded path) throws a SQLException, the writer wraps it in JdbcConnectorException with code TRANSACTION_OPERATION_FAILED. The job's checkpoint fails and the writer will be recovered/restored by the engine.
Solutions
- Inspect the wrapped SQLException (cause chain) to identify the root cause (timeout, deadlock, connection reset).
- Enable connection validation/keepalive and adjust database-side timeouts (wait_timeout, lock_wait_timeout).
- Retry the job/checkpoint; the engine restores the writer from the last successful checkpoint so committed data is not duplicated.
- Verify XA configuration on the database (e.g. PostgreSQL max_prepared_transactions > 0).
Defensive patterns
Strategy: retry
Validate before calling
// before prepareCommit: verify connection liveness
if (!connection.isValid(5)) { reconnect(); } Try / catch
try {
writer.prepareCommit();
} catch (JdbcConnectorException e) {
if (e.getSeatunnelCode() == JdbcConnectorErrorCode.TRANSACTION_OPERATION_FAILED) {
// inspect SQLException cause; rely on checkpoint restart
}
} Prevention
- Tune DB wait_timeout and firewall idle timeouts above checkpoint interval
- Enable connection validation on borrow
- Monitor for deadlocks and lock-wait timeouts on target tables
- Ensure XA is properly configured (max_prepared_transactions on PostgreSQL)
When it happens
Trigger: Calling prepareCommit during checkpoint; commitIfNeeded issues a JDBC commit and the underlying driver rejects it — connection lost, transaction aborted by the server, lock timeout, XA protocol error, or network interruption.
Common situations: Database connection dropped mid-checkpoint (wait_timeout, firewall idle kill); deadlocks or lock-wait timeouts on the target table; server-side max_prepared_transaction limits on PostgreSQL; network partition between SeaTunnel worker and the DB.
Related errors
- JDBC driver does not support savepoints. Row-error handling…
- failed to commit transactions out of (keep them to retry…
- Failed to finish the JDBC source read transaction. Closing…
- Failed to get the JDBC source connection from the current…
- formatErrorMessage(action, xid, errorCode, errorMessage)
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/bd21b16ef54c1f0a.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkWriter.java:322
reportWriteSuccess(batchRows);
} catch (Throwable e) {
if (!isRowLevelDataError(e)) {
throwAsIoException(e);
}
handleRowLevelBatchFailure(
RowErrorPhase.PREPARE_COMMIT, checkpointId, batchRows, e);
}
}
return Optional.empty();
}
tryOpen();
outputFormat.checkFlushException();
outputFormat.flush();
try {
commitIfNeeded();
} catch (SQLException e) {
throw new JdbcConnectorException(
JdbcConnectorErrorCode.TRANSACTION_OPERATION_FAILED,
"commit failed," + e.getMessage(),
e);
}
return Optional.empty();
}
@Override
public void abortPrepare() {}
@Override
public void close() throws IOException {
if (rowErrorCollector.isPresent()) {
synchronized (batchLock) {
tryOpen();
List<SeaTunnelRow> batchRows = swapPendingRowsLocked();
try {
outputFormat.flush();View on GitHub (pinned to cf67b549a7)