Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL)
Description
If "DROP TEMPORARY TABLE..." gets executed on server with GTID enabled and read_only mode enabled, then 'DROP /* TEMPORARY */ TABLE IF EXISTS `sometablename`' gets inserted in server binary log. This creates errant extra transaction on slave and breaks replication.
As temporary tables are never replicated with RBR format so might be good to disable binlogging of temporary tables.
mysql [localhost] {msandbox} (test) > SHOW CREATE PROCEDURE testproc\G
|
*************************** 1. row ***************************
|
Procedure: testproc
|
sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
|
Create Procedure: CREATE DEFINER=`root`@`localhost` PROCEDURE `testproc`()
|
BEGIN
|
DROP TEMPORARY TABLE IF EXISTS `t1_tmp`;
|
DROP TEMPORARY TABLE IF EXISTS `t2_tmp`;
|
|
CREATE TEMPORARY TABLE IF NOT EXISTS `t1_tmp` (
|
`t1` varchar(400) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
CREATE TEMPORARY TABLE IF NOT EXISTS `t2_tmp` (
|
`t2` varchar(16) NOT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
END
|
character_set_client: latin1
|
collation_connection: latin1_swedish_ci
|
Database Collation: latin1_swedish_ci
|
1 row in set (0.00 sec)
|
|
mysql [localhost] {msandbox} ((none)) > USE test;
|
Database changed
|
mysql [localhost] {msandbox} (test) > SET GLOBAL read_only=1;
|
Query OK, 0 rows affected (0.00 sec)
|
|
mysql [localhost] {msandbox} (test) > CALL testproc();
|
Query OK, 0 rows affected (0.02 sec)
|
|
|
mysql [localhost] {msandbox} (test) > SHOW BINLOG EVENTS;
|
|
+------+-------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Log_name | Pos | Event_type | Server_id | End_log_pos | Info |
|
+------------------+------+-------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| mysql-bin.000001 | 1167 | Query | 1 | 1306 | use `test`; DROP TEMPORARY TABLE IF EXISTS `t1_tmp` /* generated by server */ |
|
| mysql-bin.000001 | 1306 | Query | 1 | 1445 | use `test`; DROP TEMPORARY TABLE IF EXISTS `t2_tmp` /* generated by server */ |
|
| mysql-bin.000001 | 1445 | Query | 1 | 1648 | use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t1_tmp` (
|
`t1` varchar(400) DEFAULT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
|
| mysql-bin.000001 | 1648 | Query | 1 | 1843 | use `test`; CREATE TEMPORARY TABLE IF NOT EXISTS `t2_tmp` (
|
`t2` varchar(16) NOT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8
|
+------------------+------+-------------+-----------+-------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
Attachments
Issue Links
- causes
-
MDEV-21442 Changes to temporary tables are no longer logged
- Stalled
- duplicates
-
MDEV-20242 DROP TEMPORARY TABLE creates a transaction in binary log on read only server
- Closed
- relates to
-
MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged
- Closed