summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2014-03-07 12:02:09 +0100
committerunknown <knielsen@knielsen-hq.org>2014-03-07 12:02:09 +0100
commit2aa619ec68ae2aed567433ae37905eb7fe58fb70 (patch)
tree946ed1bcc07b2ec1ab6a19e03dd9afe167238387 /mysql-test/suite/rpl
parentfe3c68b38df1a9bd52fc27b9b05eb200d9e8bfc9 (diff)
downloadmariadb-git-2aa619ec68ae2aed567433ae37905eb7fe58fb70.tar.gz
MDEV-5788: Incorrect free of rgi->deferred_events in parallel replication
When an rpl_group_info object was returned from the free list, the rgi->deferred_events_collecting and rgi->deferred_events was not correctly re-inited. Additionally, the rgi->deferred_events was incorrectly freed in free_rgi(), which causes unnecessary malloc/free (or crash when re-init is not done). Thanks to user nanyi607rao, who reported this bug on maria-developers@.
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel.result20
-rw-r--r--mysql-test/suite/rpl/t/rpl_parallel.test41
2 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result
index b04d9e7748e..fc4c3a3787e 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel.result
@@ -706,6 +706,26 @@ SET GLOBAL binlog_format=@old_format;
SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc
+*** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication ***
+include/stop_slave.inc
+SET GLOBAL replicate_ignore_table="test.t3";
+SET GLOBAL slave_parallel_threads=2;
+include/start_slave.inc
+INSERT INTO t3 VALUES (100, rand());
+INSERT INTO t3 VALUES (101, rand());
+INSERT INTO t3 VALUES (102, rand());
+INSERT INTO t3 VALUES (103, rand());
+INSERT INTO t3 VALUES (104, rand());
+INSERT INTO t3 VALUES (105, rand());
+include/stop_slave.inc
+SET GLOBAL replicate_ignore_table="";
+include/start_slave.inc
+INSERT INTO t3 VALUES (106, rand());
+INSERT INTO t3 VALUES (107, rand());
+SELECT * FROM t3 WHERE a >= 100 ORDER BY a;
+a b
+106 #
+107 #
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_parallel.test b/mysql-test/suite/rpl/t/rpl_parallel.test
index 0a064e7a227..a8884143c4d 100644
--- a/mysql-test/suite/rpl/t/rpl_parallel.test
+++ b/mysql-test/suite/rpl/t/rpl_parallel.test
@@ -1069,6 +1069,47 @@ SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10;
--source include/start_slave.inc
+--echo *** MDEV-5788 Incorrect free of rgi->deferred_events in parallel replication ***
+
+--connection server_2
+# Use just two worker threads, so we are sure to get the rpl_group_info added
+# to the free list, which is what triggered the bug.
+--source include/stop_slave.inc
+SET GLOBAL replicate_ignore_table="test.t3";
+SET GLOBAL slave_parallel_threads=2;
+--source include/start_slave.inc
+
+--connection server_1
+INSERT INTO t3 VALUES (100, rand());
+INSERT INTO t3 VALUES (101, rand());
+
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+
+--connection server_1
+INSERT INTO t3 VALUES (102, rand());
+INSERT INTO t3 VALUES (103, rand());
+INSERT INTO t3 VALUES (104, rand());
+INSERT INTO t3 VALUES (105, rand());
+
+--connection server_2
+--sync_with_master
+--source include/stop_slave.inc
+SET GLOBAL replicate_ignore_table="";
+--source include/start_slave.inc
+
+--connection server_1
+INSERT INTO t3 VALUES (106, rand());
+INSERT INTO t3 VALUES (107, rand());
+--save_master_pos
+
+--connection server_2
+--sync_with_master
+--replace_column 2 #
+SELECT * FROM t3 WHERE a >= 100 ORDER BY a;
+
--connection server_2
--source include/stop_slave.inc