Blackhole engine tables apparently replicated in transactions with Innodb when other unsupported types are not
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
MySQL patches by Codership |
Won't Fix
|
Undecided
|
Seppo Jaakola | |||
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC | Status tracked in 5.6 | |||||
5.5 |
Won't Fix
|
High
|
Unassigned | |||
5.6 |
Confirmed
|
High
|
Unassigned |
Bug Description
TLDR;
If I have a transaction with:
begin; insert innodb; insert memory; insert blackhole; commit
I find that all nodes in my cluster with log-bin enabled will get the Innodb replication (expected) AND the blackhole insert (unexpected).
the MEMORY engine (and others I've tested: MyISAM and CSV) do not exhibit this behavior -- instead their statements appear first in the binlog and do not propagate to the other nodes in the cluster.
Details:
node1 mysql> show create table inno\G
*******
Table: inno
Create Table: CREATE TABLE `inno` (
`i` int(10) unsigned NOT NULL AUTO_INCREMENT,
`j` varchar(32) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
node1 mysql> show create table mem\G
*******
Table: mem
Create Table: CREATE TABLE `mem` (
`i` int(10) unsigned NOT NULL AUTO_INCREMENT,
`j` varchar(32) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
node1 mysql> show create table black\G
*******
Table: black
Create Table: CREATE TABLE `black` (
`i` int(10) unsigned NOT NULL AUTO_INCREMENT,
`j` varchar(32) NOT NULL,
PRIMARY KEY (`i`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
node1 mysql> begin;
Query OK, 0 rows affected (0.00 sec)
node1 mysql> insert into inno (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
node1 mysql> insert into mem (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
node1 mysql> insert into black (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
node1 mysql> commit;
Query OK, 0 rows affected (0.00 sec)
node1 mysql> select * from inno;
+---+----------+
| i | j |
+---+----------+
| 1 | aaaaaaaa |
+---+----------+
1 row in set (0.00 sec)
node1 mysql> select * from mem;
+---+----------+
| i | j |
+---+----------+
| 1 | aaaaaaaa |
+---+----------+
1 row in set (0.00 sec)
node2 mysql> select * from inno;
+---+----------+
| i | j |
+---+----------+
| 1 | aaaaaaaa |
+---+----------+
1 row in set (0.00 sec)
node2 mysql> select * from mem;
Empty set (0.00 sec)
node1 mysql> show master status;
+------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------
| node1-bin.000007 | 621 | | |
+------
1 row in set (0.00 sec)
node2 mysql> show master status;
+------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------
| node2-bin.000007 | 372 | | |
+------
1 row in set (0.00 sec)
[root@node1 ~]# mysqlbinlog --base64-
/*!50530 SET @@SESSION.
/*!40019 SET @@session.
/*!50003 SET @OLD_COMPLETION
DELIMITER /*!*/;
# at 4
#140324 15:14:31 server id 1 end_log_pos 107 Start: binlog v 4, server v 5.5.34-55-log created 140324 15:14:31
# Warning: this binlog is either in use or was not closed properly.
# at 107
#140324 15:15:50 server id 1 end_log_pos 180 Query thread_id=41 exec_time=0 error_code=0
SET TIMESTAMP=
SET @@session.
SET @@session.
SET @@session.
SET @@session.
/*!\C utf8 *//*!*/;
SET @@session.
SET @@session.
SET @@session.
BEGIN
/*!*/;
# at 180
# at 225
#140324 15:15:50 server id 1 end_log_pos 225 Table_map: `test`.`mem` mapped to number 50
#140324 15:15:50 server id 1 end_log_pos 268 Write_rows: table id 50 flags: STMT_END_F
### INSERT INTO test.mem
### SET
### @1=1
### @2='aaaaaaaa'
# at 268
#140324 15:15:50 server id 1 end_log_pos 342 Query thread_id=41 exec_time=0 error_code=0
SET TIMESTAMP=
COMMIT
/*!*/;
# at 342
#140324 15:16:39 server id 1 end_log_pos 415 Query thread_id=41 exec_time=0 error_code=0
SET TIMESTAMP=
BEGIN
/*!*/;
# at 415
# at 461
#140324 15:15:45 server id 1 end_log_pos 461 Table_map: `test`.`inno` mapped to number 48
#140324 15:15:45 server id 1 end_log_pos 504 Write_rows: table id 48 flags: STMT_END_F
### INSERT INTO test.inno
### SET
### @1=1
### @2='aaaaaaaa'
# at 504
# at 551
#140324 15:16:34 server id 1 end_log_pos 551 Table_map: `test`.`black` mapped to number 49
#140324 15:16:34 server id 1 end_log_pos 594 Write_rows: table id 49 flags: STMT_END_F
### INSERT INTO test.black
### SET
### @1=1
### @2='aaaaaaaa'
# at 594
#140324 15:16:39 server id 1 end_log_pos 621 Xid = 31
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_
/*!50530 SET @@SESSION.
[root@node2 ~]# mysqlbinlog --base64-
/*!50530 SET @@SESSION.
/*!40019 SET @@session.
/*!50003 SET @OLD_COMPLETION
DELIMITER /*!*/;
# at 4
#140324 15:14:31 server id 1 end_log_pos 107 Start: binlog v 4, server v 5.5.34-55-log created 140324 15:14:31
# Warning: this binlog is either in use or was not closed properly.
# at 107
#140324 15:16:34 server id 1 end_log_pos 166 Query thread_id=37 exec_time=5 error_code=0
SET TIMESTAMP=
SET @@session.
SET @@session.
SET @@session.
SET @@session.
/*!\C utf8 *//*!*/;
SET @@session.
SET @@session.
SET @@session.
BEGIN
/*!*/;
# at 166
# at 212
#140324 15:15:45 server id 1 end_log_pos 212 Table_map: `test`.`inno` mapped to number 48
#140324 15:15:45 server id 1 end_log_pos 255 Write_rows: table id 48 flags: STMT_END_F
### INSERT INTO test.inno
### SET
### @1=1
### @2='aaaaaaaa'
# at 255
# at 302
#140324 15:16:34 server id 1 end_log_pos 302 Table_map: `test`.`black` mapped to number 49
#140324 15:16:34 server id 1 end_log_pos 345 Write_rows: table id 49 flags: STMT_END_F
### INSERT INTO test.black
### SET
### @1=1
### @2='aaaaaaaa'
# at 345
#140324 15:16:34 server id 1 end_log_pos 372 Xid = 31
COMMIT/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_
/*!50530 SET @@SESSION.
Changed in codership-mysql: | |
assignee: | nobody → Seppo Jaakola (seppo-jaakola) |
status: | New → In Progress |
Changed in codership-mysql: | |
status: | In Progress → Won't Fix |
Verified above the same thing with PXC 5.6
On Node1:
mysql> CREATE TABLE `inno` (
-> `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
-> `j` varchar(32) NOT NULL,
-> PRIMARY KEY (`i`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.18 sec)
mysql> CREATE TABLE `mem` (
-> `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
-> `j` varchar(32) NOT NULL,
-> PRIMARY KEY (`i`)
-> ) ENGINE=MEMORY DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.05 sec)
mysql> CREATE TABLE `black` (
-> `i` int(10) unsigned NOT NULL AUTO_INCREMENT,
-> `j` varchar(32) NOT NULL,
-> PRIMARY KEY (`i`)
-> ) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql>
mysql> begin;
Query OK, 0 rows affected (0.00 sec)
mysql> insert into inno (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
mysql> insert into mem (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
mysql> insert into black (j) values ('aaaaaaaa' );
Query OK, 1 row affected (0.00 sec)
mysql> commit;
Query OK, 0 rows affected (0.03 sec)
mysql>
mysql> select * from inno;
+---+----------+
| i | j |
+---+----------+
| 1 | aaaaaaaa |
+---+----------+
1 row in set (0.00 sec)
mysql> select * from mem;
+---+----------+
| i | j |
+---+----------+
| 1 | aaaaaaaa |
+---+----------+
1 row in set (0.00 sec)
mysql> show master status; ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- + ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- + ------- -----+- ------- --+---- ------- ---+--- ------- ------- -+----- ------- ------- +
+------
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------
| mysql-bin.000001 | 1800 | | | |
+------
1 row in set (0.00 sec)
mysql> quit /var/log/ mysql# ll /var/log/ mysql# ls -al /var/log/ mysql# /var/log/ mysql# /var/log/ mysql# mysqlbinlog --base64- output= DECODE- ROWS --verbose mysql-bin.000001 PSEUDO_ SLAVE_MODE= 1*/; max_insert_ delayed_ threads= 0*/; _TYPE=@ @COMPLETION_ TYPE,COMPLETION _TYPE=0* /; 1407320156/ *!*/; pseudo_ thread_ id=4/*! */; foreign_ key_checks= 1, @@session. sql_auto_ is_null= 0, @@session. unique_ checks= 1, @@session. autocommit= 1/*!*/; sql_mode= 1073741824/ *!*/; auto_increment_ ...
Bye
root@debian:
-bash: ll: command not found
root@debian:
total 16
drwxr-s--- 2 mysql adm 4096 Aug 6 15:44 .
drwxr-xr-x 15 root root 4096 Jul 23 13:30 ..
-rw-rw---- 1 mysql adm 1800 Aug 6 15:47 mysql-bin.000001
-rw-rw---- 1 mysql adm 32 Aug 6 15:44 mysql-bin.index
root@debian:
root@debian:
root@debian:
/*!50530 SET @@SESSION.
/*!40019 SET @@session.
/*!50003 SET @OLD_COMPLETION
DELIMITER /*!*/;
# at 4
#140806 15:44:48 server id 1 end_log_pos 120 CRC32 0x1206506c Start: binlog v 4, server v 5.6.19-67.0-56-log created 140806 15:44:48 at startup
# Warning: this binlog is either in use or was not closed properly.
ROLLBACK/*!*/;
# at 120
#140806 15:45:56 server id 1 end_log_pos 214 CRC32 0xd5f0c018 Query thread_id=4 exec_time=0 error_code=0
use `nil`/*!*/;
SET TIMESTAMP=
SET @@session.
SET @@session.
SET @@session.
SET @@session.