mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
ac6026ce27
temp table This patch introduces two key changes in the replication's behavior. Firstly, it reverts part of BUG#51894 which puts any update to temporary tables into the trx-cache. Now, updates to temporary tables are handled according to the type of their engines as a regular table. Secondly, an unsafe mixed statement, (i.e. a statement that access transactional table as well non-transactional or temporary table, and writes to any of them), are written into the trx-cache in order to minimize errors in the execution when the statement logging format is in use. Such changes has a direct impact on which statements are classified as unsafe statements and thus part of BUG#53259 is reverted.
61 lines
2.6 KiB
Text
61 lines
2.6 KiB
Text
CREATE TABLE t1 (i int unique) ENGINE=innodb;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values (1),(2);
|
|
*** the following UPDATE query wont generate any updates for the binlog ***
|
|
update t1 set i = 3 where i < 3;
|
|
ERROR 23000: Duplicate entry '3' for key 'i'
|
|
commit;
|
|
*** Results of the test: the binlog must have only Write_rows events not any Update_rows ***
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # BEGIN
|
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
|
delete from t1;
|
|
reset master;
|
|
begin;
|
|
insert into t1 values (1),(2);
|
|
*** the following UPDATE query wont generate any updates for the binlog ***
|
|
insert into t1 values (3),(4),(1),(2);
|
|
ERROR 23000: Duplicate entry '1' for key 'i'
|
|
commit;
|
|
*** Results of the test: the binlog must have only one Write_rows event not two ***
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # BEGIN
|
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
|
drop table t1;
|
|
RESET MASTER;
|
|
CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
CREATE TEMPORARY TABLE IF NOT EXISTS t2 LIKE t1;
|
|
TRUNCATE TABLE t2;
|
|
DROP TABLE t1;
|
|
###############################################
|
|
### assertion: No event for 'TRUNCATE TABLE t2'
|
|
###############################################
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 ( c1 int , primary key (c1)) ENGINE=InnoDB
|
|
master-bin.000001 # Query # # BEGIN
|
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
|
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
|
master-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
|
###############################################
|
|
RESET MASTER;
|
|
CREATE TEMPORARY TABLE t1 (c1 int) Engine=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
TRUNCATE t1;
|
|
DROP TEMPORARY TABLE t1;
|
|
###############################################
|
|
### assertion: No event for 'TRUNCATE TABLE t1'
|
|
###############################################
|
|
show binlog events from <binlog_start>;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query # # use `test`; DROP TEMPORARY TABLE IF EXISTS `t1` /* generated by server */
|
|
###############################################
|