无法连接到主服务器。
你的应用在使用XA(分布式)事务时遇到了资源管理器失败的问题:
'pdo_code' => 'XAER_RMFAIL',
'db_code' => 1613,
'db_error' => 'The command cannot be executed when global transaction is in the XAER_RMFAIL state'
$pdo->query("XA RECOVER");
function recoverXATransactions($pdo) {
$stmt = $pdo->query("XA RECOVER");
$xaTransactions = $stmt->fetchAll(PDO::FETCH_ASSOC);
foreach ($xaTransactions as $xa) {
$xid = $xa['formatID'] . ',' . $xa['gtrid_length'] . ',' . $xa['bqual_length'];
if ($xa['state'] == 'PREPARED') {
error_log("发现未完成的XA事务: " . $xid);
} elseif ($xa['state'] == 'ACTIVE') {
$pdo->exec("XA ROLLBACK ' . $xid . "'");
error_log("已回滚XA事务: " . $xid);
}
}
}
recoverXATransactions($pdo);