diff options
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_sv_relay_space.test | 22 | ||||
-rw-r--r-- | mysql-test/include/rpl_multi_engine3.inc | 2 | ||||
-rw-r--r-- | mysql-test/r/rpl_ndb_relay_space.result | 8 | ||||
-rw-r--r-- | mysql-test/r/rpl_relay_space_innodb.result | 8 | ||||
-rw-r--r-- | mysql-test/r/rpl_relay_space_myisam.result | 8 | ||||
-rw-r--r-- | mysql-test/t/disabled.def | 4 | ||||
-rw-r--r-- | mysql-test/t/rpl_ndb_dd_partitions.test | 301 | ||||
-rw-r--r-- | sql/log_event.cc | 31 |
8 files changed, 347 insertions, 37 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test index 57b74c80b58..3b6fe7a0ef4 100644 --- a/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test +++ b/mysql-test/extra/rpl_tests/rpl_sv_relay_space.test @@ -14,20 +14,22 @@ source include/master-slave.inc; # SHOW VARIABLES LIKE 'relay_log_space_limit'; +# Matz says: I have no idea what this is supposed to test, but it has +# potential for generating different results with some storage engines +# that process rows in an order not dependent on the insertion order. +# For instance, I would assume that distributed storage engines (like +# NDB) could process rows based on locality. + eval CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=$engine_type; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; -save_master_pos; -connection slave; -sync_with_master; +sync_slave_with_master; SELECT * FROM t1 ORDER BY id; connection master; -drop table t1; -save_master_pos; -connection slave; -sync_with_master; +DROP TABLE t1; +sync_slave_with_master; # End of 4.1 tests diff --git a/mysql-test/include/rpl_multi_engine3.inc b/mysql-test/include/rpl_multi_engine3.inc index be89c1907f3..cc1b3f13025 100644 --- a/mysql-test/include/rpl_multi_engine3.inc +++ b/mysql-test/include/rpl_multi_engine3.inc @@ -41,7 +41,7 @@ SELECT id,hex(b1),vc,bc,d,f,total,y,t FROM t1 WHERE id = 412; # Must give injector thread a little time to get update # into the binlog other wise we will miss the update. -sleep 3; +sleep 10; sync_slave_with_master; --echo --- Check Update on slave --- diff --git a/mysql-test/r/rpl_ndb_relay_space.result b/mysql-test/r/rpl_ndb_relay_space.result index 1e25b7fe8c1..930a8cae927 100644 --- a/mysql-test/r/rpl_ndb_relay_space.result +++ b/mysql-test/r/rpl_ndb_relay_space.result @@ -8,9 +8,9 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=NDB; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; name age id @@ -22,4 +22,4 @@ name age id Andy 31 00000001 Caleb 1 00000002 Jacob 2 00000003 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/rpl_relay_space_innodb.result b/mysql-test/r/rpl_relay_space_innodb.result index 80d8c48c241..54aac2eca35 100644 --- a/mysql-test/r/rpl_relay_space_innodb.result +++ b/mysql-test/r/rpl_relay_space_innodb.result @@ -8,9 +8,9 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=InnoDB; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; name age id @@ -22,4 +22,4 @@ name age id Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/r/rpl_relay_space_myisam.result b/mysql-test/r/rpl_relay_space_myisam.result index 02bff7ae881..e8d2d63e46e 100644 --- a/mysql-test/r/rpl_relay_space_myisam.result +++ b/mysql-test/r/rpl_relay_space_myisam.result @@ -8,9 +8,9 @@ SHOW VARIABLES LIKE 'relay_log_space_limit'; Variable_name Value relay_log_space_limit 0 CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=MyISAM; -INSERT INTO t1 SET name='Andy', age=31; -INSERT t1 SET name='Jacob', age=2; -INSERT into t1 SET name='Caleb', age=1; +INSERT INTO t1 SET name='Andy', age=31; +INSERT INTO t1 SET name='Jacob', age=2; +INSERT INTO t1 SET name='Caleb', age=1; ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY; SELECT * FROM t1 ORDER BY id; name age id @@ -22,4 +22,4 @@ name age id Andy 31 00000001 Jacob 2 00000002 Caleb 1 00000003 -drop table t1; +DROP TABLE t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index c0827e09990..0558e701344 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -28,9 +28,9 @@ rpl_ndb_ddl : result file needs update + test needs to checked rpl_ndb_innodb2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure rpl_ndb_log : BUG#18947 2006-03-21 tomas CRBR: order in binlog of create table and insert (on different table) not determ rpl_ndb_myisam2ndb : BUG#18094 2006-03-16 mats Slave caches invalid table definition after atlters causes select failure -rpl_ndb_relay_space : BUG#16993 2006-02-16 jmiller RBR: ALTER TABLE ZEROFILL AUTO_INCREMENT is not replicated correctly +#rpl_ndb_relay_space : BUG#16993 2006-02-16 jmiller RBR: ALTER TABLE ZEROFILL AUTO_INCREMENT is not replicated correctly rpl_switch_stm_row_mixed : BUG#18590 2006-03-28 brian -rpl_row_basic_7ndb : BUG#17400 2006-04-09 brian Cluster Replication: delete & update of rows in table without pk fails on slave. +#rpl_row_basic_7ndb : BUG#17400 2006-04-09 brian Cluster Replication: delete & update of rows in table without pk fails on slave. rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly rpl_row_func003 : BUG#19074 2006-13-04 andrei test failed rpl_row_inexist_tbl : BUG#18948 2006-03-09 mats Disabled since patch makes this test wait forever diff --git a/mysql-test/t/rpl_ndb_dd_partitions.test b/mysql-test/t/rpl_ndb_dd_partitions.test new file mode 100644 index 00000000000..026c31bbdc7 --- /dev/null +++ b/mysql-test/t/rpl_ndb_dd_partitions.test @@ -0,0 +1,301 @@ +####################################### +# Author: JBM # +# Date: 2006-03-09 # +# Purpose: To test the replication of # +# Cluster Disk Data using partitions # +####################################### + +--source include/have_ndb.inc +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo --- Doing pre test cleanup --- + +connection master; +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_query_log + + +# Start by creating a logfile group +################################## + +CREATE LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile.dat' +INITIAL_SIZE 16M +UNDO_BUFFER_SIZE = 1M +ENGINE=NDB; + +ALTER LOGFILE GROUP lg1 +ADD UNDOFILE 'undofile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################### +# Create a tablespace connected to the logfile group +################################################### + +CREATE TABLESPACE ts1 +ADD DATAFILE 'datafile.dat' +USE LOGFILE GROUP lg1 +INITIAL_SIZE 12M +ENGINE NDB; + +ALTER TABLESPACE ts1 +ADD DATAFILE 'datafile02.dat' +INITIAL_SIZE = 4M +ENGINE=NDB; + +################################################################# + +--echo --- Start test 2 partition RANGE testing -- +--echo --- Do setup -- + + +################################################# +# Requirment: Create table that is partitioned # +# by range on year i.e. year(t) and replicate # +# basice operations such at insert, update # +# delete between 2 different storage engines # +# Alter table and ensure table is handled # +# Correctly on the slave # +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY RANGE (YEAR(t)) + (PARTITION p0 VALUES LESS THAN (1901), + PARTITION p1 VALUES LESS THAN (1946), + PARTITION p2 VALUES LESS THAN (1966), + PARTITION p3 VALUES LESS THAN (1986), + PARTITION p4 VALUES LESS THAN (2005), + PARTITION p5 VALUES LESS THAN MAXVALUE); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave -- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- +--enable_query_log + +--source include/rpl_multi_engine3.inc + +--echo --- End test 2 partition RANGE testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 3 partition LIST testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY LIST(id) + (PARTITION p0 VALUES IN (2, 4), + PARTITION p1 VALUES IN (42, 142)); + +--echo --- Test 3 Alter to add partition --- + +ALTER TABLE t1 ADD PARTITION (PARTITION p2 VALUES IN (412)); + +--echo --- Show table on master --- + +SHOW CREATE TABLE t1; + +--echo --- Show table on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 3 partition LIST testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 4 partition HASH testing --- +--echo --- Do setup --- +################################################# + + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY HASH( YEAR(t) ) + PARTITIONS 4; + +--echo --- show that tables have been created correctly --- + +SHOW CREATE TABLE t1; +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 4 partition HASH testing --- +--echo --- Do Cleanup -- + +DROP TABLE IF EXISTS t1; + +######################################################## + +--echo --- Start test 5 partition by key testing --- +--echo --- Create Table Section --- + +################################################# + +CREATE TABLE t1 (id MEDIUMINT NOT NULL, b1 BIT(8), vc VARCHAR(63), + bc CHAR(63), d DECIMAL(10,4) DEFAULT 0, + f FLOAT DEFAULT 0, total BIGINT UNSIGNED, + y YEAR, t DATE,PRIMARY KEY(id)) + TABLESPACE ts1 STORAGE DISK + ENGINE=NDB + PARTITION BY KEY() + PARTITIONS 4; + +--echo --- Show that tables on master are ndbcluster tables --- + +SHOW CREATE TABLE t1; + +--echo --- Show that tables on slave --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +# Okay lets see how it holds up to table changes +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 DROP PRIMARY KEY, ADD PRIMARY KEY(id, total); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still right type --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- Check that simple Alter statements are replicated correctly --- + +ALTER TABLE t1 MODIFY vc VARCHAR(255); + +--echo --- Show the new improved table on the master --- + +SHOW CREATE TABLE t1; + +--echo --- Make sure that our tables on slave are still same engine --- +--echo --- and that the alter statements replicated correctly --- + +sync_slave_with_master; +SHOW CREATE TABLE t1; + +--echo --- Perform basic operation on master --- +--echo --- and ensure replicated correctly --- + +--source include/rpl_multi_engine3.inc + +--echo --- End test 5 key partition testing --- +--echo --- Do Cleanup --- + +DROP TABLE IF EXISTS t1; + +# End of 5.1 test case diff --git a/sql/log_event.cc b/sql/log_event.cc index 8a39b1fc4eb..d51a0ef4c9f 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6579,18 +6579,6 @@ int Delete_rows_log_event::do_before_row_operations(TABLE *table) if (!m_memory) return HA_ERR_OUT_OF_MEM; - if (table->s->keys > 0) - { - /* We have a key: search the table using the index */ - if (!table->file->inited) - error= table->file->ha_index_init(0, FALSE); - } - else - { - /* We doesn't have a key: search the table using rnd_next() */ - error= table->file->ha_rnd_init(1); - } - return error; } @@ -6638,6 +6626,20 @@ int Delete_rows_log_event::do_exec_row(TABLE *table) { DBUG_ASSERT(table != NULL); + if (table->s->keys > 0) + { + /* We have a key: search the table using the index */ + if (!table->file->inited) + if (int error= table->file->ha_index_init(0, FALSE)) + return error; + } + else + { + /* We doesn't have a key: search the table using rnd_next() */ + if (int error= table->file->ha_rnd_init(1)) + return error; + } + int error= find_and_fetch_row(table, m_key); if (error) return error; @@ -6649,6 +6651,11 @@ int Delete_rows_log_event::do_exec_row(TABLE *table) */ error= table->file->ha_delete_row(table->record[0]); + /* + Have to restart the scan to be able to fetch the next row. + */ + table->file->ha_index_or_rnd_end(); + return error; } |