mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new-ndb
into poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new
This commit is contained in:
commit
33df79f559
9 changed files with 352 additions and 39 deletions
|
@ -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
|
||||
|
|
|
@ -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 ---
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -28,9 +28,9 @@ rpl_ndb_ddl : result file needs update + test needs to checked
|
|||
rpl_ndb_innodb2ndb : BUG#17400 2006-04-19 tomas Cluster Replication: delete & update of rows in table without pk fails on slave.
|
||||
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#17400 2006-04-19 tomas Cluster Replication: delete & update of rows in table without pk fails on slave.
|
||||
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
|
||||
|
|
301
mysql-test/t/rpl_ndb_dd_partitions.test
Normal file
301
mysql-test/t/rpl_ndb_dd_partitions.test
Normal file
|
@ -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
|
|
@ -370,8 +370,11 @@ THD_NDB_SHARE *
|
|||
Thd_ndb::get_open_table(THD *thd, const void *key)
|
||||
{
|
||||
DBUG_ENTER("Thd_ndb::get_open_table");
|
||||
HASH_SEARCH_STATE state;
|
||||
THD_NDB_SHARE *thd_ndb_share=
|
||||
(THD_NDB_SHARE*)hash_search(&open_tables, (byte *)key, sizeof(key));
|
||||
(THD_NDB_SHARE*)hash_first(&open_tables, (byte *)key, sizeof(key), &state);
|
||||
while (thd_ndb_share && thd_ndb_share->key != key)
|
||||
thd_ndb_share= (THD_NDB_SHARE*)hash_next(&open_tables, (byte *)key, sizeof(key), &state);
|
||||
if (thd_ndb_share == 0)
|
||||
{
|
||||
thd_ndb_share= (THD_NDB_SHARE *) alloc_root(&thd->transaction.mem_root,
|
||||
|
@ -379,7 +382,7 @@ Thd_ndb::get_open_table(THD *thd, const void *key)
|
|||
thd_ndb_share->key= key;
|
||||
my_hash_insert(&open_tables, (byte *)thd_ndb_share);
|
||||
}
|
||||
DBUG_PRINT("exit", ("thd_ndb_share: 0x%x", thd_ndb_share));
|
||||
DBUG_PRINT("exit", ("thd_ndb_share: 0x%x key: 0x%x", thd_ndb_share, key));
|
||||
DBUG_RETURN(thd_ndb_share);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue