From: Date: October 30 2007 12:54pm Subject: bk commit into 5.1 tree (tomas:1.2679) BUG#19227 List-Archive: http://lists.mysql.com/commits/36638 X-Bug: 19227 Message-Id: <20071030115408.80560180E9A73@linux.local> Below is the list of changes that have just been committed into a local 5.1 repository of tomas. When tomas does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2007-10-30 12:54:01+01:00, tomas@stripped +12 -0 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +26 -26 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +24 -24 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/t/disabled.def@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +0 -2 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +1 -1 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +1 -1 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +1 -1 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +1 -1 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines sql/ha_ndbcluster.cc@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +35 -15 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines sql/ha_ndbcluster.h@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +15 -0 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines sql/ha_ndbcluster_binlog.cc@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +64 -18 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines sql/ha_ndbcluster_binlog.h@stripped, 2007-10-30 12:53:56+01:00, tomas@stripped +9 -7 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines sql/mysqld.cc@stripped, 2007-10-30 12:53:57+01:00, tomas@stripped +18 -0 bug#19227 - enable logging of full rows and update as updates to make binlog compatible with other engines diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result 2007-06-27 14:27:29 +02:00 +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2innodb.result 2007-10-30 12:53:56 +01:00 @@ -27,7 +27,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 --- Show table on slave --- SHOW CREATE TABLE t1; Table Create Table @@ -100,7 +100,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -186,7 +186,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */ --- Show table on slave -- SHOW CREATE TABLE t1; Table Create Table @@ -200,7 +200,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -258,7 +258,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -274,7 +274,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1946) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1966) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1986) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (2005) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -299,11 +299,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -342,7 +342,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */ --- Show table on slave --- SHOW CREATE TABLE t1; Table Create Table @@ -356,7 +356,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -414,7 +414,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -430,7 +430,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = InnoDB, PARTITION p1 VALUES IN (42,142) ENGINE = InnoDB, PARTITION p2 VALUES IN (412) ENGINE = InnoDB) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -495,7 +495,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -508,7 +508,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -533,11 +533,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -566,7 +566,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -582,7 +582,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -607,11 +607,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -648,7 +648,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Show that tables on slave --- SHOW CREATE TABLE t1; Table Create Table @@ -663,7 +663,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -720,7 +720,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Make sure that our tables on slave are still right type --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -736,7 +736,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -793,7 +793,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -809,7 +809,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; diff -Nrup a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result 2007-06-27 14:27:30 +02:00 +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_2myisam.result 2007-10-30 12:53:56 +01:00 @@ -186,7 +186,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */ --- Show table on slave -- SHOW CREATE TABLE t1; Table Create Table @@ -200,7 +200,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -258,7 +258,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = ndbcluster, PARTITION p1 VALUES LESS THAN (1946) ENGINE = ndbcluster, PARTITION p2 VALUES LESS THAN (1966) ENGINE = ndbcluster, PARTITION p3 VALUES LESS THAN (1986) ENGINE = ndbcluster, PARTITION p4 VALUES LESS THAN (2005) ENGINE = ndbcluster, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = ndbcluster) */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -274,7 +274,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (YEAR(t)) (PARTITION p0 VALUES LESS THAN (1901) ENGINE = MyISAM, PARTITION p1 VALUES LESS THAN (1946) ENGINE = MyISAM, PARTITION p2 VALUES LESS THAN (1966) ENGINE = MyISAM, PARTITION p3 VALUES LESS THAN (1986) ENGINE = MyISAM, PARTITION p4 VALUES LESS THAN (2005) ENGINE = MyISAM, PARTITION p5 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -299,11 +299,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -342,7 +342,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */ --- Show table on slave --- SHOW CREATE TABLE t1; Table Create Table @@ -356,7 +356,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -414,7 +414,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = ndbcluster, PARTITION p1 VALUES IN (42,142) ENGINE = ndbcluster, PARTITION p2 VALUES IN (412) ENGINE = ndbcluster) */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -430,7 +430,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY LIST (id) (PARTITION p0 VALUES IN (2,4) ENGINE = MyISAM, PARTITION p1 VALUES IN (42,142) ENGINE = MyISAM, PARTITION p2 VALUES IN (412) ENGINE = MyISAM) */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -495,7 +495,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -508,7 +508,7 @@ t1 CREATE TABLE `t1` ( `total` bigint(20) unsigned DEFAULT NULL, `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -533,11 +533,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -566,7 +566,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -582,7 +582,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`t`,`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH ( YEAR(t)) PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -607,11 +607,11 @@ UPDATE t1 SET b1 = 0, t="2006-02-22" WHE --- Check the update on master --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Check Update on slave --- SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; id hex(b1) vc bc d f total y t -412 1 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 +412 0 Testing MySQL databases is a cool Must make it bug free for the customer 654321.4321 15.21 0 1965 2006-02-22 --- Remove a record from t1 on master --- DELETE FROM t1 WHERE id = 42; --- Show current count on master for t1 --- @@ -648,7 +648,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Show that tables on slave --- SHOW CREATE TABLE t1; Table Create Table @@ -663,7 +663,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -720,7 +720,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Make sure that our tables on slave are still right type --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -736,7 +736,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; @@ -793,7 +793,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Make sure that our tables on slave are still same engine --- --- and that the alter statements replicated correctly --- SHOW CREATE TABLE t1; @@ -809,7 +809,7 @@ t1 CREATE TABLE `t1` ( `y` year(4) DEFAULT NULL, `t` date DEFAULT NULL, PRIMARY KEY (`id`,`total`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY KEY () PARTITIONS 4 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY () PARTITIONS 4 */ --- Perform basic operation on master --- --- and ensure replicated correctly --- "--- Insert into t1 --" as ""; diff -Nrup a/mysql-test/suite/rpl_ndb/t/disabled.def b/mysql-test/suite/rpl_ndb/t/disabled.def --- a/mysql-test/suite/rpl_ndb/t/disabled.def 2007-08-30 22:13:03 +02:00 +++ b/mysql-test/suite/rpl_ndb/t/disabled.def 2007-10-30 12:53:56 +01:00 @@ -11,8 +11,6 @@ ############################################################################## -rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated -rpl_ndb_2myisam : BUG#19227 Seems to pass currently rpl_ndb_2other : BUG#21842 2007-08-30 tsmith test has never worked on bigendian (sol10-sparc-a, powermacg5 rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD rpl_ndb_innodb2ndb : Bug#29549 rpl_ndb_myisam2ndb,rpl_ndb_innodb2ndb failed on Solaris for pack_length issue diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt 2007-06-27 14:27:32 +02:00 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-master.opt 2007-10-30 12:53:56 +01:00 @@ -1 +1 @@ ---default-storage-engine=ndbcluster +--default-storage-engine=ndbcluster --new --ndb_log_updated_only=0 diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt 2007-06-27 14:27:30 +02:00 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2innodb-slave.opt 2007-10-30 12:53:56 +01:00 @@ -1 +1 @@ ---innodb --default-storage-engine=innodb +--innodb --default-storage-engine=innodb --replicate-ignore-table=mysql.ndb_apply_status diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt 2007-06-27 14:27:31 +02:00 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-master.opt 2007-10-30 12:53:56 +01:00 @@ -1 +1 @@ ---default-storage-engine=ndbcluster +--default-storage-engine=ndbcluster --new --ndb_log_updated_only=0 diff -Nrup a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt 2007-06-27 14:27:26 +02:00 +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_2myisam-slave.opt 2007-10-30 12:53:56 +01:00 @@ -1 +1 @@ ---default-storage-engine=myisam +--default-storage-engine=myisam --replicate-ignore-table=mysql.ndb_apply_status diff -Nrup a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc --- a/sql/ha_ndbcluster.cc 2007-10-29 08:53:49 +01:00 +++ b/sql/ha_ndbcluster.cc 2007-10-30 12:53:56 +01:00 @@ -3614,7 +3614,9 @@ int ha_ndbcluster::update_row(const ucha Batch update operation if we are doing a scan for update, unless there exist UPDATE AFTER triggers */ - if (cursor && !m_update_cannot_batch) + if (!m_update_cannot_batch && + (cursor || ((thd->options & OPTION_ALLOW_BATCH) && + (table_share->primary_key != MAX_KEY)))) { /* For a scan, we only need to execute() if the batch buffer is full. */ row= batch_copy_row_to_buffer(thd_ndb, new_data, need_execute); @@ -3664,16 +3666,31 @@ int ha_ndbcluster::update_row(const ucha { const NdbRecord *key_rec; const uchar *key_row; + uint key_len; if (table_share->primary_key != MAX_KEY) { key_rec= m_index[table_share->primary_key].ndb_unique_record_row; - key_row= old_data; + key_row= row; + key_len= table->s->reclength; } else { /* Use hidden primary key previously read into m_ref. */ key_rec= m_ndb_hidden_key_record; key_row= (const uchar *)(&m_ref); + key_len= sizeof(m_ref); + } + + if (!need_execute) + { + /* + Poor approx. let delete ~ tabsize / 4 + */ + uint delete_size= 12 + m_bytes_per_write >> 2; + key_row= batch_copy_key_to_buffer(thd_ndb, key_row, key_len, + delete_size, need_execute); + if (unlikely(!key_row)) + DBUG_RETURN(ER_OUTOFMEMORY); } if (!(op= trans->updateTuple(key_rec, (const char *)key_row, @@ -6028,8 +6045,11 @@ int ha_ndbcluster::create(const char *na while (!IS_TMP_PREFIX(m_tabname)) { + set_binlog_flags(share); + String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name,m_dbname,m_tabname); + ndb_rep_event_name(&event_name, m_dbname, m_tabname, + get_binlog_full(share)); int do_event_op= ndb_binlog_running; if (!ndb_schema_share && @@ -6408,20 +6428,22 @@ int ha_ndbcluster::rename_table(const ch /* handle old table */ if (!is_old_table_tmpfile) { - /* old event to be dropped irrespective of rename or offline alter */ - String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, from + sizeof(share_prefix) - 1, 0); - ndbcluster_drop_event(thd, ndb, event_name.c_ptr(), share, "rename table"); + ndbcluster_drop_event(thd, ndb, share, "rename table", + from + sizeof(share_prefix) - 1); } if (!result && !is_new_table_tmpfile) { - /* always create an event for the table */ - String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0); Ndb_table_guard ndbtab_g2(dict, new_tabname); const NDBTAB *ndbtab= ndbtab_g2.get_table(); + set_binlog_flags(share); + + /* always create an event for the table */ + String event_name(INJECTOR_EVENT_LEN); + ndb_rep_event_name(&event_name, to + sizeof(share_prefix) - 1, 0, + get_binlog_full(share)); + if (!ndbcluster_create_event(ndb, ndbtab, event_name.c_ptr(), share, share && ndb_binlog_running ? 2 : 1/* push warning */)) { @@ -6646,11 +6668,9 @@ retry_temporary_error1: int table_dropped= dict->getNdbError().code != 709; { - String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, path + sizeof(share_prefix) - 1, 0); - ndbcluster_handle_drop_table(thd, ndb, - table_dropped ? event_name.c_ptr() : 0, - share, "delete table"); + ndbcluster_handle_drop_table(thd, ndb, share, "delete table", + table_dropped ? + (path + sizeof(share_prefix) - 1) : 0); } if (!IS_TMP_PREFIX(table_name) && share && diff -Nrup a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h --- a/sql/ha_ndbcluster.h 2007-10-29 08:53:49 +01:00 +++ b/sql/ha_ndbcluster.h 2007-10-30 12:53:56 +01:00 @@ -190,6 +190,21 @@ struct Ndb_tuple_id_range_guard { #define NSF_HIDDEN_PK 1 /* table has hidden primary key */ #define NSF_BLOB_FLAG 2 /* table has blob attributes */ #define NSF_NO_BINLOG 4 /* table should not be binlogged */ +#define NSF_BINLOG_FULL 8 /* table should be binlogged with full rows */ +#define NSF_BINLOG_USE_UPDATE 16 /* table update should be binlogged using + update log event */ +inline void set_binlog_nologging(NDB_SHARE *share) +{ share->flags|= NSF_NO_BINLOG; } +inline my_bool get_binlog_nologging(NDB_SHARE *share) +{ return (share->flags & NSF_NO_BINLOG) != 0; } +inline void set_binlog_full(NDB_SHARE *share) +{ share->flags|= NSF_BINLOG_FULL; } +inline my_bool get_binlog_full(NDB_SHARE *share) +{ return (share->flags & NSF_BINLOG_FULL) != 0; } +inline void set_binlog_use_update(NDB_SHARE *share) +{ share->flags|= NSF_BINLOG_USE_UPDATE; } +inline my_bool get_binlog_use_update(NDB_SHARE *share) +{ return (share->flags & NSF_BINLOG_USE_UPDATE) != 0; } #endif typedef enum ndb_query_state_bits { diff -Nrup a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc --- a/sql/ha_ndbcluster_binlog.cc 2007-10-16 17:04:12 +02:00 +++ b/sql/ha_ndbcluster_binlog.cc 2007-10-30 12:53:56 +01:00 @@ -35,6 +35,9 @@ extern my_bool opt_ndb_log_orig; +extern my_bool opt_ndb_log_update_as_write; +extern my_bool opt_ndb_log_updated_only; + /* defines for cluster replication table names */ @@ -2337,7 +2340,8 @@ ndb_binlog_thread_handle_schema_event_po Start subscribing to data changes to the new table definition */ String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, schema->db, schema->name); + ndb_rep_event_name(&event_name, schema->db, schema->name, + get_binlog_full(share)); NdbEventOperation *tmp_op= share->op; share->new_op= 0; share->op= 0; @@ -2671,15 +2675,28 @@ int ndbcluster_binlog_start() used by the client sql threads **************************************************************/ void -ndb_rep_event_name(String *event_name,const char *db, const char *tbl) +ndb_rep_event_name(String *event_name,const char *db, const char *tbl, + my_bool full) { - event_name->set_ascii("REPL$", 5); + if (full) + event_name->set_ascii("REPLF$", 6); + else + event_name->set_ascii("REPL$", 5); event_name->append(db); if (tbl) { event_name->append('/'); event_name->append(tbl); } + DBUG_PRINT("info", ("ndb_rep_event_name: %s", event_name->c_ptr())); +} + +void set_binlog_flags(NDB_SHARE *share) +{ + if (!opt_ndb_log_update_as_write) + set_binlog_use_update(share); + if (!opt_ndb_log_updated_only) + set_binlog_full(share); } bool @@ -2755,7 +2772,7 @@ int ndbcluster_create_binlog_setup(Ndb * if (share && share_may_exist) { - if (share->flags & NSF_NO_BINLOG || + if (get_binlog_nologging(share) || share->op != 0 || share->new_op != 0) { @@ -2811,7 +2828,7 @@ int ndbcluster_create_binlog_setup(Ndb * if (!do_event_op) { - share->flags|= NSF_NO_BINLOG; + set_binlog_nologging(share); pthread_mutex_unlock(&ndbcluster_mutex); DBUG_RETURN(0); } @@ -2840,8 +2857,13 @@ int ndbcluster_create_binlog_setup(Ndb * dict->getNdbError().code); break; // error } + + /* + */ + set_binlog_flags(share); + String event_name(INJECTOR_EVENT_LEN); - ndb_rep_event_name(&event_name, db, table_name); + ndb_rep_event_name(&event_name, db, table_name, get_binlog_full(share)); /* event should have been created by someone else, but let's make sure, and create if it doesn't exist @@ -2939,8 +2961,16 @@ ndbcluster_create_event(Ndb *ndb, const if (ndb_schema_share || strcmp(share->db, NDB_REP_DB) || strcmp(share->table_name, NDB_SCHEMA_TABLE)) { - my_event.setReport(NDBEVENT::ER_UPDATED); - DBUG_PRINT("info", ("subscription only updated")); + if (get_binlog_full(share)) + { + my_event.setReport(NDBEVENT::ER_ALL); + DBUG_PRINT("info", ("subscription all")); + } + else + { + my_event.setReport(NDBEVENT::ER_UPDATED); + DBUG_PRINT("info", ("subscription only updated")); + } } else { @@ -3290,18 +3320,32 @@ ndbcluster_create_event_ops(THD *thd, ND share->key, (long) share->op, share->use_count)); if (ndb_extra_logging) - sql_print_information("NDB Binlog: logging %s", share->key); + sql_print_information("NDB Binlog: logging %s (%s,%s)", share->key, + get_binlog_full(share) ? "FULL" : "UPDATED", + get_binlog_use_update(share) ? "USE_UPDATE" : "USE_WRITE"); DBUG_RETURN(0); } int -ndbcluster_drop_event(THD *thd, Ndb *ndb, const char *event_name, - NDB_SHARE *share, const char *type_str) +ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share, + const char *type_str, + const char *event_name_prefix) { DBUG_ENTER("ndbcluster_drop_event"); - NDBDICT *dict= ndb->getDictionary(); - if (event_name && dict->dropEvent(event_name)) + /* + There might be 2 types of events setup for the table, we cannot know + which ones are supposed to be there as they may have been created + differently for different mysqld's. So we drop both + */ + for (uint i= 0; event_name_prefix && i < 2; i++) { + NDBDICT *dict= ndb->getDictionary(); + String event_name(INJECTOR_EVENT_LEN); + ndb_rep_event_name(&event_name, event_name_prefix, 0, i); + + if (!dict->dropEvent(event_name.c_ptr())) + continue; + if (dict->getNdbError().code != 4710) { /* drop event failed for some reason, issue a warning */ @@ -3312,7 +3356,7 @@ ndbcluster_drop_event(THD *thd, Ndb *ndb /* error is not that the event did not exist */ sql_print_error("NDB Binlog: Unable to drop event in database. " "Event: %s Error Code: %d Message: %s", - event_name, + event_name.c_ptr(), dict->getNdbError().code, dict->getNdbError().message); /* ToDo; handle error? */ @@ -3372,12 +3416,13 @@ ndbcluster_handle_alter_table(THD *thd, */ int -ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, const char *event_name, - NDB_SHARE *share, const char *type_str) +ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, NDB_SHARE *share, + const char *type_str, + const char *event_name_prefix) { DBUG_ENTER("ndbcluster_handle_drop_table"); - if (ndbcluster_drop_event(thd, ndb, event_name, share, type_str)) + if (ndbcluster_drop_event(thd, ndb, share, type_str, event_name_prefix)) DBUG_RETURN(-1); if (share == 0 || share->op == 0) @@ -3943,7 +3988,8 @@ ndb_binlog_thread_handle_data_event(Ndb ndb_unpack_record(table, event_data->ndb_value[0], &b, table->record[0]); DBUG_EXECUTE("info", print_records(table, table->record[0]);); - if (table->s->primary_key != MAX_KEY) + if (table->s->primary_key != MAX_KEY && + !get_binlog_use_update(share)) { /* since table has a primary key, we can do a write diff -Nrup a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h --- a/sql/ha_ndbcluster_binlog.h 2007-10-15 23:40:59 +02:00 +++ b/sql/ha_ndbcluster_binlog.h 2007-10-30 12:53:56 +01:00 @@ -185,16 +185,16 @@ int ndbcluster_log_schema_op(THD *thd, const char *new_db, const char *new_table_name, int have_lock_open); -int ndbcluster_drop_event(THD *thd,Ndb *ndb, const char *event_name, - NDB_SHARE *share, - const char *type_str); +int ndbcluster_drop_event(THD *thd, Ndb *ndb, NDB_SHARE *share, + const char *type_str, + const char *event_name_prefix); int ndbcluster_handle_alter_table(THD *thd, NDB_SHARE *share, const char *type_str); -int ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, const char *event_name, - NDB_SHARE *share, - const char *type_str); +int ndbcluster_handle_drop_table(THD *thd, Ndb *ndb, NDB_SHARE *share, + const char *type_str, + const char *event_name_prefix); void ndb_rep_event_name(String *event_name, - const char *db, const char *tbl); + const char *db, const char *tbl, my_bool full); int ndb_create_table_from_engine(THD *thd, const char *db, const char *table_name); int ndbcluster_binlog_start(); @@ -256,6 +256,8 @@ inline void free_share(NDB_SHARE **share { ndbcluster_free_share(share, have_lock); } + +void set_binlog_flags(NDB_SHARE *share); inline Thd_ndb * diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc --- a/sql/mysqld.cc 2007-09-27 19:06:03 +02:00 +++ b/sql/mysqld.cc 2007-10-30 12:53:57 +01:00 @@ -396,6 +396,8 @@ ulong ndb_extra_logging; #ifdef HAVE_NDB_BINLOG ulong ndb_report_thresh_binlog_epoch_slip; ulong ndb_report_thresh_binlog_mem_usage; +my_bool opt_ndb_log_update_as_write; +my_bool opt_ndb_log_updated_only; my_bool opt_ndb_log_orig; #endif @@ -4989,6 +4991,7 @@ enum options_mysqld OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP, OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE, OPT_NDB_USE_COPYING_ALTER_TABLE, + OPT_NDB_LOG_UPDATE_AS_WRITE, OPT_NDB_LOG_UPDATED_ONLY, OPT_NDB_LOG_ORIG, OPT_SKIP_SAFEMALLOC, OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE, @@ -5552,6 +5555,21 @@ master-ssl", (uchar**) &ndb_report_thresh_binlog_mem_usage, (uchar**) &ndb_report_thresh_binlog_mem_usage, 0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0}, + {"ndb-log-update-as-write", OPT_NDB_LOG_UPDATE_AS_WRITE, + "For efficiency log only after image as a write event." + "Ignore before image. This may cause compatability problems if" + "replicating to other storage engines than ndbcluster", + (uchar**) &opt_ndb_log_update_as_write, + (uchar**) &opt_ndb_log_update_as_write, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"ndb-log-updated-only", OPT_NDB_LOG_UPDATED_ONLY, + "For efficiency log only updated columns. Columns are considered " + "as \"updated\" even if they are updated with the same value. " + "This may cause compatability problems if" + "replicating to other storage engines than ndbcluster", + (uchar**) &opt_ndb_log_updated_only, + (uchar**) &opt_ndb_log_updated_only, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, {"ndb-log-orig", OPT_NDB_LOG_ORIG, "Log originating server id and epoch in ndb_binlog_index. Each epoch may in this case have " "multiple rows in ndb_binlog_index, one for each originating epoch.",