{"record":{"id":"b45ef50ec398c2a1","repo":"apache/seatunnel","slug":"xa-operation-failed-b45ef5","errorCode":"XA_OPERATION_FAILED","errorMessage":"rollback failed","messagePattern":"rollback failed","errorType":"error_code","errorClass":"JdbcConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkCommitter.java","lineNumber":69,"sourceCode":"        }\n    }\n\n    @Override\n    public List<XidInfo> commit(List<XidInfo> committables) {\n        return xaGroupOps\n                .commit(\n                        new ArrayList<>(committables),\n                        false,\n                        jdbcConnectionConfig.getMaxCommitAttempts())\n                .getForRetry();\n    }\n\n    @Override\n    public void abort(List<XidInfo> commitInfos) {\n        try {\n            xaGroupOps.rollback(commitInfos);\n        } catch (Exception e) {\n            throw new JdbcConnectorException(\n                    JdbcConnectorErrorCode.XA_OPERATION_FAILED, \"rollback failed\", e);\n        }\n    }\n}\n","sourceCodeStart":51,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/sink/JdbcSinkCommitter.java#L51-L74","documentation":"JdbcSinkCommitter.abort rolls back the list of XA transactions (XidInfo) via XaGroupOps.rollback; any exception is rethrown as XA_OPERATION_FAILED with message 'rollback failed'. This means in-doubt XA transactions prepared by the sink could not be rolled back and may remain pending in the database.","triggerScenarios":"abort() is invoked when a checkpoint fails or the job is terminated with exactly-once enabled (is_exactly_once=true), and xaGroupOps.rollback throws — e.g. connection lost mid-rollback, XAER_RMERR from the database, or transactions already resolved elsewhere.","commonSituations":"Database connection dropped after a prepared transaction; DBA manually committed/rolled back in-doubt transactions concurrently; XA timeout on the database side; cluster crash during abort.","solutions":["Inspect in-doubt transactions on the database (e.g. Oracle DBA_2PC_PENDING, MySQL XA RECOVER) and resolve them manually (XA COMMIT/ROLLBACK)","Check the wrapped cause for the XA error code to determine whether the connection or the transaction was at fault","Verify connectivity/credentials during failure recovery and re-run the job to trigger XA recovery (recoverCheckpointTransactions)","If transactions were already resolved, this error is benign residue — clean up pending XA entries to stop recurrence"],"exampleFix":"// DB-side cleanup example (MySQL)\n// before: in-doubt xids left pending\nXA RECOVER;\n// after\nXA ROLLBACK 'xid_bytes_from_xa_recover';","handlingStrategy":"try-catch","validationCode":"// before running exactly-once jobs, ensure no pending transactions\n// MySQL: XA RECOVER;  Oracle: SELECT * FROM DBA_2PC_PENDING;","typeGuard":null,"tryCatchPattern":"try {\n  committer.abort(xids);\n} catch (JdbcConnectorException e) {\n  logger.error(\"XA rollback failed; check in-doubt transactions on the DB\", e);\n  // alert operator to manually resolve pending XA transactions\n}","preventionTips":["Periodically check for in-doubt XA transactions on the database","Ensure stable network between SeaTunnel workers and the database during commit/abort","Do not hard-kill workers mid-checkpoint with exactly-once enabled","Grant the job user privileges to inspect/resolve XA transactions"],"tags":["jdbc","xa","rollback","exactly-once"],"backgroundTag":"database-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}