List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:November 15 2011 3:13pm
Subject:bzr push into mysql-trunk-cluster branch (magnus.blaudd:3412 to 3416)
View as plain text  
 3416 magnus.blaudd@stripped	2011-11-15
      ndbcluster
       - cherrypick warning fixes from trunk-cluster

    modified:
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster.h
 3415 magnus.blaudd@stripped	2011-11-15
      WL#5881
       - adapt the patch for slave_allow_batching from 5.5 to trunk

    modified:
      sql/sys_vars.cc
 3414 magnus.blaudd@stripped	2011-11-15
      WL#5881
       - Add HA_ flag for handler to use if it supports RBWR(from WL5906)
       - Use HA_RBWR flag to detect in slave thread if it can do
         the rbwr optimization.
       - Improve comments describing the optimization.
       - Remove MCP tags

    modified:
      sql/handler.h
      sql/log_event.cc
 3413 magnus.blaudd@stripped	2011-11-15
      WL#5881
       - cherrypick latest patch for slave_allow_batching from 5.5-cluster
       - remove MCP tags

    added:
      mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result
      mysql-test/suite/rpl/t/rpl_row_basic_allow_batching.test
    modified:
      sql/log_event.cc
      sql/sys_vars.cc
 3412 magnus.blaudd@stripped	2011-11-15
      WL#5881
       - remove remaining MCP tags for 52305(aka. 53205...)

    modified:
      sql/log_event.cc
      sql/log_event.h
      sql/rpl_slave.cc
      sql/sql_class.cc
      sql/sql_class.h
=== added file 'mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result'
--- a/mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_basic_allow_batching.result	2011-11-15 14:30:51 +0000
@@ -0,0 +1,648 @@
+include/master-slave.inc
+[connection master]
+show variables like 'slave_allow_batching';
+Variable_name	Value
+slave_allow_batching	OFF
+Show that slave_allow_batching cannot be changed while slave is running
+set global slave_allow_batching=ON;
+ERROR HY000: This operation cannot be performed with a running slave; run STOP SLAVE first
+show warnings;
+Level	Code	Message
+Error	1198	This operation cannot be performed with a running slave; run STOP SLAVE first
+show variables like 'slave_allow_batching';
+Variable_name	Value
+slave_allow_batching	OFF
+Now stop slave and change it
+stop slave;
+set global slave_allow_batching=ON;
+show variables like 'slave_allow_batching';
+Variable_name	Value
+slave_allow_batching	ON
+start slave;
+Now the normal test
+CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)) ENGINE = 'INNODB'  ;
+SELECT * FROM t1;
+C1	C2
+SELECT * FROM t1;
+C1	C2
+INSERT INTO t1 VALUES ('A','B'), ('X','Y'), ('X','X');
+INSERT INTO t1 VALUES ('A','C'), ('X','Z'), ('A','A');
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	A
+A	B
+A	C
+X	X
+X	Y
+X	Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	A
+A	B
+A	C
+X	X
+X	Y
+X	Z
+DELETE FROM t1 WHERE C1 = C2;
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	B
+A	C
+X	Y
+X	Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	B
+A	C
+X	Y
+X	Z
+UPDATE t1 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	B
+A	I
+X	Y
+X	Z
+SELECT * FROM t1 ORDER BY C1,C2;
+C1	C2
+A	B
+A	I
+X	Y
+X	Z
+UPDATE t1 SET c2 = 'Q' WHERE c1 = 'A' AND c2 = 'N';
+SELECT * FROM t1 ORDER BY c1,c2;
+C1	C2
+A	B
+A	I
+X	Y
+X	Z
+SELECT * FROM t1 ORDER BY c1,c2;
+C1	C2
+A	B
+A	I
+X	Y
+X	Z
+CREATE TABLE t2 (c1 INT, c12 char(1), c2 INT, PRIMARY KEY (c1)) ENGINE = 'INNODB'  ;
+INSERT INTO t2
+VALUES (1,'A',2),  (2,'A',4),  (3,'A',9),  (4,'A',15), (5,'A',25),
+(6,'A',35), (7,'A',50), (8,'A',64), (9,'A',81);
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	2
+2	A	4
+3	A	9
+4	A	15
+5	A	25
+6	A	35
+7	A	50
+8	A	64
+9	A	81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1	c12	c2
+2	A	4
+3	A	9
+5	A	25
+8	A	64
+9	A	81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	2
+2	A	4
+3	A	9
+4	A	15
+5	A	25
+6	A	35
+7	A	50
+8	A	64
+9	A	81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1	c12	c2
+2	A	4
+3	A	9
+5	A	25
+8	A	64
+9	A	81
+UPDATE t2 SET c2 = c1*c1 WHERE c2 != c1*c1;
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+4	A	16
+5	A	25
+6	A	36
+7	A	49
+8	A	64
+9	A	81
+SELECT * FROM t2 WHERE c2 = c1 * c1 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+4	A	16
+5	A	25
+6	A	36
+7	A	49
+8	A	64
+9	A	81
+UPDATE t2 SET c12 = 'Q' WHERE c1 = 1 AND c2 = 999;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+4	A	16
+5	A	25
+6	A	36
+7	A	49
+8	A	64
+9	A	81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+4	A	16
+5	A	25
+6	A	36
+7	A	49
+8	A	64
+9	A	81
+DELETE FROM t2 WHERE c1 % 4 = 0;
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+5	A	25
+6	A	36
+7	A	49
+9	A	81
+SELECT * FROM t2 ORDER BY c1,c2;
+c1	c12	c2
+1	A	1
+2	A	4
+3	A	9
+5	A	25
+6	A	36
+7	A	49
+9	A	81
+UPDATE t2 SET c12='X';
+CREATE TABLE t3 (C1 CHAR(1), C2 CHAR(1), pk1 INT, C3 CHAR(1), pk2 INT, PRIMARY KEY (pk1,pk2)) ENGINE = 'INNODB'  ;
+INSERT INTO t3 VALUES ('A','B',1,'B',1), ('X','Y',2,'B',1), ('X','X',3,'B',1);
+INSERT INTO t3 VALUES ('A','C',1,'B',2), ('X','Z',2,'B',2), ('A','A',3,'B',2);
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	A	3	B	2
+A	B	1	B	1
+A	C	1	B	2
+X	X	3	B	1
+X	Y	2	B	1
+X	Z	2	B	2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	A	3	B	2
+A	B	1	B	1
+A	C	1	B	2
+X	X	3	B	1
+X	Y	2	B	1
+X	Z	2	B	2
+DELETE FROM t3 WHERE C1 = C2;
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	B	1	B	1
+A	C	1	B	2
+X	Y	2	B	1
+X	Z	2	B	2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	B	1	B	1
+A	C	1	B	2
+X	Y	2	B	1
+X	Z	2	B	2
+UPDATE t3 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	B	1	B	1
+A	I	1	B	2
+X	Y	2	B	1
+X	Z	2	B	2
+SELECT * FROM t3 ORDER BY C1,C2;
+C1	C2	pk1	C3	pk2
+A	B	1	B	1
+A	I	1	B	2
+X	Y	2	B	1
+X	Z	2	B	2
+CREATE TABLE t6 (C1 CHAR(1), C2 CHAR(1), C3 INT) ENGINE = 'INNODB' ;
+INSERT INTO t6 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t6 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+X	X	3
+A	C	4
+X	Z	5
+A	A	6
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+X	X	3
+A	C	4
+X	Z	5
+A	A	6
+DELETE FROM t6 WHERE C1 = C2;
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+A	C	4
+X	Z	5
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+A	C	4
+X	Z	5
+UPDATE t6 SET C2 = 'I' WHERE C1 = 'A' AND C2 = 'C';
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+A	I	4
+X	Z	5
+SELECT * FROM t6 ORDER BY C3;
+C1	C2	C3
+A	B	1
+X	Y	2
+A	I	4
+X	Z	5
+CREATE TABLE t5 (C1 CHAR(1), C2 CHAR(1), C3 INT PRIMARY KEY) ENGINE = 'INNODB'  ;
+INSERT INTO t5 VALUES ('A','B',1), ('X','Y',2), ('X','X',3);
+INSERT INTO t5 VALUES ('A','C',4), ('X','Z',5), ('A','A',6);
+UPDATE t5,t2,t3 SET t5.C2='Q', t2.c12='R', t3.C3 ='S' WHERE t5.C1 = t2.c12 AND t5.C1 = t3.C1;
+SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5.C3,t2.c1,t3.pk1,t3.pk2;
+C1	C2	C3	c1	c12	c2	C1	C2	pk1	C3	pk2
+X	Q	2	1	R	1	X	Y	2	S	1
+X	Q	2	1	R	1	X	Z	2	S	2
+X	Q	2	2	R	4	X	Y	2	S	1
+X	Q	2	2	R	4	X	Z	2	S	2
+X	Q	2	3	R	9	X	Y	2	S	1
+X	Q	2	3	R	9	X	Z	2	S	2
+X	Q	2	5	R	25	X	Y	2	S	1
+X	Q	2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E t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = 'INNODB'  ;
+INSERT INTO t4 SET C1 = 1;
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1	HEX(B1)	HEX(B2)
+1	NULL	0
+SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
+C1	HEX(B1)	HEX(B2)
+1	NULL	0
+CREATE TABLE t7 (C1 INT PRIMARY KEY, C2 INT) ENGINE = 'INNODB'  ;
+--- on slave: original values ---
+INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
+SELECT * FROM t7 ORDER BY C1;
+C1	C2
+1	3
+2	6
+3	9
+set @@global.slave_exec_mode= 'IDEMPOTENT';
+--- on master: new values inserted ---
+INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
+SELECT * FROM t7 ORDER BY C1;
+C1	C2
+1	2
+2	4
+3	6
+set @@global.slave_exec_mode= default;
+--- on slave: old values should be overwritten by replicated values ---
+SELECT * FROM t7 ORDER BY C1;
+C1	C2
+1	2
+2	4
+3	6
+--- on master ---
+CREATE TABLE t8 (a INT PRIMARY KEY, b INT UNIQUE, c INT UNIQUE) ENGINE = 'INNODB'  ;
+INSERT INTO t8 VALUES (99,99,99);
+INSERT INTO t8 VALUES (99,22,33);
+ERROR 23000: Duplicate entry '99' for key 'PRIMARY'
+INSERT INTO t8 VALUES (11,99,33);
+ERROR 23000: Duplicate entry '99' for key 'b'
+INSERT INTO t8 VALUES (11,22,99);
+ERROR 23000: Duplicate entry '99' for key 'c'
+SELECT * FROM t8 ORDER BY a;
+a	b	c
+99	99	99
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a	b	c
+99	99	99
+INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
+SELECT * FROM t8 ORDER BY a;
+a	b	c
+1	2	3
+2	4	6
+3	6	9
+99	99	99
+set @@global.slave_exec_mode= 'IDEMPOTENT';
+--- on master ---
+INSERT INTO t8 VALUES (2,4,8);
+set @@global.slave_exec_mode= default;
+--- on slave ---
+SELECT * FROM t8 ORDER BY a;
+a	b	c
+1	2	3
+2	4	8
+3	6	9
+99	99	99
+**** Test for BUG#31552 ****
+**** On Master ****
+DELETE FROM t1;
+include/rpl_reset.inc
+**** On Master ****
+INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
+**** On Master ****
+set @@global.slave_exec_mode= 'IDEMPOTENT';
+DELETE FROM t1 WHERE C1 = 'L';
+DELETE FROM t1;
+SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
+COUNT(*)	0
+set @@global.slave_exec_mode= default;
+include/check_slave_is_running.inc
+SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
+COUNT(*)	0
+**** Test for BUG#37076 ****
+**** On Master ****
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a TIMESTAMP, b DATETIME, c DATE);
+INSERT INTO t1 VALUES(
+'2005-11-14 01:01:01', '2005-11-14 01:01:02', '2005-11-14');
+**** On Slave ****
+SELECT * FROM t1;
+a	b	c
+2005-11-14 01:01:01	2005-11-14 01:01:02	2005-11-14
+DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7,t8;
+CREATE TABLE t1 (i INT NOT NULL,
+c CHAR(16) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+CREATE TABLE t2 (i INT NOT NULL,
+c CHAR(16) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+ALTER TABLE t2 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
+CREATE TABLE t3 (i INT NOT NULL,
+c CHAR(128) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+ALTER TABLE t3 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
+CREATE TABLE t4 (i INT NOT NULL,
+c CHAR(128) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+CREATE TABLE t5 (i INT NOT NULL,
+c CHAR(255) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+ALTER TABLE t5 MODIFY c CHAR(16) CHARACTER SET utf8 NOT NULL;
+CREATE TABLE t6 (i INT NOT NULL,
+c CHAR(255) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+ALTER TABLE t6 MODIFY c CHAR(128) CHARACTER SET utf8 NOT NULL;
+CREATE TABLE t7 (i INT NOT NULL,
+c CHAR(255) CHARACTER SET utf8 NOT NULL,
+j INT NOT NULL) ENGINE = 'INNODB'  ;
+SET @saved_slave_type_conversions = @@slave_type_conversions;
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
+[expecting slave to replicate correctly]
+INSERT INTO t1 VALUES (1, "", 1);
+INSERT INTO t1 VALUES (2, repeat(_utf8'a', 16), 2);
+include/diff_tables.inc [master:t1, slave:t1]
+[expecting slave to replicate correctly]
+INSERT INTO t2 VALUES (1, "", 1);
+INSERT INTO t2 VALUES (2, repeat(_utf8'a', 16), 2);
+include/diff_tables.inc [master:t2, slave:t2]
+SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
+call mtr.add_suppression("Slave SQL.*Table definition on master and slave does not match: Column 1 size mismatch.* Error_code: 1535");
+call mtr.add_suppression("Slave SQL.*Could not execute Delete_rows event on table test.t1.* Error_code: 1032");
+call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t.. cannot be converted from type.*, Error_code: 1677");
+include/rpl_reset.inc
+[expecting slave to replicate correctly]
+INSERT INTO t4 VALUES (1, "", 1);
+INSERT INTO t4 VALUES (2, repeat(_utf8'a', 128), 2);
+include/diff_tables.inc [master:t4, slave:t4]
+[expecting slave to stop]
+INSERT INTO t5 VALUES (1, "", 1);
+INSERT INTO t5 VALUES (2, repeat(_utf8'a', 255), 2);
+include/wait_for_slave_sql_error.inc [errno=1677 ]
+Last_SQL_Error = 'Column 1 of table 'test.t5' cannot be converted from type 'char(255)' to type 'char(16)''
+include/rpl_reset.inc
+[expecting slave to stop]
+INSERT INTO t6 VALUES (1, "", 1);
+INSERT INTO t6 VALUES (2, repeat(_utf8'a', 255), 2);
+include/wait_for_slave_sql_error.inc [errno=1677 ]
+Last_SQL_Error = 'Column 1 of table 'test.t6' cannot be converted from type 'char(255)' to type 'char(128)''
+include/rpl_reset.inc
+[expecting slave to replicate correctly]
+INSERT INTO t7 VALUES (1, "", 1);
+INSERT INTO t7 VALUES (2, repeat(_utf8'a', 255), 2);
+include/diff_tables.inc [master:t7, slave:t7]
+drop table t1, t2, t3, t4, t5, t6, t7;
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE='INNODB' ;
+INSERT INTO t1 VALUES (1), (2), (3);
+UPDATE t1 SET a = 10;
+ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
+INSERT INTO t1 VALUES (4);
+include/diff_tables.inc [master:t1, slave:t1]
+drop table t1;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+`date_key` date NOT NULL,
+`date_nokey` date NOT NULL,
+`time_key` time NOT NULL,
+`time_nokey` time NOT NULL,
+`datetime_key` datetime NOT NULL,
+`datetime_nokey` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+`varchar_nokey` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `date_key` (`date_key`),
+KEY `time_key` (`time_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE='INNODB' ;
+INSERT INTO t1 VALUES (1,8,5,'0000-00-00','0000-00-00','10:37:38','10:37:38','0000-00-00 00:00:00','0000-00-00 00:00:00','p','p'),(2,0,9,'0000-00-00','0000-00-00','00:00:00','00:00:00','2007-10-14 00:00:00','2007-10-14 00:00:00','d','d');
+CREATE TABLE t2 (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`int_nokey` int(11) NOT NULL,
+`int_key` int(11) NOT NULL,
+`date_key` date NOT NULL,
+`date_nokey` date NOT NULL,
+`time_key` time NOT NULL,
+`time_nokey` time NOT NULL,
+`datetime_key` datetime NOT NULL,
+`datetime_nokey` datetime NOT NULL,
+`varchar_key` varchar(1) NOT NULL,
+`varchar_nokey` varchar(1) NOT NULL,
+PRIMARY KEY (`pk`),
+KEY `int_key` (`int_key`),
+KEY `date_key` (`date_key`),
+KEY `time_key` (`time_key`),
+KEY `datetime_key` (`datetime_key`),
+KEY `varchar_key` (`varchar_key`)
+) ENGINE='INNODB' ;
+INSERT INTO t2 VALUES (1,1,6,'2005-12-23','2005-12-23','02:24:28','02:24:28','0000-00-00 00:00:00','0000-00-00 00:00:00','g','g'),(2,0,3,'2009-09-14','2009-09-14','00:00:00','00:00:00','2000-01-30 16:39:40','2000-01-30 16:39:40','q','q'),(3,0,3,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','c','c'),(4,1,6,'2007-03-29','2007-03-29','15:49:00','15:49:00','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(5,4,0,'2002-12-04','2002-12-04','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','o','o'),(6,9,0,'2005-01-28','2005-01-28','00:00:00','00:00:00','2001-05-18 00:00:00','2001-05-18 00:00:00','w','w'),(7,6,0,'0000-00-00','0000-00-00','06:57:25','06:57:25','0000-00-00 00:00:00','0000-00-00 00:00:00','m','m'),(8,0,0,'0000-00-00','0000-00-00','00:00:00','00:00:00','0000-00-00 00:00:00','0000-00-00 00:00:00','z','z'),(9,4,6,'2006-08-15','2006-08-15','00:00:00','00:00:00','2002-04-12 14:44:25','2002-04-12 14:44:25','j'!
 ,'j'),(10,0,5,'2006-12-20','2006-12-20','10:13:53','10:13:53','2008-07-22 00:00:00','2008-07-22 00:00:00','y','y'),(11,9,7,'0000-00-00','0000-00-00','00:00:00','00:00:00','2004-07-05 00:00:00','2004-07-05 00:00:00','{','{'),(12,4,3,'2007-01-26','2007-01-26','23:00:51','23:00:51','2001-05-16 00:00:00','2001-05-16 00:00:00','f','f'),(13,7,0,'2004-03-27','2004-03-27','00:00:00','00:00:00','2005-01-24 03:30:37','2005-01-24 03:30:37','',''),(14,6,0,'2006-07-26','2006-07-26','18:43:57','18:43:57','0000-00-00 00:00:00','0000-00-00 00:00:00','{','{'),(15,0,6,'2000-01-14','2000-01-14','00:00:00','00:00:00','2000-09-21 00:00:00','2000-09-21 00:00:00','o','o'),(16,9,8,'0000-00-00','0000-00-00','21:15:08','21:15:08','0000-00-00 00:00:00','0000-00-00 00:00:00','a','a'),(17,2,0,'2004-10-27','2004-10-27','00:00:00','00:00:00','2004-03-24 22:13:43','2004-03-24 22:13:43','',''),(18,7,4,'0000-00-00','0000-00-00','08:38:27','08:38:27','2002-03-18 19:51:44','2002-03-18 19:51:44','t','t'),(19,5!
 ,3,'2008-03-07','2008-03-07','03:29:07','03:29:07','2007-12-01 18:44:4
4','2007-12-01 18:44:44','t','t'),(20,0,0,'2002-04-09','2002-04-09','16:06:03','16:06:03','2009-04-22 00:00:00','2009-04-22 00:00:00','n','n');
+DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
+UPDATE t1 SET `int_key` = 3 ORDER BY `pk` LIMIT 4;
+DELETE FROM t2 WHERE `int_key` < 3 LIMIT 1;
+DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
+UPDATE t1 SET `int_key` = 6 ORDER BY `pk` LIMIT 3;
+DELETE FROM t2 WHERE `pk` < 6 LIMIT 1;
+UPDATE t1 SET `pk` = 6 ORDER BY `int_key` LIMIT 6;
+ERROR 23000: Duplicate entry '6' for key 'PRIMARY'
+DELETE FROM t2 WHERE `pk` < 7 LIMIT 1;
+UPDATE t1 SET `int_key` = 4 ORDER BY `pk` LIMIT 6;
+*** results: t2 must be consistent ****
+include/diff_tables.inc [master:t2, slave:t2]
+DROP TABLE t1, t2;
+EOF OF TESTS
+CREATE TABLE t1 (a int) ENGINE='INNODB' ;
+INSERT IGNORE INTO t1 VALUES (NULL);
+INSERT INTO t1 ( a ) VALUES ( 0 );
+INSERT INTO t1 ( a ) VALUES ( 9 );
+INSERT INTO t1 ( a ) VALUES ( 2 );
+INSERT INTO t1 ( a ) VALUES ( 9 );
+INSERT INTO t1 ( a ) VALUES ( 5 );
+UPDATE t1 SET a = 5 WHERE a = 9;
+DELETE FROM t1 WHERE a < 6;
+UPDATE t1 SET a = 9 WHERE a < 3;
+INSERT INTO t1 ( a ) VALUES ( 3 );
+UPDATE t1 SET a = 0 WHERE a < 4;
+UPDATE t1 SET a = 8 WHERE a < 5;
+include/diff_tables.inc [master:t1, slave:t1]
+drop table t1;
+CREATE TABLE t1 (a bit) ENGINE='INNODB' ;
+INSERT IGNORE INTO t1 VALUES (NULL);
+INSERT INTO t1 ( a ) VALUES ( 0 );
+UPDATE t1 SET a = 0 WHERE a = 1 LIMIT 3;
+INSERT INTO t1 ( a ) VALUES ( 5 );
+DELETE FROM t1 WHERE a < 2 LIMIT 4;
+DELETE FROM t1 WHERE a < 9 LIMIT 4;
+INSERT INTO t1 ( a ) VALUES ( 9 );
+UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
+INSERT INTO t1 ( a ) VALUES ( 8 );
+UPDATE t1 SET a = 0 WHERE a < 6 LIMIT 0;
+INSERT INTO t1 ( a ) VALUES ( 4 );
+INSERT INTO t1 ( a ) VALUES ( 3 );
+UPDATE t1 SET a = 0 WHERE a = 7 LIMIT 6;
+DELETE FROM t1 WHERE a = 4 LIMIT 7;
+UPDATE t1 SET a = 9 WHERE a < 2 LIMIT 9;
+UPDATE t1 SET a = 0 WHERE a < 9 LIMIT 2;
+DELETE FROM t1 WHERE a < 0 LIMIT 5;
+INSERT INTO t1 ( a ) VALUES ( 5 );
+UPDATE t1 SET a = 4 WHERE a < 6 LIMIT 4;
+INSERT INTO t1 ( a ) VALUES ( 5 );
+UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 8;
+DELETE FROM t1 WHERE a < 8 LIMIT 8;
+INSERT INTO t1 ( a ) VALUES ( 6 );
+DELETE FROM t1 WHERE a < 6 LIMIT 7;
+UPDATE t1 SET a = 7 WHERE a = 3 LIMIT 7;
+UPDATE t1 SET a = 8 WHERE a = 0 LIMIT 6;
+INSERT INTO t1 ( a ) VALUES ( 7 );
+DELETE FROM t1 WHERE a < 9 LIMIT 4;
+INSERT INTO t1 ( a ) VALUES ( 7 );
+INSERT INTO t1 ( a ) VALUES ( 6 );
+UPDATE t1 SET a = 8 WHERE a = 3 LIMIT 4;
+DELETE FROM t1 WHERE a = 2 LIMIT 9;
+DELETE FROM t1 WHERE a = 1 LIMIT 4;
+UPDATE t1 SET a = 4 WHERE a = 2 LIMIT 7;
+INSERT INTO t1 ( a ) VALUES ( 0 );
+DELETE FROM t1 WHERE a < 3 LIMIT 0;
+UPDATE t1 SET a = 8 WHERE a = 5 LIMIT 2;
+INSERT INTO t1 ( a ) VALUES ( 1 );
+UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
+include/diff_tables.inc [master:t1, slave:t1]
+drop table t1;
+stop slave;
+set global slave_allow_batching=OFF;
+start slave;
+include/rpl_end.inc

=== added file 'mysql-test/suite/rpl/t/rpl_row_basic_allow_batching.test'
--- a/mysql-test/suite/rpl/t/rpl_row_basic_allow_batching.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_basic_allow_batching.test	2011-11-15 14:30:51 +0000
@@ -0,0 +1,32 @@
+-- source include/have_binlog_format_row.inc
+-- source include/master-slave.inc
+
+--connection slave
+show variables like 'slave_allow_batching';
+
+--echo Show that slave_allow_batching cannot be changed while slave is running
+--error ER_SLAVE_MUST_STOP
+set global slave_allow_batching=ON;
+show warnings;
+show variables like 'slave_allow_batching';
+
+--echo Now stop slave and change it
+stop slave;
+set global slave_allow_batching=ON;
+show variables like 'slave_allow_batching';
+start slave;
+
+--echo Now the normal test
+--connection master
+
+let $type= 'INNODB' ;
+let $extra_index= ;
+-- source extra/rpl_tests/rpl_row_basic.test
+
+--connection slave
+stop slave;
+set global slave_allow_batching=OFF;
+start slave;
+
+--source include/rpl_end.inc
+

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2011-11-14 12:36:09 +0000
+++ b/sql/ha_ndbcluster.cc	2011-11-15 15:11:57 +0000
@@ -10286,10 +10286,10 @@ do_drop:
 /* static version which does not need a handler */
 
 int
-ha_ndbcluster::drop_table(THD *thd, ha_ndbcluster *h, Ndb *ndb,
-                          const char *path,
-                          const char *db,
-                          const char *table_name)
+ha_ndbcluster::drop_table_impl(THD *thd, ha_ndbcluster *h, Ndb *ndb,
+                               const char *path,
+                               const char *db,
+                               const char *table_name)
 {
   DBUG_ENTER("ha_ndbcluster::ndbcluster_delete_table");
   NDBDICT *dict= ndb->getDictionary();
@@ -10481,8 +10481,8 @@ int ha_ndbcluster::delete_table(const ch
     If it was already gone it might have been dropped
     remotely, give a warning and then drop .ndb file.
    */
-  if (!(error= drop_table(thd, this, ndb, name,
-                          m_dbname, m_tabname)) ||
+  if (!(error= drop_table_impl(thd, this, ndb, name,
+                               m_dbname, m_tabname)) ||
       error == HA_ERR_NO_SUCH_TABLE)
   {
     /* Call ancestor function to delete .ndb file */
@@ -11288,7 +11288,7 @@ int ndbcluster_drop_database_impl(THD *t
   while ((tabname=it++))
   {
     tablename_to_filename(tabname, tmp, FN_REFLEN - (tmp - full_path)-1);
-    if (ha_ndbcluster::drop_table(thd, 0, ndb, full_path, dbname, tabname))
+    if (ha_ndbcluster::drop_table_impl(thd, 0, ndb, full_path, dbname, tabname))
     {
       const NdbError err= dict->getNdbError();
       if (err.code != 709 && err.code != 723)
@@ -17289,7 +17289,8 @@ mysql_declare_plugin(ndbcluster)
   0x0100,                     /* plugin version */
   ndb_status_variables_export,/* status variables                */
   system_variables,           /* system variables */
-  NULL                        /* config options                  */
+  NULL,                       /* config options                  */
+  0                           /* flags */
 },
 {
   MYSQL_STORAGE_ENGINE_PLUGIN,
@@ -17303,7 +17304,8 @@ mysql_declare_plugin(ndbcluster)
   0x0001,                     /* plugin version */
   NULL,                       /* status variables */
   ndbinfo_system_variables,   /* system variables */
-  NULL                        /* config options */
+  NULL,                        /* config options */
+  0                           /* flags */
 }
 mysql_declare_plugin_end;
 

=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h	2011-09-30 10:24:10 +0000
+++ b/sql/ha_ndbcluster.h	2011-11-15 15:11:57 +0000
@@ -495,10 +495,10 @@ private:
                                       NDB_SHARE *share);
 
   void check_read_before_write_removal();
-  static int drop_table(THD *thd, ha_ndbcluster *h, Ndb *ndb,
-                        const char *path,
-                        const char *db,
-                        const char *table_name);
+  static int drop_table_impl(THD *thd, ha_ndbcluster *h, Ndb *ndb,
+                             const char *path,
+                             const char *db,
+                             const char *table_name);
 
   int add_index_impl(THD *thd, TABLE *table_arg,
                      KEY *key_info, uint num_of_keys);

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-11-15 13:15:11 +0000
+++ b/sql/handler.h	2011-11-15 14:34:44 +0000
@@ -165,6 +165,10 @@
  */
 #define HA_BINLOG_FLAGS (HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE)
 
+/*
+  The handler supports read before write removal optimization
+*/
+#define HA_READ_BEFORE_WRITE_REMOVAL  (LL(1) << 38)
 
 /* bits in index_flags(index_number) for what you can do with index */
 #define HA_READ_NEXT            1       /* TODO really use this flag */

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	2011-11-15 14:10:26 +0000
+++ b/sql/log_event.cc	2011-11-15 14:34:44 +0000
@@ -8717,12 +8717,16 @@ int Rows_log_event::do_apply_event(Relay
         thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
     else
         thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
-#ifndef MCP_WL3733
+
+    /*
+      Note that unlike the other thd options set here, this one
+      comes from a global, and not from the incoming event.
+    */
     if (slave_allow_batching)
       thd->variables.option_bits|= OPTION_ALLOW_BATCH;
     else
       thd->variables.option_bits&= ~OPTION_ALLOW_BATCH;
-#endif
+
     /* A small test to verify that objects have consistent types */
     DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
 
@@ -9000,10 +9004,8 @@ int Rows_log_event::do_apply_event(Relay
     }
   } // if (table)
 
-#ifndef MCP_WL3733
   /* reset OPTION_ALLOW_BATCH as not affect later events */
   thd->variables.option_bits&= ~OPTION_ALLOW_BATCH;
-#endif
 
   if (error)
   {
@@ -10704,6 +10706,23 @@ int Rows_log_event::find_row(const Relay
 
   if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION))
   {
+
+    if ((table->file->ha_table_flags() & HA_READ_BEFORE_WRITE_REMOVAL))
+    {
+      /*
+        Read removal is possible since the engine supports write without
+        previous read using full primary key
+      */
+      DBUG_PRINT("info", ("using read before write removal"));
+
+      /*
+        Tell the handler to ignore if key exists or not, since it's
+        not yet known if the key does exist(when using rbwr)
+      */
+      table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
+      DBUG_RETURN(0);
+    }
+
     /*
       Use a more efficient method to fetch the record given by
       table->record[0] if the engine allows it.  We first compute a
@@ -10723,23 +10742,6 @@ int Rows_log_event::find_row(const Relay
 
     */
 
-#ifndef MCP_WL3733
-    /*
-      Ndb does not need read before delete/update (and no updates are sent)
-      if primary key specified
-
-      (Actually uniquekey will also do, but pk will be in each
-      row if table has pk)
-
-      Also set ignore no key, as we don't really know if row exists...
-    */
-    if (table->file->ht->db_type == DB_TYPE_NDBCLUSTER)
-    {
-      table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
-      DBUG_RETURN(0);
-    }
-#endif
-
     DBUG_PRINT("info",("locating record using primary key (position)"));
     int error;
     if (table->file->inited && (error= table->file->ha_index_end()))

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-11-15 13:30:43 +0000
+++ b/sql/sys_vars.cc	2011-11-15 15:02:56 +0000
@@ -2809,12 +2809,36 @@ static Sys_var_ulong Sys_profiling_histo
        VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1));
 #endif
 
-#ifndef MCP_WL3733
+#ifndef EMBEDDED_LIBRARY
 my_bool slave_allow_batching;
+
+/*
+  Take Active MI lock while checking/updating slave_allow_batching
+  to give atomicity w.r.t. slave state changes
+*/
+static PolyLock_mutex PLock_active_mi(&LOCK_active_mi);
+
+static bool slave_allow_batching_check(sys_var *self, THD *thd, set_var *var)
+{
+  /* Only allow a change if the slave SQL thread is currently stopped */
+  bool slave_sql_running = active_mi->rli->slave_running;
+
+  if (slave_sql_running)
+  {
+    my_error(ER_SLAVE_MUST_STOP, MYF(0));
+    return true;
+  }
+
+  return false;
+}
+
 static Sys_var_mybool Sys_slave_allow_batching(
        "slave_allow_batching", "Allow slave to batch requests",
        GLOBAL_VAR(slave_allow_batching),
-       CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+       CMD_LINE(OPT_ARG), DEFAULT(FALSE),
+       &PLock_active_mi,
+       NOT_IN_BINLOG,
+       ON_CHECK(slave_allow_batching_check));
 #endif
 
 static Sys_var_harows Sys_select_limit(

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-cluster branch (magnus.blaudd:3412 to 3416) magnus.blaudd16 Nov