Details
Description
On slave , Non-super users can able to execute XA COMMIT/XA ROLLBACK.
slave fails to return an error in read-only mode. It causes the slave to break replication when gtid_strict_mode is enabled.
On Master:
MariaDB [test]> select @@read_only;
|
+-------------+
|
| @@read_only |
|
+-------------+
|
| 0 |
|
+-------------+
|
1 row in set (0.000 sec)
|
MariaDB [test]> XA START 'MyXA';
|
Query OK, 0 rows affected (0.001 sec)
|
|
MariaDB [test]> INSERT INTO test.t1 VALUES(1);
|
Query OK, 1 row affected (0.001 sec)
|
|
MariaDB [test]> XA END 'MyXA';
|
Query OK, 0 rows affected (0.000 sec)
|
|
MariaDB [test]> XA PREPARE 'MyXA';
|
Query OK, 0 rows affected (0.003 sec)
|
On slave:
MariaDB [(none)]> select @@read_only;
|
+-------------+
|
| @@read_only |
|
+-------------+
|
| 1 |
|
+-------------+
|
1 row in set (0.001 sec)
|
|
MariaDB [test]> show grants;
|
+---------------------------------------------------------------------------------------------------------+
|
| Grants for app_user@% |
|
+---------------------------------------------------------------------------------------------------------+
|
| GRANT USAGE ON *.* TO "app_user"@"%" IDENTIFIED BY PASSWORD '*8232A1298A49F710DBEE0B330C42EEC825D4190A' |
|
| GRANT SELECT, INSERT, UPDATE, DELETE ON "test".* TO "app_user"@"%" |
|
+---------------------------------------------------------------------------------------------------------+
|
2 rows in set (0.001 sec)
|
|
MariaDB [(none)]> XA COMMIT 'MyXA';
|
Query OK, 0 rows affected (0.004 sec)
|
|
on Slave:
|
MariaDB [test]> select @@read_only;
|
+-------------+
|
| @@read_only |
|
+-------------+
|
| 1 |
|
+-------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [test]> show grants;
|
+---------------------------------------------------------------------------------------------------------+
|
| Grants for app_user@% |
|
+---------------------------------------------------------------------------------------------------------+
|
| GRANT USAGE ON *.* TO "app_user"@"%" IDENTIFIED BY PASSWORD '*8232A1298A49F710DBEE0B330C42EEC825D4190A' |
|
| GRANT SELECT, INSERT, UPDATE, DELETE ON "test".* TO "app_user"@"%" |
|
+---------------------------------------------------------------------------------------------------------+
|
2 rows in set (0.001 sec)
|
|
MariaDB [test]> XA ROLLBACK 'MyXA';
|
Query OK, 0 rows affected (0.005 sec)
|
|