mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-30978: On slave XA COMMIT/XA ROLLBACK fail to return an error in read-only mode
Where a read-only server permits writes through replication, it should not permit user connections to commit/rollback XA transactions prepared via replication. The bug reported in MDEV-30978 shows that this can happen. This is because there is no read only check in the XA transaction logic, the most relevant one occurs in ha_commit_trans() for normal statements/transactions. This patch extends the XA transaction logic to check the read only status of the server before performing an XA COMMIT or ROLLBACK. Reviewed By: Andrei Elkin <andrei.elkin@mariadb.com>
This commit is contained in:
@ -2787,6 +2787,16 @@ public:
|
||||
return m_binlog_filter_state;
|
||||
}
|
||||
|
||||
/**
|
||||
Checks if a user connection is read-only
|
||||
*/
|
||||
inline bool is_read_only_ctx()
|
||||
{
|
||||
return opt_readonly &&
|
||||
!(security_ctx->master_access & PRIV_IGNORE_READ_ONLY) &&
|
||||
!slave_thread;
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
Indicate if the current statement should be discarded
|
||||
|
Reference in New Issue
Block a user