[MDEV-6067] Partitioned table DML sometimes binlogged without XID event Created: 2014-04-10  Updated: 2014-04-11  Resolved: 2014-04-11

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Kristian Nielsen Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6020 Slave SQL: "Deadlock found when tryin... Closed

 Description   

Note in the output below that the last INSERT in the binlog has a COMMIT query
event at the end, not a XID event. This is wrong, for one it could cause
failure to crash recover the binlog with InnoDB.

Test case:

--source include/have_innodb.inc
--source include/have_partition.inc
--let $rpl_topology=1->2
--source include/rpl_init.inc
 
--connection server_2
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
--source include/start_slave.inc
 
--connection server_1
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
PARTITION BY KEY (a) PARTITIONS 2;
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,2), (3,8);
INSERT INTO t1 VALUES (4,16);
--save_master_pos
 
--connection server_2
--sync_with_master
SELECT * FROM t1 ORDER BY a;
 
--connection server_1
SHOW BINLOG EVENTS;
 
--connection server_2
--source include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc
 
--connection server_1
DROP TABLE t1;
 
--source include/rpl_end.inc

Output:

include/rpl_init.inc [topology=1->2]
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
PARTITION BY KEY (a) PARTITIONS 2;
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,2), (3,8);
INSERT INTO t1 VALUES (4,16);
SELECT * FROM t1 ORDER BY a;
a b
1 1
2 2
3 8
4 16
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 248 Server ver: 10.0.11-MariaDB-debug-log, Binlog ver: 4
master-bin.000001 248 Gtid_list 1 273 []
master-bin.000001 273 Binlog_checkpoint 1 313 master-bin.000001
master-bin.000001 313 Gtid 1 351 GTID 0-1-1
master-bin.000001 351 Query 1 504 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB
PARTITION BY KEY (a) PARTITIONS 2
master-bin.000001 504 Gtid 1 542 BEGIN GTID 0-1-2
master-bin.000001 542 Query 1 632 use `test`; INSERT INTO t1 VALUES (1,1)
master-bin.000001 632 Xid 1 659 COMMIT /* xid=108 */
master-bin.000001 659 Gtid 1 697 BEGIN GTID 0-1-3
master-bin.000001 697 Query 1 794 use `test`; INSERT INTO t1 VALUES (2,2), (3,8)
master-bin.000001 794 Xid 1 821 COMMIT /* xid=109 */
master-bin.000001 821 Gtid 1 859 BEGIN GTID 0-1-4
master-bin.000001 859 Query 1 950 use `test`; INSERT INTO t1 VALUES (4,16)
master-bin.000001 950 Query 1 1019 COMMIT
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
DROP TABLE t1;
include/rpl_end.inc
rpl.rpl_mdev6020 'innodb_plugin,mix' [ pass ] 1782



 Comments   
Comment by Kristian Nielsen [ 2014-04-10 ]

Reverting this patch fixes the problem (thanks to Serg for that find):

revno: 2502.163.19
revision-id: monty@askmonty.org-20100325133339-7mkel6valai0b4lb
parent: sergii@pisem.net-20100323092233-t2gwaclx94hd6exa
committer: Michael Widenius <monty@askmonty.org>
branch nick: maria-5.2
timestamp: Thu 2010-03-25 15:33:39 +0200
message:
simple speed & space optimization:

  • Avoid full inline of mark_trx_read_write() for many functions
  • Avoid somewhat expensive tests for every write/update/delete row
Comment by Kristian Nielsen [ 2014-04-11 ]

Pushed to 5.2, merged to 5.3 and 5.5. Will be later merged to 10.0

Generated at Thu Feb 08 07:09:07 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.