初版
This commit is contained in:
14
build/lib/mysql/mysql-test/suite/rpl_ndb/t/disabled.def
Normal file
14
build/lib/mysql/mysql-test/suite/rpl_ndb/t/disabled.def
Normal file
@@ -0,0 +1,14 @@
|
||||
##############################################################################
|
||||
#
|
||||
# List the test cases that are to be disabled temporarily.
|
||||
#
|
||||
# Separate the test case name and the comment with ':'.
|
||||
#
|
||||
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
|
||||
#
|
||||
# Do not use any TAB characters for whitespace.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# the below testcase have been reworked to avoid the bug, test contains comment, keep bug open
|
||||
rpl_ndb_2ndb : Bug#11754374 : rpl_ndb_2ndb fails sporadically
|
||||
@@ -0,0 +1,36 @@
|
||||
#############################################################
|
||||
# Author: JBM
|
||||
# Date: 2006-02-24
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to innodb, or myisam, or replicate from innodb/myisam to
|
||||
# cluster slave. Due to limitations I have created wrappers
|
||||
# to be able to use the same code for all these different
|
||||
# test and to have control over the tests.
|
||||
##############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- connection slave
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
# Remove any old ndb_apply_status from slaves datadir
|
||||
let $datadir= `SELECT @@datadir`;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.frm;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.ndb;
|
||||
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
CREATE TABLE mysql.ndb_apply_status
|
||||
( server_id INT UNSIGNED NOT NULL,
|
||||
epoch BIGINT UNSIGNED NOT NULL,
|
||||
log_name VARCHAR(255) BINARY NOT NULL,
|
||||
start_pos BIGINT UNSIGNED NOT NULL,
|
||||
end_pos BIGINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (server_id)) ENGINE=INNODB;
|
||||
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
|
||||
|
||||
--connection slave
|
||||
drop table mysql.ndb_apply_status;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,35 @@
|
||||
#############################################################
|
||||
# Author: JBM
|
||||
# Date: 2006-02-24
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to innodb, or myisam, or replicate from innodb/myisam to
|
||||
# cluster slave. Due to limitations I have created wrappers
|
||||
# to be able to use the same code for all these different
|
||||
# test and to have control over the tests.
|
||||
##############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- connection slave
|
||||
|
||||
# Remove any old ndb_apply_status from slaves datadir
|
||||
let $datadir= `SELECT @@datadir`;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.frm;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.ndb;
|
||||
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
CREATE TABLE mysql.ndb_apply_status
|
||||
( server_id INT UNSIGNED NOT NULL,
|
||||
epoch BIGINT UNSIGNED NOT NULL,
|
||||
log_name VARCHAR(255) BINARY NOT NULL,
|
||||
start_pos BIGINT UNSIGNED NOT NULL,
|
||||
end_pos BIGINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (server_id)) ENGINE=MYISAM;
|
||||
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
|
||||
|
||||
--connection slave
|
||||
drop table mysql.ndb_apply_status;
|
||||
--source include/rpl_end.inc
|
||||
20
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test
Normal file
20
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_2ndb.test
Normal file
@@ -0,0 +1,20 @@
|
||||
#############################################################
|
||||
# Author: Rafal Somla
|
||||
# Date: 2006-08-20
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to other engines (innodb, myisam), see also rpl_ndb_2other.test
|
||||
##############################################################
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
# On master use NDB as storage engine.
|
||||
connection master;
|
||||
SET storage_engine=ndb;
|
||||
|
||||
--echo
|
||||
--echo === NDB -> NDB ===
|
||||
--echo
|
||||
connection slave;
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,51 @@
|
||||
#############################################################
|
||||
# Author: Rafal Somla
|
||||
# Date: 2006-08-20
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to other engines (innodb, myisam).
|
||||
##############################################################
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
# On master use NDB as storage engine.
|
||||
connection master;
|
||||
SET storage_engine=ndb;
|
||||
|
||||
--echo
|
||||
--echo === NDB -> MYISAM ===
|
||||
--echo
|
||||
connection slave;
|
||||
|
||||
# Remove any old ndb_apply_status from slaves datadir
|
||||
let $datadir= `SELECT @@datadir`;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.frm;
|
||||
--error 0,1
|
||||
remove_file $datadir/mysql/ndb_apply_status.ndb;
|
||||
|
||||
set @old_slave_exec_mode= @@global.slave_exec_mode;
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
CREATE TABLE mysql.ndb_apply_status
|
||||
( server_id INT UNSIGNED NOT NULL,
|
||||
epoch BIGINT UNSIGNED NOT NULL,
|
||||
log_name VARCHAR(255) BINARY NOT NULL,
|
||||
start_pos BIGINT UNSIGNED NOT NULL,
|
||||
end_pos BIGINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (server_id)) ENGINE=MYISAM;
|
||||
SET storage_engine=myisam;
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
|
||||
|
||||
--echo
|
||||
--echo === NDB -> INNODB ===
|
||||
--echo
|
||||
connection slave;
|
||||
alter table mysql.ndb_apply_status engine=innodb;
|
||||
SET storage_engine=innodb;
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_basic.test
|
||||
|
||||
connection slave;
|
||||
drop table mysql.ndb_apply_status;
|
||||
set @@global.slave_exec_mode= @old_slave_exec_mode;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,9 @@
|
||||
########################################################
|
||||
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
|
||||
########################################################
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
--source extra/rpl_tests/rpl_row_UUID.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,27 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# Bug#28170 replicate-ignore-db=mysql should not ignore mysql.ndb_apply_status
|
||||
#
|
||||
# Slave is started with --replicate-ignore-db=mysql
|
||||
#
|
||||
sync_slave_with_master;
|
||||
echo *** on slave there should be zero rows ***;
|
||||
select count(*) from mysql.ndb_apply_status;
|
||||
|
||||
connection master;
|
||||
create table t1 (a int key, b int) engine ndb;
|
||||
insert into t1 values (1,1);
|
||||
echo *** on master it should be empty ***;
|
||||
select * from mysql.ndb_apply_status;
|
||||
|
||||
sync_slave_with_master;
|
||||
echo *** on slave there should be one row ***;
|
||||
select count(*) from mysql.ndb_apply_status;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
119
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test
Normal file
119
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_auto_inc.test
Normal file
@@ -0,0 +1,119 @@
|
||||
#
|
||||
# Test of auto_increment in CRBR
|
||||
#
|
||||
#####################################
|
||||
# By: JBM
|
||||
# Date: 2006-02-10
|
||||
# Change: Augmented test to use with cluster
|
||||
#####################################
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--echo ***************** Test 1 ************************
|
||||
--echo
|
||||
CREATE TABLE t1 (a INT NOT NULL auto_increment,b INT, PRIMARY KEY (a)) ENGINE=NDB auto_increment=3;
|
||||
insert into t1 values (NULL,1),(NULL,2),(NULL,3);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo ******* Select from Slave *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int not null auto_increment,b int, primary key (a)) engine=NDB;
|
||||
insert into t1 values (1,1),(NULL,2),(3,3),(NULL,4);
|
||||
delete from t1 where b=4;
|
||||
insert into t1 values (NULL,5),(NULL,6);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo ******* Select from Slave *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL);
|
||||
insert into t1 values (250),(NULL);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
insert into t1 values (1000);
|
||||
set @@insert_id=400;
|
||||
insert into t1 values(NULL),(NULL);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo ******* Select from Slave *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
|
||||
# Insert with 2 insert statements to get better testing of logging
|
||||
insert into t1 values (NULL),(5),(NULL),(NULL);
|
||||
insert into t1 values (500),(NULL),(502),(NULL),(600);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
set @@insert_id=600;
|
||||
# We expect a duplicate key error that we will ignore below
|
||||
--error 1022
|
||||
insert into t1 values(600),(NULL),(NULL);
|
||||
set @@insert_id=600;
|
||||
insert ignore into t1 values(600),(NULL),(NULL),(610),(NULL);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo ******* Select from Slave *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
connection master;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that auto-increment works when slave has rows in the table
|
||||
#
|
||||
|
||||
create table t1 (a int not null auto_increment, primary key (a)) engine=NDB;
|
||||
|
||||
sync_slave_with_master;
|
||||
insert into t1 values(2),(12),(22),(32),(42);
|
||||
connection master;
|
||||
|
||||
insert into t1 values (NULL),(NULL);
|
||||
insert into t1 values (3),(NULL),(NULL);
|
||||
--echo ******* Select from Master *************
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo ******* Select from Slave *************
|
||||
--echo
|
||||
--echo ** Slave should have 2, 12, 22, 32, 42 **
|
||||
--echo ** Master will have 2 but not 12, 22, 32, 42 **
|
||||
--echo
|
||||
select * from t1 ORDER BY a;
|
||||
connection master;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# End cleanup
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
182
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
Normal file
182
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_bank.test
Normal file
@@ -0,0 +1,182 @@
|
||||
#
|
||||
# Currently this test only runs in the source tree with the
|
||||
# ndb/test programs compiled.
|
||||
# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_bank
|
||||
#
|
||||
# 1. start a "bank" application running on the master cluster
|
||||
# 2. perform online sync of slave
|
||||
# 3. periodically check consistency of slave
|
||||
# 4. stop the bank application
|
||||
# 5. check that the slave and master BANK databases are the same
|
||||
#
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_ndb_extra.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
# kill any trailing processes
|
||||
--system killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL || true
|
||||
|
||||
--disable_warnings
|
||||
# initialize master
|
||||
--connection master
|
||||
CREATE DATABASE IF NOT EXISTS BANK;
|
||||
DROP DATABASE BANK;
|
||||
CREATE DATABASE BANK default charset=latin1 default collate=latin1_bin;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# These tables should correspond to the table definitions in
|
||||
# storage/ndb/test/src/NDBT_Tables.cpp
|
||||
#
|
||||
--connection master
|
||||
USE BANK;
|
||||
CREATE TABLE GL ( TIME BIGINT UNSIGNED NOT NULL,
|
||||
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
|
||||
BALANCE INT UNSIGNED NOT NULL,
|
||||
DEPOSIT_COUNT INT UNSIGNED NOT NULL,
|
||||
DEPOSIT_SUM INT UNSIGNED NOT NULL,
|
||||
WITHDRAWAL_COUNT INT UNSIGNED NOT NULL,
|
||||
WITHDRAWAL_SUM INT UNSIGNED NOT NULL,
|
||||
PURGED INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (TIME,ACCOUNT_TYPE))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE ACCOUNT ( ACCOUNT_ID INT UNSIGNED NOT NULL,
|
||||
OWNER INT UNSIGNED NOT NULL,
|
||||
BALANCE INT UNSIGNED NOT NULL,
|
||||
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (ACCOUNT_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE TRANSACTION ( TRANSACTION_ID BIGINT UNSIGNED NOT NULL,
|
||||
ACCOUNT INT UNSIGNED NOT NULL,
|
||||
ACCOUNT_TYPE INT UNSIGNED NOT NULL,
|
||||
OTHER_ACCOUNT INT UNSIGNED NOT NULL,
|
||||
TRANSACTION_TYPE INT UNSIGNED NOT NULL,
|
||||
TIME BIGINT UNSIGNED NOT NULL,
|
||||
AMOUNT INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (TRANSACTION_ID,ACCOUNT))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE SYSTEM_VALUES ( SYSTEM_VALUES_ID INT UNSIGNED NOT NULL,
|
||||
VALUE BIGINT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (SYSTEM_VALUES_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE ACCOUNT_TYPE ( ACCOUNT_TYPE_ID INT UNSIGNED NOT NULL,
|
||||
DESCRIPTION CHAR(64) NOT NULL,
|
||||
PRIMARY KEY USING HASH (ACCOUNT_TYPE_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
#
|
||||
# create "BANK" application
|
||||
#
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankCreator >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
#
|
||||
# start main loop
|
||||
# repeat backup-restore-check
|
||||
#
|
||||
|
||||
# set this high if testing to run many syncs in loop
|
||||
--let $2=1
|
||||
while ($2)
|
||||
{
|
||||
|
||||
#
|
||||
# start "BANK" application
|
||||
#
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTimer -w 5 >> $NDB_TOOLS_OUTPUT &
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankMakeGL >> $NDB_TOOLS_OUTPUT &
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/bank/bankTransactionMaker >> $NDB_TOOLS_OUTPUT &
|
||||
|
||||
#
|
||||
# let the "BANK" run for a while
|
||||
#
|
||||
--sleep 5
|
||||
|
||||
--disable_warnings
|
||||
# initialize slave for sync
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
# to make sure we drop any ndbcluster tables
|
||||
CREATE DATABASE IF NOT EXISTS BANK;
|
||||
DROP DATABASE BANK;
|
||||
# create database
|
||||
CREATE DATABASE BANK;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Time to sync the slave:
|
||||
# start by taking a backup on master
|
||||
--connection master
|
||||
RESET MASTER;
|
||||
--exec $NDB_MGM --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" -e "start backup" >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
# there is no neat way to find the backupid, this is a hack to find it...
|
||||
--exec $NDB_TOOLS_DIR/ndb_select_all --ndb-connectstring="$NDB_CONNECTSTRING" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat
|
||||
CREATE TABLE IF NOT EXISTS mysql.backup_info (id INT, backup_id INT) ENGINE = HEAP;
|
||||
DELETE FROM mysql.backup_info;
|
||||
LOAD DATA INFILE '../tmp.dat' INTO TABLE mysql.backup_info FIELDS TERMINATED BY ',';
|
||||
--exec rm $MYSQLTEST_VARDIR/tmp.dat || true
|
||||
--replace_column 1 <the_backup_id>
|
||||
SELECT @the_backup_id:=backup_id FROM mysql.backup_info;
|
||||
let the_backup_id=`select @the_backup_id`;
|
||||
|
||||
# restore on slave, first check that nothing is there
|
||||
--connection slave
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -p 8 -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
#
|
||||
# now setup replication to continue from last epoch
|
||||
--source include/ndb_setup_slave.inc
|
||||
--connection slave
|
||||
START SLAVE;
|
||||
|
||||
|
||||
#
|
||||
# Now loop and check consistency every 2 seconds on slave
|
||||
#
|
||||
--connection slave
|
||||
--let $1=10
|
||||
while ($1)
|
||||
{
|
||||
--sleep 2
|
||||
--replace_result $MASTER_MYPORT MASTER_PORT
|
||||
--replace_column 1 <Slave_IO_State> 7 <Read_Master_Log_Pos> 8 <Relay_Log_File> 9 <Relay_Log_Pos> 16 <Replicate_Ignore_Table> 22 <Exec_Master_Log_Pos> 23 <Relay_Log_Space> 33 <Seconds_Behind_Master> 34 <Last_IO_Errno> 35 <Last_IO_Error>
|
||||
SHOW SLAVE STATUS;
|
||||
STOP SLAVE;
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING_SLAVE ../storage/ndb/test/ndbapi/bank/bankValidateAllGLs >> $NDB_TOOLS_OUTPUT
|
||||
START SLAVE;
|
||||
--dec $1
|
||||
}
|
||||
|
||||
#
|
||||
# Stop transactions
|
||||
#
|
||||
--exec killall lt-bankTransactionMaker lt-bankTimer lt-bankMakeGL
|
||||
|
||||
#
|
||||
# Check that the databases are the same on slave and master
|
||||
# 1. dump database BANK on both master and slave
|
||||
# 2. compare, there should be no difference
|
||||
#
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/master_BANK.sql
|
||||
--connection master
|
||||
use test;
|
||||
create table t1 (a int primary key) engine=ndb;
|
||||
insert into t1 values (1);
|
||||
--sync_slave_with_master
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info BANK ACCOUNT_TYPE ACCOUNT GL TRANSACTION > $MYSQLTEST_VARDIR/tmp/slave_BANK.sql
|
||||
--connection master
|
||||
drop table t1;
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/master_BANK.sql $MYSQLTEST_VARDIR/tmp/slave_BANK.sql;
|
||||
|
||||
--dec $2
|
||||
}
|
||||
--source include/rpl_end.inc
|
||||
261
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
Normal file
261
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test
Normal file
@@ -0,0 +1,261 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
|
||||
|
||||
#
|
||||
# Bug #11087
|
||||
#
|
||||
# connect to the master and create tabe t1 in gotoslave database
|
||||
--connection master
|
||||
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
||||
`nom` char(4) default NULL,
|
||||
`prenom` char(4) default NULL,
|
||||
PRIMARY KEY (`nid`))
|
||||
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
||||
select * from t1 order by nid;
|
||||
|
||||
--sync_slave_with_master
|
||||
# connect to slave and ensure data it there.
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
||||
--connection master
|
||||
delete from t1;
|
||||
INSERT INTO t1 VALUES(1,"XYZ2","ABC2");
|
||||
# Make sure all rows are on the master
|
||||
select * from t1 order by nid;
|
||||
|
||||
# make sure all rows are on the slave.
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
# Bug #11087 would have row with nid 2 missing
|
||||
select * from t1 order by nid;
|
||||
|
||||
--connection master
|
||||
delete from t1;
|
||||
insert into t1 values(1,"AA", "AA");
|
||||
insert into t1 values(2,"BB", "BB");
|
||||
insert into t1 values(3,"CC", "CC");
|
||||
insert into t1 values(4,"DD", "DD");
|
||||
|
||||
begin;
|
||||
# delete+insert = update
|
||||
delete from t1 where nid = 1;
|
||||
insert into t1 values (1,"A2", "A2");
|
||||
|
||||
# update+delete = delete
|
||||
update t1 set nom="B2" where nid = 2;
|
||||
delete from t1 where nid = 2;
|
||||
|
||||
# multi-update
|
||||
update t1 set nom = "D2" where nid = 4;
|
||||
delete from t1 where nid = 4;
|
||||
insert into t1 values (4, "D3", "D3");
|
||||
update t1 set nom = "D4" where nid = 4;
|
||||
|
||||
# insert+delete = nothing
|
||||
insert into t1 values (5, "EE", "EE");
|
||||
delete from t1 where nid = 5;
|
||||
|
||||
commit;
|
||||
select * from t1 order by 1;
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select * from t1 order by 1;
|
||||
--connection master
|
||||
DROP table t1;
|
||||
|
||||
#
|
||||
# Test replication of table with no primary key
|
||||
#
|
||||
--connection master
|
||||
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
||||
`nom` char(4) default NULL,
|
||||
`prenom` char(4) default NULL)
|
||||
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO t1 VALUES(1,"XYZ1","ABC1"),(2,"AAA","BBB"),(3,"CCC","DDD");
|
||||
select * from t1 order by nid;
|
||||
|
||||
--sync_slave_with_master
|
||||
# connect to slave and ensure data it there.
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
||||
--connection master
|
||||
delete from t1 where nid = 2;
|
||||
INSERT INTO t1 VALUES(4,"EEE","FFF");
|
||||
# Make sure all rows are on the master
|
||||
select * from t1 order by nid;
|
||||
|
||||
# make sure all rows are on the slave.
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
||||
--connection master
|
||||
UPDATE t1 set nid=nid+1;
|
||||
UPDATE t1 set nom="CCP" where nid = 4;
|
||||
select * from t1 order by nid;
|
||||
|
||||
# make sure all rows are on the slave.
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
||||
--connection master
|
||||
DROP table t1;
|
||||
|
||||
#
|
||||
# Bug #27378 update becomes delete on slave
|
||||
#
|
||||
|
||||
--connection master
|
||||
CREATE TABLE `t1` (
|
||||
`prid` int(10) unsigned NOT NULL,
|
||||
`id_type` enum('IMSI','SIP') NOT NULL,
|
||||
`fkimssub` varchar(50) NOT NULL,
|
||||
`user_id` varchar(20) DEFAULT NULL,
|
||||
`password` varchar(20) DEFAULT NULL,
|
||||
`ptg_nbr` varchar(20) DEFAULT NULL,
|
||||
`old_tmsi` int(10) unsigned DEFAULT NULL,
|
||||
`new_tmsi` int(10) unsigned DEFAULT NULL,
|
||||
`dev_capability` int(10) unsigned DEFAULT NULL,
|
||||
`dev_oid` bigint(20) unsigned DEFAULT NULL,
|
||||
`lac_cell_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`ms_classmark1` int(10) unsigned DEFAULT NULL,
|
||||
`cipher_key` int(10) unsigned DEFAULT NULL,
|
||||
`priid_master` int(10) unsigned DEFAULT NULL,
|
||||
PRIMARY KEY (`prid`),
|
||||
UNIQUE KEY `fkimssub` (`fkimssub`,`ptg_nbr`) USING HASH
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
|
||||
INSERT INTO `t1` VALUES (183342,'IMSI','config3_sub_2Privates_3Publics_imssub_36668','user_id_73336','user_id_73336','73336',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(47617,'IMSI','config3_sub_2Privates_3Publics_imssub_9523','user_id_19046','user_id_19046','19046',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(200332,'IMSI','config3_sub_2Privates_3Publics_imssub_40066','user_id_80132','user_id_80132','80132',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(478882,'IMSI','config3_sub_2Privates_3Publics_imssub_95776','user_id_191552','user_id_191552','191552',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(490146,'IMSI','config3_sub_2Privates_3Publics_imssub_98029','user_id_196057','user_id_196057','196057',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(499301,'IMSI','config3_sub_2Privates_3Publics_imssub_99860','user_id_199719','user_id_199719','199719',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(506101,'IMSI','config3_sub_2Privates_3Publics_imssub_101220','user_id_202439','user_id_202439','202439',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(510142,'IMSI','config3_sub_2Privates_3Publics_imssub_102028','user_id_204056','user_id_204056','204056',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(515871,'IMSI','config3_sub_2Privates_3Publics_imssub_103174','user_id_206347','user_id_206347','206347',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(209842,'IMSI','config3_sub_2Privates_3Publics_imssub_41968','user_id_83936','user_id_83936','83936',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL),(365902,'IMSI','config3_sub_2Privates_3Publics_imssub_73180','user_id_146360','user_id_146360','146360',NULL,NULL,NULL,1010,NULL,NULL,NULL,NULL),(11892,'IMSI','config3_sub_2Privates_3Publics_imssub_2378','user_id_4756','user_id_4756','4756',NULL,NULL,NULL,123456789,NULL,NULL,NULL,NULL);
|
||||
|
||||
select count(*) from t1;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select count(*) from t1;
|
||||
|
||||
--connection master
|
||||
update t1 set dev_oid=dev_oid+1;
|
||||
select count(*) from t1;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select count(*) from t1;
|
||||
|
||||
--connection master
|
||||
DROP table t1;
|
||||
|
||||
##################################################################
|
||||
#
|
||||
# Check that retries are made on the slave on some temporary errors
|
||||
#
|
||||
|
||||
#
|
||||
# 1. Deadlock
|
||||
#
|
||||
--connection master
|
||||
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
||||
`nom` char(4) default NULL,
|
||||
`prenom` char(4) default NULL,
|
||||
PRIMARY KEY USING HASH (`nid`))
|
||||
ENGINE=ndbcluster DEFAULT CHARSET=latin1;
|
||||
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
||||
|
||||
# cause a lock on that row on the slave
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
--echo **** On Slave ****
|
||||
BEGIN;
|
||||
UPDATE t1 SET `nom`="LOCK" WHERE `nid`=1;
|
||||
|
||||
# set number of retries low so we fail the retries
|
||||
set GLOBAL slave_transaction_retries=1;
|
||||
|
||||
# now do a change to this row on the master
|
||||
# will deadlock on the slave because of lock above
|
||||
--connection master
|
||||
--echo **** On Master ****
|
||||
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
|
||||
|
||||
--echo **** On Slave ****
|
||||
# Wait for deadlock to be detected.
|
||||
# When detected, the slave will stop, so we just wait for it to stop.
|
||||
connection slave;
|
||||
|
||||
# Replication should have stopped, since max retries were not enough.
|
||||
# verify with show slave status
|
||||
# 1205 = ER_LOCK_WAIT_TIMEOUT
|
||||
--let $slave_sql_errno= 1205
|
||||
--let $show_slave_sql_error= 1
|
||||
--source include/wait_for_slave_sql_error.inc
|
||||
|
||||
# now set max retries high enough to succeed, and start slave again
|
||||
set GLOBAL slave_transaction_retries=10;
|
||||
source include/start_slave.inc;
|
||||
# Wait for deadlock to be detected and retried.
|
||||
# We want to wait until at least one retry has been made, but before
|
||||
# the slave stops. currently, there is no safe way to do that: we
|
||||
# would need to access the retry counter, but that is not exposed.
|
||||
# Failing that, we just wait sufficiently long that one but not all
|
||||
# retries have been made. See BUG#35183.
|
||||
sleep 5;
|
||||
|
||||
# commit transaction to release lock on row and let replication succeed
|
||||
select * from t1 order by nid;
|
||||
COMMIT;
|
||||
|
||||
# verify that the row succeded to be applied on the slave
|
||||
--connection master
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select * from t1 order by nid;
|
||||
|
||||
# cleanup
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# BUG#18094
|
||||
# Slave caches invalid table definition after atlters causes select failure
|
||||
#
|
||||
--connection master
|
||||
CREATE TABLE t1 (c1 INT KEY) ENGINE=NDB;
|
||||
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
|
||||
|
||||
ALTER TABLE t1 ADD c2 INT;
|
||||
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SELECT * FROM t1 ORDER BY c1;
|
||||
|
||||
connection master;
|
||||
ALTER TABLE t1 CHANGE c2 c2 TEXT CHARACTER SET utf8;
|
||||
ALTER TABLE t1 CHANGE c2 c2 BLOB;
|
||||
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
# here we would get error 1412 prior to bug
|
||||
SELECT * FROM t1 ORDER BY c1 LIMIT 5;
|
||||
|
||||
--connection master
|
||||
TRUNCATE t1;
|
||||
SELECT count(*) FROM t1;
|
||||
INSERT INTO t1 VALUES (101,NULL),(102,NULL),(103,NULL),(104,NULL),(105,NULL),(106,NULL),(107,NULL),(108,NULL),(109,NULL),(1010,NULL);
|
||||
--sync_slave_with_master
|
||||
connection slave;
|
||||
SELECT count(*) FROM t1;
|
||||
SELECT c1 FROM t1 ORDER BY c1 LIMIT 5;
|
||||
|
||||
# cleanup
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
--source include/rpl_end.inc
|
||||
142
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test
Normal file
142
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_blob.test
Normal file
@@ -0,0 +1,142 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# basic test of blob replication for NDB
|
||||
#
|
||||
|
||||
# easy test
|
||||
|
||||
--connection master
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null
|
||||
) engine=ndb;
|
||||
|
||||
insert into t1 values(1, repeat('abc',10));
|
||||
insert into t1 values(2, repeat('def',200));
|
||||
insert into t1 values(3, repeat('ghi',3000));
|
||||
|
||||
select 'M', a, sha1(b) from t1
|
||||
order by a;
|
||||
|
||||
--sync_slave_with_master
|
||||
--sleep 5
|
||||
--connection slave
|
||||
select 'S', a, sha1(b) from t1
|
||||
order by a;
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
# hard test
|
||||
|
||||
--connection master
|
||||
create table t1 (
|
||||
a int not null primary key,
|
||||
b text not null,
|
||||
c int,
|
||||
d longblob,
|
||||
e tinyblob
|
||||
) engine=ndbcluster;
|
||||
|
||||
--disable_query_log
|
||||
# length 61
|
||||
set @s0 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
|
||||
set @s1 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
|
||||
set @s2 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
|
||||
--enable_query_log
|
||||
|
||||
insert into t1 values (
|
||||
0, repeat(@s2,454), 100, repeat(@s2,345), NULL);
|
||||
insert into t1 values (
|
||||
1, repeat(@s0,504), NULL, repeat(@s1,732), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
2, '', 102, '', repeat(@s2,1));
|
||||
insert into t1 values (
|
||||
3, repeat(@s0,545), 103, repeat(@s2,788), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
4, repeat(@s1,38), 104, repeat(@s0,260), repeat(@s0,1));
|
||||
insert into t1 values (
|
||||
5, repeat(@s2,12), 105, repeat(@s2,40), repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
6, repeat(@s1,242), 106, NULL, repeat(@s1,1));
|
||||
insert into t1 values (
|
||||
7, repeat(@s1,30), 107, repeat(@s0,161), '');
|
||||
insert into t1 values (
|
||||
8, repeat(@s1,719), 108, repeat(@s2,104), NULL);
|
||||
insert into t1 values (
|
||||
9, repeat(@s2,427), NULL, NULL, NULL);
|
||||
|
||||
select 'M', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
|
||||
--sync_slave_with_master
|
||||
--sleep 5
|
||||
--connection slave
|
||||
select 'S', a, sha1(b), c, sha1(d), sha1(e)
|
||||
from t1 order by a;
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
# table with varsize key (future cluster/schema)
|
||||
|
||||
# sql/ha_ndbcluster_binlog.cc
|
||||
--connection master
|
||||
CREATE TABLE IF NOT EXISTS t1 (
|
||||
db VARBINARY(63) NOT NULL,
|
||||
name VARBINARY(63) NOT NULL,
|
||||
slock BINARY(32) NOT NULL,
|
||||
query BLOB NOT NULL,
|
||||
node_id INT UNSIGNED NOT NULL,
|
||||
epoch BIGINT UNSIGNED NOT NULL,
|
||||
id INT UNSIGNED NOT NULL,
|
||||
version INT UNSIGNED NOT NULL,
|
||||
type INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (db,name))
|
||||
ENGINE=NDB;
|
||||
|
||||
insert into t1 values ('test','t1',
|
||||
'abc',repeat(@s0,10), 11,12,13,14,15);
|
||||
insert into t1 values ('test','t2',
|
||||
'def',repeat(@s1,100), 21,22,23,24,25);
|
||||
insert into t1 values ('test','t3',
|
||||
'ghi',repeat(@s2,1000),31,32,33,34,35);
|
||||
insert into t1 values ('testtttttttttt','t1',
|
||||
'abc',repeat(@s0,10), 11,12,13,14,15);
|
||||
insert into t1 values ('testttttttttttt','t1',
|
||||
'def',repeat(@s1,100), 21,22,23,24,25);
|
||||
insert into t1 values ('testtttttttttttt','t1',
|
||||
'ghi',repeat(@s2,1000),31,32,33,34,35);
|
||||
insert into t1 values ('t','t11111111111',
|
||||
'abc',repeat(@s0,10), 11,12,13,14,15);
|
||||
insert into t1 values ('t','t111111111111',
|
||||
'def',repeat(@s1,100), 21,22,23,24,25);
|
||||
insert into t1 values ('t','t1111111111111',
|
||||
'ghi',repeat(@s2,1000),31,32,33,34,35);
|
||||
|
||||
select 'M', db, name, sha1(query), node_id, epoch, id, version, type
|
||||
from t1 order by db, name;
|
||||
|
||||
--sync_slave_with_master
|
||||
--sleep 5
|
||||
--connection slave
|
||||
select 'S', db, name, sha1(query), node_id, epoch, id, version, type
|
||||
from t1 order by db, name;
|
||||
|
||||
--connection master
|
||||
drop table t1;
|
||||
--sync_slave_with_master
|
||||
|
||||
#
|
||||
# view the binlog - not deterministic (mats)
|
||||
#
|
||||
|
||||
#--connection master
|
||||
#let $VERSION=`select version()`;
|
||||
#--replace_result $VERSION VERSION
|
||||
#show binlog events;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
#################################
|
||||
# Wrapper for rpl_row_blob.test #
|
||||
# Using wrapper to share test #
|
||||
# code between engine tests #
|
||||
#################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDBCLUSTER;
|
||||
-- source extra/rpl_tests/rpl_row_blob.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,57 @@
|
||||
--source include/have_ndb.inc
|
||||
|
||||
# set up circular replication
|
||||
--let $rpl_topology= 1->2->1
|
||||
--source include/rpl_init.inc
|
||||
|
||||
--let $rpl_connection_name= master
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_connect.inc
|
||||
|
||||
--let $rpl_connection_name= slave
|
||||
--let $rpl_server_number= 2
|
||||
--source include/rpl_connect.inc
|
||||
|
||||
|
||||
# create the table on the "slave"
|
||||
--connection slave
|
||||
CREATE TABLE t1 (a int key, b int) ENGINE=ndb;
|
||||
#CREATE TABLE t2 (a int key, b int) ENGINE=ndb;
|
||||
sync_slave_with_master master;
|
||||
# now we should have a table on the master as well
|
||||
SHOW TABLES;
|
||||
|
||||
# insert some values on the slave and master
|
||||
--connection master
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
--connection slave
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
|
||||
# ensure data has propagated both ways
|
||||
--connection slave
|
||||
sync_slave_with_master master;
|
||||
--sync_slave_with_master
|
||||
|
||||
# connect to slave and ensure data it there.
|
||||
--connection slave
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
#SELECT * FROM t2 ORDER BY a;
|
||||
source include/check_slave_is_running.inc;
|
||||
# connect to master and ensure data it there.
|
||||
--connection master
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
#SELECT * FROM t2 ORDER BY a;
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
# stop replication on "master" as not to replicate
|
||||
# shutdown circularly, eg drop table
|
||||
--connection master
|
||||
STOP SLAVE;
|
||||
|
||||
# cleanup
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,24 @@
|
||||
!include ../my.cnf
|
||||
|
||||
[mysqld.1.1]
|
||||
server-id= 1
|
||||
log-bin
|
||||
|
||||
[mysqld.2.1]
|
||||
server-id= 1
|
||||
log-bin
|
||||
|
||||
[mysqld.1.slave]
|
||||
server-id= 2
|
||||
log-bin
|
||||
skip-slave-start
|
||||
|
||||
[mysqld.2.slave]
|
||||
server-id= 2
|
||||
log-bin
|
||||
ndb_connectstring= @mysql_cluster.slave.ndb_connectstring
|
||||
|
||||
[ENV]
|
||||
|
||||
SLAVE_MYPORT1= @mysqld.2.slave.port
|
||||
SLAVE_MYSOCK1= @mysqld.2.slave.socket
|
||||
@@ -0,0 +1,167 @@
|
||||
#############################################################
|
||||
# Author: Serge Kozlov <skozlov@mysql.com>
|
||||
# Date: 03/17/2008
|
||||
# Purpose: Testing cluster circular replication based on two
|
||||
# independent channels between two clusters
|
||||
#############################################################
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave_2ch.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--echo
|
||||
|
||||
# Check server_id and set auto_increment_* variables
|
||||
--echo *** Check server_id of mysqld servers ***
|
||||
--connection master
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection master1
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 1;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection slave
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
--connection slave1
|
||||
SHOW VARIABLES LIKE "server_id";
|
||||
SET auto_increment_offset = 2;
|
||||
SET auto_increment_increment = 2;
|
||||
--echo
|
||||
|
||||
# Preparing data.
|
||||
--echo *** Preparing data ***
|
||||
--connection master
|
||||
CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=ndb;
|
||||
|
||||
let $wait_binlog_event= CREATE TABLE t1;
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection master1
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection slave
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--connection slave1
|
||||
--source include/wait_for_binlog_event.inc
|
||||
--echo
|
||||
|
||||
#
|
||||
# Testing
|
||||
#
|
||||
|
||||
--echo *** Basic testing ***
|
||||
# insert data via all hosts
|
||||
--echo Insert rows via all hosts
|
||||
--disable_query_log
|
||||
let $counter= 10;
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',1);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',1);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',1);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',1);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
|
||||
# Wait replication between clusters
|
||||
let $wait_condition= SELECT COUNT(*)=40 FROM t1 WHERE c = 1;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
# Check data
|
||||
--echo Check data on both clusters
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo *** Transaction testing ***
|
||||
# Start transaction for one mysqld and do mass of inserts for other.
|
||||
# Do it for for both clusters
|
||||
|
||||
--connection master
|
||||
BEGIN;
|
||||
--connection slave1
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',2);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',2);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',2);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',2);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
--connection slave1
|
||||
COMMIT;
|
||||
|
||||
# Wait replication between clusters
|
||||
--connection master
|
||||
let $wait_condition= SELECT COUNT(*)=400 FROM t1 WHERE c = 2;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo Check data on both clusters
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
# Start transaction and then roll back
|
||||
|
||||
--connection master
|
||||
BEGIN;
|
||||
--connection slave1
|
||||
BEGIN;
|
||||
let $counter= 100;
|
||||
--connection master
|
||||
--disable_query_log
|
||||
while ($counter) {
|
||||
--connection master
|
||||
INSERT INTO t1(b,c) VALUES('master',3);
|
||||
--connection master1
|
||||
INSERT INTO t1(b,c) VALUES('master1',3);
|
||||
--connection slave
|
||||
INSERT INTO t1(b,c) VALUES('slave',3);
|
||||
--connection slave1
|
||||
INSERT INTO t1(b,c) VALUES('slave1',3);
|
||||
dec $counter;
|
||||
}
|
||||
--connection master
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
--connection slave1
|
||||
ROLLBACK;
|
||||
|
||||
# Wait replication between clusters
|
||||
--connection master
|
||||
let $wait_condition= SELECT COUNT(*)=200 FROM t1 WHERE c = 3;
|
||||
--source include/wait_condition.inc
|
||||
--connection slave
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--echo Check data on both clusters
|
||||
let $diff_tables= master:t1, slave:t1;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
# Clean up
|
||||
--connection master
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--connection slave
|
||||
# Wait until table is dropped on slave.
|
||||
--let $query= SELECT COUNT(*) FROM t1
|
||||
--source include/wait_for_query_to_fail.inc
|
||||
--echo
|
||||
|
||||
# End of test 5.1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,81 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
connection master;
|
||||
CREATE TABLE t1 (a int key, b int) ENGINE=NDB;
|
||||
sync_slave_with_master;
|
||||
SHOW TABLES;
|
||||
|
||||
# Lose the events from the slave binary log: there is no
|
||||
# need to re-create the table on the master.
|
||||
connection slave;
|
||||
RESET MASTER;
|
||||
|
||||
# Insert some values on the slave and master
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1,2);
|
||||
# Switch to slave once event is applied and insert a row
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
INSERT INTO t1 VALUES (2,3);
|
||||
|
||||
# ... it is now very probable that we have a mixed event in the binary
|
||||
# log. If we don't, the test should still pass, but will not test the
|
||||
# mixed event situation.
|
||||
|
||||
# The statement is disabled since it cannot reliably show the same
|
||||
# info all the time. Use it for debug purposes.
|
||||
|
||||
#SHOW BINLOG EVENTS;
|
||||
|
||||
# Replicate back to the master to test this mixed event on the master
|
||||
STOP SLAVE;
|
||||
|
||||
--let $rpl_topology= 1->2->1
|
||||
--source include/rpl_change_topology.inc
|
||||
connection master;
|
||||
|
||||
START SLAVE;
|
||||
|
||||
connection slave;
|
||||
sync_slave_with_master master;
|
||||
|
||||
# The statement is disabled since it cannot reliably show the same
|
||||
# info all the time. Use it for debug purposes.
|
||||
|
||||
#SHOW BINLOG EVENTS;
|
||||
|
||||
# Check that there is no error in replication
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
# Check that we have the data on the master
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# We should now have another mixed event, likely with "slave" server
|
||||
# id last, and with the STMT_END_F flag set.
|
||||
|
||||
# The statement is disabled since it cannot reliably show the same
|
||||
# info all the time. Use it for debug purposes.
|
||||
|
||||
#SHOW BINLOG EVENTS;
|
||||
|
||||
# now lets see that this data is applied correctly on the slave
|
||||
STOP SLAVE;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
|
||||
# check that we have the data on the slave
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
# Check that there is no error in replication
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
-- connection master
|
||||
DROP TABLE t1;
|
||||
-- sync_slave_with_master
|
||||
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
#####################################
|
||||
# Wrapper for rpl_commit_after_flush#
|
||||
# Wrapped to reuse test code on #
|
||||
# Different engines #
|
||||
# By JBM 2004-02-15 #
|
||||
#####################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_commit_after_flush.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,44 @@
|
||||
--source include/have_ucs2.inc
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# MySQL Bug#15276: MySQL ignores collation-server
|
||||
#
|
||||
show variables like 'collation_server';
|
||||
|
||||
#
|
||||
# Check that NDB replication doesn't explode with default charset
|
||||
# being multibyte.
|
||||
#
|
||||
# Theorised that this could be a problem when dealing with:
|
||||
# Bug #27404 util thd mysql_parse sig11 when mysqld default multibyte charset
|
||||
#
|
||||
# Sort of related to:
|
||||
# Bug#18004 Connecting crashes server when default charset is UCS2
|
||||
#
|
||||
#
|
||||
show variables like "%character_set_ser%";
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE `t1` ( `nid` int(11) NOT NULL default '0',
|
||||
`nom` char(4) default NULL,
|
||||
`prenom` char(4) default NULL,
|
||||
PRIMARY KEY (`nid`))
|
||||
ENGINE=ndbcluster;
|
||||
|
||||
INSERT INTO t1 VALUES(1,"XYZ1","ABC1");
|
||||
select * from t1 order by nid;
|
||||
|
||||
sync_slave_with_master;
|
||||
# connect to slave and ensure data it there.
|
||||
connection slave;
|
||||
select * from t1 order by nid;
|
||||
|
||||
--echo ==== clean up ====
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,85 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# Basic test of disk tables for NDB
|
||||
#
|
||||
|
||||
#
|
||||
# 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;
|
||||
|
||||
#
|
||||
# Create a table using this tablespace
|
||||
#
|
||||
|
||||
CREATE TABLE t1
|
||||
(pk1 int not null primary key, b int not null, c int not null)
|
||||
tablespace ts1 storage disk
|
||||
engine ndb;
|
||||
|
||||
#
|
||||
# insert some data
|
||||
#
|
||||
|
||||
insert into t1 values (1,2,3);
|
||||
select * from t1 order by pk1;
|
||||
|
||||
#
|
||||
# check that the data is also on the slave
|
||||
#
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
select * from t1 order by pk1;
|
||||
|
||||
#
|
||||
# view the binlog
|
||||
#
|
||||
|
||||
--connection master
|
||||
-- source include/show_binlog_events2.inc
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
|
||||
drop table t1;
|
||||
alter tablespace ts1
|
||||
drop datafile 'datafile.dat'
|
||||
engine=ndb;
|
||||
alter tablespace ts1
|
||||
drop datafile 'datafile02.dat'
|
||||
engine=ndb;
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,311 @@
|
||||
#######################################
|
||||
# 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_mixed_or_row.inc
|
||||
--source include/ndb_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;
|
||||
alter tablespace ts1
|
||||
drop datafile 'datafile.dat'
|
||||
engine=ndb;
|
||||
alter tablespace ts1
|
||||
drop datafile 'datafile02.dat'
|
||||
engine=ndb;
|
||||
DROP TABLESPACE ts1 ENGINE=NDB;
|
||||
DROP LOGFILE GROUP lg1 ENGINE=NDB;
|
||||
--sync_slave_with_master
|
||||
|
||||
# End of 5.1 test case
|
||||
--source include/rpl_end.inc
|
||||
34
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test
Normal file
34
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_ddl.test
Normal file
@@ -0,0 +1,34 @@
|
||||
#################### rpl_ndb_ddl.test ########################
|
||||
# #
|
||||
# DDL statements (sometimes with implicit COMMIT) executed #
|
||||
# by the master and it's propagation into the slave #
|
||||
# #
|
||||
##############################################################
|
||||
|
||||
#
|
||||
# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !!
|
||||
#
|
||||
# 1. !All! objects to be dropped, renamed, altered ... must be created
|
||||
# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test
|
||||
# sequences start.
|
||||
#
|
||||
# 2. Never use a test object, which was direct or indirect affected by a
|
||||
# preceeding test sequence again.
|
||||
# Except table d1.t1 where ONLY DML is allowed.
|
||||
#
|
||||
# If one preceeding test sequence hits a (sometimes not good visible,
|
||||
# because the sql error code of the statement might be 0) bug
|
||||
# and these rules are ignored, a following test sequence might earn ugly
|
||||
# effects like failing 'sync_slave_with_master', crashes of the slave or
|
||||
# abort of the test case etc..
|
||||
#
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
let $engine_type= NDB;
|
||||
let $temp_engine_type= MEMORY;
|
||||
let $show_binlog = 0;
|
||||
let $manipulate = 0;
|
||||
-- source extra/rpl_tests/rpl_ddl.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,9 @@
|
||||
#########################################
|
||||
# By JBM 2006-02-14 Test wrapping to #
|
||||
# Share test code between engine tests #
|
||||
#########################################
|
||||
--source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_delete_no_where.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,57 @@
|
||||
###########################################################
|
||||
# Author: Jeb
|
||||
# Date: 14-12-2006
|
||||
# Purpose: To test --replicate-do-database=db_name
|
||||
# using cluster. Only replica should replicate.
|
||||
##########################################################
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS replica;
|
||||
--enable_warnings
|
||||
|
||||
# Create database and tables for the test.
|
||||
CREATE DATABASE replica;
|
||||
CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
USE replica;
|
||||
CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
|
||||
# Insert data into db that should not be picked up by slave
|
||||
USE test;
|
||||
INSERT INTO t1 VALUES(1, repeat('abc',10));
|
||||
INSERT INTO t2 VALUES(1, repeat('abc',10));
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
# Insert data into db that should be replicated
|
||||
USE replica;
|
||||
INSERT INTO replica.t1 VALUES(2, repeat('def',200));
|
||||
INSERT INTO replica.t2 VALUES(2, repeat('def',200));
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
# Check results on slave
|
||||
--sync_slave_with_master
|
||||
SHOW TABLES;
|
||||
USE replica;
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
USE test;
|
||||
SHOW TABLES;
|
||||
|
||||
# Cleanup from testing
|
||||
connection master;
|
||||
USE test;
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE IF EXISTS replica;
|
||||
--sync_slave_with_master
|
||||
|
||||
# End 5.1 test case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,46 @@
|
||||
###########################################################
|
||||
# Author: Jeb
|
||||
# Date: 14-12-2006
|
||||
# Purpose: To test --replicate-do-table=db_name.tbl_name
|
||||
# using cluster. Only t1 should replicate.
|
||||
##########################################################
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
|
||||
INSERT INTO t1 VALUES(1, repeat('abc',10));
|
||||
INSERT INTO t1 VALUES(2, repeat('def',200));
|
||||
INSERT INTO t1 VALUES(3, repeat('ghi',3000));
|
||||
INSERT INTO t2 VALUES(1, repeat('abc',10));
|
||||
INSERT INTO t2 VALUES(2, repeat('def',200));
|
||||
INSERT INTO t2 VALUES(3, repeat('ghi',3000));
|
||||
|
||||
--sync_slave_with_master
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
#
|
||||
# Bug #27044 replicated with unique field ndb table allows dup key inserts
|
||||
#
|
||||
connection master;
|
||||
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (3, repeat('bad',1));
|
||||
|
||||
connection slave;
|
||||
--error ER_DUP_ENTRY
|
||||
INSERT INTO t1 VALUES (3, repeat('bad too',1));
|
||||
|
||||
# cleanup
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
--sync_slave_with_master
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,14 @@
|
||||
###########################################
|
||||
# Author: Jeb
|
||||
# Date: 2006-09-08
|
||||
# Purpose: Wapper for rpl_extraSlave_Col.test
|
||||
# Using NDB
|
||||
###########################################
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type = 'NDB';
|
||||
-- source extra/rpl_tests/rpl_extraSlave_Col.test
|
||||
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,13 @@
|
||||
###################################
|
||||
# Wrapper for rpl_row_func003.test#
|
||||
# This test was orginally designed#
|
||||
# To test InnoDB using RBR, but #
|
||||
# It can also be used to test NDB #
|
||||
# So this wrapper is being used to#
|
||||
# reduce test case code #
|
||||
###################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_row_func003.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,109 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# Currently test only works with ndb since it retrieves "old"
|
||||
# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
|
||||
#
|
||||
|
||||
# create a table with one row
|
||||
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
|
||||
INSERT INTO t1 VALUES ("row1","will go away",1);
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
# sync slave and retrieve epoch
|
||||
sync_slave_with_master;
|
||||
--replace_column 1 <the_epoch>
|
||||
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
|
||||
let $the_epoch= `select @the_epoch` ;
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
# get the master binlog pos from the epoch
|
||||
connection master;
|
||||
--replace_result $the_epoch <the_epoch>
|
||||
--replace_column 1 <the_pos>
|
||||
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
|
||||
FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
|
||||
let $the_pos= `SELECT @the_pos` ;
|
||||
let $the_file= `SELECT @the_file` ;
|
||||
|
||||
# insert some more values
|
||||
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
|
||||
DELETE FROM t1 WHERE c3 = 1;
|
||||
UPDATE t1 SET c2="should go away" WHERE c3 = 2;
|
||||
UPDATE t1 SET c2="C" WHERE c3 = 3;
|
||||
DELETE FROM t1 WHERE c3 = 2;
|
||||
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
# check that we have it on the slave
|
||||
--sync_slave_with_master
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
# stop slave and reset position to before the last changes
|
||||
STOP SLAVE;
|
||||
--replace_result $the_pos <the_pos>
|
||||
eval CHANGE MASTER TO
|
||||
master_log_file = '$the_file',
|
||||
master_log_pos = $the_pos ;
|
||||
|
||||
source include/check_slave_no_error.inc;
|
||||
|
||||
# start the slave again
|
||||
# -> same events should have been applied again
|
||||
# e.g. inserting rows that already there
|
||||
# deleting a row which is not there
|
||||
# updating a row which is not there
|
||||
START SLAVE;
|
||||
|
||||
--connection master
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
--sync_slave_with_master
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
STOP SLAVE;
|
||||
|
||||
#
|
||||
# cleanup
|
||||
#
|
||||
--connection master
|
||||
DROP TABLE t1;
|
||||
RESET master;
|
||||
--connection slave
|
||||
DROP TABLE t1;
|
||||
RESET slave;
|
||||
|
||||
START SLAVE;
|
||||
|
||||
#
|
||||
# Test that we can handle update of a row that does not exist on the slave
|
||||
# will trigger usage of AO_IgnoreError on slave side so that the INSERT
|
||||
# still succeeds even if the replication of the UPDATE generates an error.
|
||||
#
|
||||
--connection master
|
||||
CREATE TABLE t1 (c1 CHAR(15) NOT NULL, c2 CHAR(15) NOT NULL, c3 INT NOT NULL, PRIMARY KEY (c3)) ENGINE = NDB ;
|
||||
INSERT INTO t1 VALUES ("row1","remove on slave",1);
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
DELETE FROM t1;
|
||||
|
||||
--connection master
|
||||
BEGIN;
|
||||
UPDATE t1 SET c2="does not exist" WHERE c3=1;
|
||||
INSERT INTO t1 VALUES ("row2","new on slave",2);
|
||||
COMMIT;
|
||||
|
||||
--sync_slave_with_master
|
||||
--connection slave
|
||||
SELECT * FROM t1;
|
||||
source include/check_slave_is_running.inc;
|
||||
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
# End of 5.1 Test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,16 @@
|
||||
#############################################################
|
||||
# Author: JBM
|
||||
# Date: 2006-02-24
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to innodb, or myisam, or replicate from innodb/myisam to
|
||||
# cluster slave. Due to limitations I have created wrappers
|
||||
# to be able to use the same code for all these different
|
||||
# test and to have control over the tests.
|
||||
##############################################################
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
SET storage_engine=innodb;
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,67 @@
|
||||
# Test of a transaction mixing the two engines
|
||||
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
create table t1 (a int, unique(a)) engine=ndbcluster;
|
||||
create table t2 (a int, unique(a)) engine=innodb;
|
||||
|
||||
|
||||
begin;
|
||||
insert into t1 values(1);
|
||||
insert into t2 values(1);
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
begin;
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
begin;
|
||||
insert into t2 values(3),(4);
|
||||
insert into t1 values(3),(4);
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t2;
|
||||
load data infile '../../../std_data/rpl_loaddata.dat' into table t1;
|
||||
rollback;
|
||||
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
sync_slave_with_master;
|
||||
select count(*) from t1;
|
||||
select count(*) from t2;
|
||||
connection master;
|
||||
|
||||
drop table t1,t2;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,9 @@
|
||||
#####################################
|
||||
# Wrapper for rpl_insert_ignore.test#
|
||||
#####################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
let $engine_type2=myisam;
|
||||
-- source extra/rpl_tests/rpl_insert_ignore.test
|
||||
--source include/rpl_end.inc
|
||||
67
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
Normal file
67
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_load.test
Normal file
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# Currently this test only runs in the source tree with the
|
||||
# ndb/test programs compiled.
|
||||
# invoke with: ./mysql-test-run --ndb-extra-test --do-test=rpl_ndb_load
|
||||
#
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_ndb_extra.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
# reset master
|
||||
connection master;
|
||||
DROP DATABASE IF EXISTS TEST_DB;
|
||||
CREATE DATABASE TEST_DB;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
# These tables should correspond to the table definitions in
|
||||
# storage/ndb/test/ndbapi/bench/
|
||||
#
|
||||
connection master;
|
||||
USE TEST_DB;
|
||||
CREATE TABLE SUBSCRIBER
|
||||
( NUMBER CHAR(12) BINARY NOT NULL,
|
||||
NAME CHAR(32) BINARY NOT NULL,
|
||||
GROUP_ID INT UNSIGNED NOT NULL,
|
||||
LOCATION INT UNSIGNED NOT NULL,
|
||||
SESSIONS INT UNSIGNED NOT NULL,
|
||||
CHANGED_BY CHAR(32) BINARY NOT NULL,
|
||||
CHANGED_TIME CHAR(32) BINARY NOT NULL,
|
||||
PRIMARY KEY USING HASH (NUMBER))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE GROUP_T
|
||||
( GROUP_ID INT UNSIGNED NOT NULL,
|
||||
GROUP_NAME CHAR(32) BINARY NOT NULL,
|
||||
ALLOW_READ CHAR(1) BINARY NOT NULL,
|
||||
ALLOW_INSERT INT UNSIGNED NOT NULL,
|
||||
ALLOW_DELETE INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (GROUP_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE SESSION
|
||||
( NUMBER CHAR(12) BINARY NOT NULL,
|
||||
SERVER_ID INT UNSIGNED NOT NULL,
|
||||
DATA VARBINARY(1998) NOT NULL,
|
||||
PRIMARY KEY USING HASH (NUMBER,SERVER_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
CREATE TABLE SERVER
|
||||
( SUFFIX CHAR(2) BINARY NOT NULL,
|
||||
SERVER_ID INT UNSIGNED NOT NULL,
|
||||
NAME CHAR(32) BINARY NOT NULL,
|
||||
NO_OF_READ INT UNSIGNED NOT NULL,
|
||||
NO_OF_INSERT INT UNSIGNED NOT NULL,
|
||||
NO_OF_DELETE INT UNSIGNED NOT NULL,
|
||||
PRIMARY KEY USING HASH (SUFFIX, SERVER_ID))
|
||||
ENGINE = NDB;
|
||||
|
||||
#
|
||||
# start "load" application
|
||||
#
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbCreate >> $NDB_TOOLS_OUTPUT
|
||||
--exec NDB_CONNECTSTRING=$NDB_CONNECTSTRING ../storage/ndb/test/ndbapi/DbAsyncGenerator >> $NDB_TOOLS_OUTPUT
|
||||
--source include/rpl_end.inc
|
||||
14
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test
Normal file
14
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_log.test
Normal file
@@ -0,0 +1,14 @@
|
||||
###################################
|
||||
# Wrapper for rpl_row_log.test #
|
||||
# Added wrapper so that MyISAM & #
|
||||
# Innodb and NDB could all use the#
|
||||
# Same test. NDB produced a diff #
|
||||
# bin-log #
|
||||
###################################
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_log.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,470 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Tests that transactions containing multiple table types are
|
||||
# replicated correctly to the slave.
|
||||
#
|
||||
# This test was previously part of rpl_ndb_transactions.
|
||||
#
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Try all combinations of the following:
|
||||
# - Committed/rollback transactions.
|
||||
# - Transactions started by AUTOCOMMIT = 0 or BEGIN.
|
||||
# - Transactions using myisam, innodb, or ndb tables, or combinations
|
||||
# of them. For combinations, we use the engines in all possible
|
||||
# orders.
|
||||
# For single-engine transactions, we also try with AUTOCOMMIT = 1.
|
||||
#
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
|
||||
|
||||
|
||||
source include/have_ndb.inc;
|
||||
source include/ndb_master-slave.inc;
|
||||
source include/have_innodb.inc;
|
||||
|
||||
CREATE TABLE tmyisam (a int) ENGINE = MYISAM;
|
||||
CREATE TABLE tinnodb (a int) ENGINE = INNODB;
|
||||
CREATE TABLE tndb (a int) ENGINE = NDB;
|
||||
|
||||
SHOW CREATE TABLE tmyisam;
|
||||
SHOW CREATE TABLE tinnodb;
|
||||
SHOW CREATE TABLE tndb;
|
||||
|
||||
|
||||
--echo [on master]
|
||||
|
||||
|
||||
--echo ==== Single-engine transactions ====
|
||||
|
||||
--echo ---- autocommitted ----
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
INSERT INTO tmyisam VALUES (0);
|
||||
INSERT INTO tinnodb VALUES (1);
|
||||
INSERT INTO tndb VALUES (2);
|
||||
|
||||
--echo ---- committed with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (3);
|
||||
INSERT INTO tmyisam VALUES (4);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (5);
|
||||
INSERT INTO tinnodb VALUES (6);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (7);
|
||||
INSERT INTO tndb VALUES (8);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (9);
|
||||
INSERT INTO tmyisam VALUES (10);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (11);
|
||||
INSERT INTO tinnodb VALUES (12);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (13);
|
||||
INSERT INTO tndb VALUES (14);
|
||||
ROLLBACK;
|
||||
|
||||
|
||||
--echo ---- committed with AUTOCOMMIT = 0 ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
INSERT INTO tmyisam VALUES (15);
|
||||
INSERT INTO tmyisam VALUES (16);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tinnodb VALUES (17);
|
||||
INSERT INTO tinnodb VALUES (18);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (19);
|
||||
INSERT INTO tndb VALUES (20);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with AUTOCOMMIT = 0 ----
|
||||
|
||||
INSERT INTO tmyisam VALUES (21);
|
||||
INSERT INTO tmyisam VALUES (22);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tinnodb VALUES (23);
|
||||
INSERT INTO tinnodb VALUES (24);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tndb VALUES (25);
|
||||
INSERT INTO tndb VALUES (26);
|
||||
ROLLBACK;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
|
||||
--echo ==== MyISAM + InnoDB ====
|
||||
|
||||
--echo ---- committed with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (27);
|
||||
INSERT INTO tinnodb VALUES (28);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (29);
|
||||
INSERT INTO tmyisam VALUES (30);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (31);
|
||||
INSERT INTO tinnodb VALUES (32);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (33);
|
||||
INSERT INTO tmyisam VALUES (34);
|
||||
ROLLBACK;
|
||||
|
||||
--echo ---- committed with AUTOCOMMIT = 0 ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
INSERT INTO tmyisam VALUES (35);
|
||||
INSERT INTO tinnodb VALUES (36);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tinnodb VALUES (37);
|
||||
INSERT INTO tmyisam VALUES (38);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with AUTOCOMMIT = 0 ----
|
||||
|
||||
INSERT INTO tmyisam VALUES (39);
|
||||
INSERT INTO tinnodb VALUES (40);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tinnodb VALUES (41);
|
||||
INSERT INTO tmyisam VALUES (42);
|
||||
ROLLBACK;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
|
||||
--echo ==== MyISAM + NDB ====
|
||||
|
||||
--echo ---- committed with BEGIN----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (43);
|
||||
INSERT INTO tndb VALUES (44);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (45);
|
||||
INSERT INTO tmyisam VALUES (46);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (47);
|
||||
INSERT INTO tndb VALUES (48);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (49);
|
||||
INSERT INTO tmyisam VALUES (50);
|
||||
ROLLBACK;
|
||||
|
||||
--echo ---- committed with AUTOCOMMIT = 0 ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
INSERT INTO tmyisam VALUES (51);
|
||||
INSERT INTO tndb VALUES (52);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (53);
|
||||
INSERT INTO tmyisam VALUES (54);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with AUTOCOMMIT = 0 ----
|
||||
|
||||
INSERT INTO tmyisam VALUES (55);
|
||||
INSERT INTO tndb VALUES (56);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tndb VALUES (57);
|
||||
INSERT INTO tmyisam VALUES (58);
|
||||
ROLLBACK;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
|
||||
--echo ==== InnoDB + NDB ====
|
||||
|
||||
--echo ---- committed with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (59);
|
||||
INSERT INTO tndb VALUES (60);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (61);
|
||||
INSERT INTO tinnodb VALUES (62);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (63);
|
||||
INSERT INTO tndb VALUES (64);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (65);
|
||||
INSERT INTO tinnodb VALUES (66);
|
||||
ROLLBACK;
|
||||
|
||||
--echo ---- committed with AUTOCOMMIT = 0 ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
INSERT INTO tinnodb VALUES (67);
|
||||
INSERT INTO tndb VALUES (68);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (69);
|
||||
INSERT INTO tinnodb VALUES (70);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with AUTOCOMMIT = 0 ----
|
||||
|
||||
INSERT INTO tinnodb VALUES (71);
|
||||
INSERT INTO tndb VALUES (72);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tndb VALUES (73);
|
||||
INSERT INTO tinnodb VALUES (74);
|
||||
ROLLBACK;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
|
||||
--echo ==== MyISAM + InnoDB + NDB ====
|
||||
|
||||
--echo ---- committed with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (75);
|
||||
INSERT INTO tinnodb VALUES (76);
|
||||
INSERT INTO tndb VALUES (77);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (78);
|
||||
INSERT INTO tndb VALUES (79);
|
||||
INSERT INTO tinnodb VALUES (80);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (81);
|
||||
INSERT INTO tmyisam VALUES (82);
|
||||
INSERT INTO tndb VALUES (83);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (84);
|
||||
INSERT INTO tndb VALUES (85);
|
||||
INSERT INTO tmyisam VALUES (86);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (87);
|
||||
INSERT INTO tmyisam VALUES (88);
|
||||
INSERT INTO tinnodb VALUES (89);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (90);
|
||||
INSERT INTO tinnodb VALUES (91);
|
||||
INSERT INTO tmyisam VALUES (92);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with BEGIN ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (93);
|
||||
INSERT INTO tinnodb VALUES (94);
|
||||
INSERT INTO tndb VALUES (95);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (96);
|
||||
INSERT INTO tndb VALUES (97);
|
||||
INSERT INTO tinnodb VALUES (98);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (99);
|
||||
INSERT INTO tmyisam VALUES (100);
|
||||
INSERT INTO tndb VALUES (101);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb VALUES (102);
|
||||
INSERT INTO tndb VALUES (103);
|
||||
INSERT INTO tmyisam VALUES (104);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (105);
|
||||
INSERT INTO tmyisam VALUES (106);
|
||||
INSERT INTO tinnodb VALUES (107);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (108);
|
||||
INSERT INTO tinnodb VALUES (109);
|
||||
INSERT INTO tmyisam VALUES (110);
|
||||
ROLLBACK;
|
||||
|
||||
--echo ---- committed with AUTOCOMMIT = 0 ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
INSERT INTO tmyisam VALUES (111);
|
||||
INSERT INTO tinnodb VALUES (112);
|
||||
INSERT INTO tndb VALUES (113);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tmyisam VALUES (114);
|
||||
INSERT INTO tndb VALUES (115);
|
||||
INSERT INTO tinnodb VALUES (116);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tinnodb VALUES (117);
|
||||
INSERT INTO tmyisam VALUES (118);
|
||||
INSERT INTO tndb VALUES (119);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tinnodb VALUES (120);
|
||||
INSERT INTO tndb VALUES (121);
|
||||
INSERT INTO tmyisam VALUES (122);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (123);
|
||||
INSERT INTO tmyisam VALUES (124);
|
||||
INSERT INTO tinnodb VALUES (125);
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (126);
|
||||
INSERT INTO tinnodb VALUES (127);
|
||||
INSERT INTO tmyisam VALUES (128);
|
||||
COMMIT;
|
||||
|
||||
--echo ---- rolled back with AUTOCOMMIT = 0 ----
|
||||
|
||||
INSERT INTO tmyisam VALUES (129);
|
||||
INSERT INTO tinnodb VALUES (130);
|
||||
INSERT INTO tndb VALUES (131);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tmyisam VALUES (132);
|
||||
INSERT INTO tndb VALUES (133);
|
||||
INSERT INTO tinnodb VALUES (134);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tinnodb VALUES (135);
|
||||
INSERT INTO tmyisam VALUES (136);
|
||||
INSERT INTO tndb VALUES (137);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tinnodb VALUES (138);
|
||||
INSERT INTO tndb VALUES (139);
|
||||
INSERT INTO tmyisam VALUES (140);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tndb VALUES (141);
|
||||
INSERT INTO tmyisam VALUES (142);
|
||||
INSERT INTO tinnodb VALUES (143);
|
||||
ROLLBACK;
|
||||
|
||||
INSERT INTO tndb VALUES (144);
|
||||
INSERT INTO tinnodb VALUES (145);
|
||||
INSERT INTO tmyisam VALUES (146);
|
||||
ROLLBACK;
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
--echo ---- Mixed statements Innodb ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (147);
|
||||
INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (148);
|
||||
BEGIN;
|
||||
INSERT INTO tinnodb SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
|
||||
INSERT INTO tndb VALUES (149);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (150);
|
||||
INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
|
||||
COMMIT;
|
||||
|
||||
INSERT INTO tndb VALUES (151);
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam SELECT * FROM tndb ORDER BY a DESC LIMIT 1;
|
||||
INSERT INTO tndb VALUES (152);
|
||||
COMMIT;
|
||||
|
||||
--echo ==== Verify the result ====
|
||||
|
||||
SELECT * FROM tmyisam ORDER BY a;
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
SELECT * FROM tndb ORDER BY a;
|
||||
|
||||
--echo [on slave]
|
||||
--sync_slave_with_master
|
||||
|
||||
let $diff_tables= master:tmyisam, slave:tmyisam;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:tinnodb, slave:tinnodb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:tndb, slave:tndb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
--echo [on master]
|
||||
connection master;
|
||||
DROP TABLE tmyisam, tinnodb, tndb;
|
||||
|
||||
--echo [on slave]
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,344 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Test replication of transactions on tables which have different
|
||||
# engines on master and slave. This tests all combinations of innodb,
|
||||
# myisam, and ndb.
|
||||
#
|
||||
# ==== Method ====
|
||||
#
|
||||
# Set up six tables, each being innodb, myisam, or innodb on master,
|
||||
# and another of innodb, myisam, or innodb on slave. For each table,
|
||||
# do the following:
|
||||
#
|
||||
# - committed and rollback'ed transactions, with autocommit on and
|
||||
# off
|
||||
# - non-transactions with autocommit on
|
||||
# - non-transactions with autocommit off, where the master table is
|
||||
# myisam.
|
||||
#
|
||||
# Note: we are running the slave with
|
||||
# --replicate-ignore-table=mysql.ndb_apply_status . See BUG#34557 for
|
||||
# explanation.
|
||||
#
|
||||
# ==== Related bugs ====
|
||||
#
|
||||
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails
|
||||
# BUG#29288: myisam transactions replicated to a transactional slave leaves slave unstable
|
||||
# BUG#34557: Row-based replication from ndb to non-ndb gives error on slave
|
||||
# BUG#34600: Rolled-back punch transactions not replicated correctly
|
||||
#
|
||||
# ==== Todo ====
|
||||
#
|
||||
# We should eventually try transactions touching two tables which are
|
||||
# of different engines on the same server (so that we try, e.g. punch
|
||||
# transactions; cf BUG#34600). However, that will make the test much
|
||||
# bigger (9 master-slave engine combinations [myisam->myisam,
|
||||
# myisam->ndb, etc]. To try all combinations of one or more such
|
||||
# tables means 2^9-1=511 transactions. We need to multiplied by 5
|
||||
# since we want to test committed/rollback'ed transactions
|
||||
# with/without AUTOCOMMIT, as well as non-transactions with
|
||||
# autocommit). We'd have to write a script to produce the test case.
|
||||
|
||||
|
||||
--echo ==== Initialization ====
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--echo ---- setup master ----
|
||||
|
||||
CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM;
|
||||
CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB;
|
||||
CREATE TABLE myisam_ndb (a INT) ENGINE=MYISAM;
|
||||
CREATE TABLE ndb_myisam (a INT) ENGINE=NDB;
|
||||
CREATE TABLE innodb_ndb (a INT) ENGINE=INNODB;
|
||||
CREATE TABLE ndb_innodb (a INT) ENGINE=NDB;
|
||||
|
||||
SHOW CREATE TABLE myisam_innodb;
|
||||
SHOW CREATE TABLE innodb_myisam;
|
||||
SHOW CREATE TABLE myisam_ndb;
|
||||
SHOW CREATE TABLE ndb_myisam;
|
||||
SHOW CREATE TABLE innodb_ndb;
|
||||
SHOW CREATE TABLE ndb_innodb;
|
||||
|
||||
--echo ---- setup slave with different engines ----
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
DROP TABLE myisam_innodb, innodb_myisam;
|
||||
DROP TABLE myisam_ndb, ndb_myisam;
|
||||
DROP TABLE innodb_ndb, ndb_innodb;
|
||||
|
||||
CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB;
|
||||
CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM;
|
||||
CREATE TABLE myisam_ndb (a INT) ENGINE=NDB;
|
||||
CREATE TABLE ndb_myisam (a INT) ENGINE=MYISAM;
|
||||
CREATE TABLE innodb_ndb (a INT) ENGINE=NDB;
|
||||
CREATE TABLE ndb_innodb (a INT) ENGINE=INNODB;
|
||||
|
||||
SHOW CREATE TABLE myisam_innodb;
|
||||
SHOW CREATE TABLE innodb_myisam;
|
||||
SHOW CREATE TABLE myisam_ndb;
|
||||
SHOW CREATE TABLE ndb_myisam;
|
||||
SHOW CREATE TABLE innodb_ndb;
|
||||
SHOW CREATE TABLE ndb_innodb;
|
||||
|
||||
connection master;
|
||||
|
||||
|
||||
--echo ==== AUTOCOMMIT=0, transactions ====
|
||||
|
||||
--echo ---- COMMIT ----
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_innodb VALUES (1);
|
||||
INSERT INTO myisam_innodb VALUES (2);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_myisam VALUES (3);
|
||||
INSERT INTO innodb_myisam VALUES (4);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_ndb VALUES (5);
|
||||
INSERT INTO myisam_ndb VALUES (6);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO ndb_myisam VALUES (7);
|
||||
INSERT INTO ndb_myisam VALUES (8);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO ndb_innodb VALUES (9);
|
||||
INSERT INTO ndb_innodb VALUES (10);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_ndb VALUES (11);
|
||||
INSERT INTO innodb_ndb VALUES (12);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
--echo ---- ROLLBACK ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_innodb VALUES (13);
|
||||
INSERT INTO myisam_innodb VALUES (14);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_myisam VALUES (15);
|
||||
INSERT INTO innodb_myisam VALUES (16);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_ndb VALUES (17);
|
||||
INSERT INTO myisam_ndb VALUES (18);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO ndb_myisam VALUES (19);
|
||||
INSERT INTO ndb_myisam VALUES (20);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO ndb_innodb VALUES (21);
|
||||
INSERT INTO ndb_innodb VALUES (22);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_ndb VALUES (23);
|
||||
INSERT INTO innodb_ndb VALUES (24);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
|
||||
--echo ==== AUTOCOMMIT=1, transactions ====
|
||||
|
||||
--echo ---- COMMIT ----
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_innodb VALUES (25);
|
||||
INSERT INTO myisam_innodb VALUES (26);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_myisam VALUES (27);
|
||||
INSERT INTO innodb_myisam VALUES (28);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_ndb VALUES (29);
|
||||
INSERT INTO myisam_ndb VALUES (30);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO ndb_myisam VALUES (31);
|
||||
INSERT INTO ndb_myisam VALUES (32);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO ndb_innodb VALUES (33);
|
||||
INSERT INTO ndb_innodb VALUES (34);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_ndb VALUES (35);
|
||||
INSERT INTO innodb_ndb VALUES (36);
|
||||
COMMIT;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
--echo ---- ROLLBACK ----
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_innodb VALUES (37);
|
||||
INSERT INTO myisam_innodb VALUES (38);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_myisam VALUES (39);
|
||||
INSERT INTO innodb_myisam VALUES (40);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO myisam_ndb VALUES (41);
|
||||
INSERT INTO myisam_ndb VALUES (42);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO ndb_myisam VALUES (43);
|
||||
INSERT INTO ndb_myisam VALUES (44);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO ndb_innodb VALUES (45);
|
||||
INSERT INTO ndb_innodb VALUES (46);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
BEGIN;
|
||||
INSERT INTO innodb_ndb VALUES (47);
|
||||
INSERT INTO innodb_ndb VALUES (48);
|
||||
ROLLBACK;
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
|
||||
--echo ==== AUTOCOMMIT=1, single statements ====
|
||||
|
||||
INSERT INTO myisam_innodb VALUES (49);
|
||||
INSERT INTO myisam_innodb VALUES (50);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO innodb_myisam VALUES (51);
|
||||
INSERT INTO innodb_myisam VALUES (52);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
INSERT INTO myisam_ndb VALUES (53);
|
||||
INSERT INTO myisam_ndb VALUES (54);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO ndb_myisam VALUES (55);
|
||||
INSERT INTO ndb_myisam VALUES (56);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
INSERT INTO ndb_innodb VALUES (57);
|
||||
INSERT INTO ndb_innodb VALUES (58);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
INSERT INTO innodb_ndb VALUES (59);
|
||||
INSERT INTO innodb_ndb VALUES (60);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
|
||||
--echo ==== AUTOCOMMIT=0, single statements, myisam on master ====
|
||||
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
# This tests BUG#29288.
|
||||
INSERT INTO myisam_innodb VALUES (61);
|
||||
INSERT INTO myisam_innodb VALUES (62);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
INSERT INTO myisam_ndb VALUES (63);
|
||||
INSERT INTO myisam_ndb VALUES (64);
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
|
||||
--echo ==== Show results ====
|
||||
|
||||
SELECT * FROM myisam_innodb ORDER BY a;
|
||||
SELECT * FROM innodb_myisam ORDER BY a;
|
||||
SELECT * FROM myisam_ndb ORDER BY a;
|
||||
SELECT * FROM ndb_myisam ORDER BY a;
|
||||
SELECT * FROM innodb_ndb ORDER BY a;
|
||||
SELECT * FROM ndb_innodb ORDER BY a;
|
||||
|
||||
let $diff_tables= master:myisam_innodb, slave:myisam_innodb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:innodb_myisam, slave:innodb_myisam;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:myisam_ndb, slave:myisam_ndb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:ndb_myisam, slave:ndb_myisam;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:innodb_ndb, slave:innodb_ndb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
let $diff_tables= master:ndb_innodb, slave:ndb_innodb;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
|
||||
--echo ==== Clean up ====
|
||||
|
||||
drop table myisam_innodb, innodb_myisam;
|
||||
drop table myisam_ndb, ndb_myisam;
|
||||
drop table innodb_ndb, ndb_innodb;
|
||||
sync_slave_with_master;
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,75 @@
|
||||
--source include/have_multi_ndb.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
# We need server 3 later on in this test.
|
||||
--let $rpl_server_count= 3
|
||||
--source include/master-slave.inc
|
||||
|
||||
--connection master
|
||||
|
||||
# note: server2 is another "master" connected to the master cluster
|
||||
|
||||
#
|
||||
# Currently test only works with ndb since it retrieves "old"
|
||||
# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
|
||||
#
|
||||
|
||||
# create a table with one row, and make sure the other "master" gets it
|
||||
CREATE TABLE t1 (c1 CHAR(15), c2 CHAR(15), c3 INT, PRIMARY KEY (c3)) ENGINE = NDB ;
|
||||
connection server2;
|
||||
reset master;
|
||||
SHOW TABLES;
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES ("row1","will go away",1);
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
connection server2;
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
# sync slave and retrieve epoch and stop the slave
|
||||
connection master;
|
||||
sync_slave_with_master;
|
||||
--replace_column 1 <the_epoch>
|
||||
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
|
||||
let $the_epoch= `select @the_epoch` ;
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
stop slave;
|
||||
|
||||
# get the master binlog pos from the epoch, from the _other_ "master", server2
|
||||
connection server2;
|
||||
--replace_result $the_epoch <the_epoch>
|
||||
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
|
||||
FROM mysql.ndb_binlog_index WHERE epoch = $the_epoch ;
|
||||
let $the_pos= `SELECT @the_pos` ;
|
||||
let $the_file= `SELECT @the_file` ;
|
||||
|
||||
# now connect the slave to the _other_ "master"
|
||||
--let $rpl_topology= 3->2
|
||||
--let $rpl_master_log_file= 2:$the_file
|
||||
--let $rpl_master_log_pos= 2:$the_pos
|
||||
--source include/rpl_change_topology.inc
|
||||
--connection slave
|
||||
--source include/start_slave.inc
|
||||
|
||||
# insert some more values on the first master
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4);
|
||||
DELETE FROM t1 WHERE c3 = 1;
|
||||
UPDATE t1 SET c2="should go away" WHERE c3 = 2;
|
||||
UPDATE t1 SET c2="C" WHERE c3 = 3;
|
||||
DELETE FROM t1 WHERE c3 = 2;
|
||||
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
# insert another row, and check that we have it on the slave
|
||||
connection server2;
|
||||
INSERT INTO t1 VALUES ("row5","E",5);
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY c3;
|
||||
|
||||
--echo ==== clean up ====
|
||||
connection server2;
|
||||
DROP TABLE t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,14 @@
|
||||
############################################################
|
||||
# By JBM 2006-02-15 Wrapper for rpl_multi_update2.test #
|
||||
# to reuse test code between engine runs #
|
||||
############################################################
|
||||
-- source include/have_ndb.inc
|
||||
|
||||
# Run this only for row based replication, as replication of
|
||||
# auto_increment values are not supported with NDB as storage engine
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
let $engine_type=NDB;
|
||||
--source extra/rpl_tests/rpl_multi_update2.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
# By JBM 2006-02-15 Wrapper for rpl_multi_update3.test #
|
||||
# to reuse test code between engine runs #
|
||||
############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_multi_update3.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,15 @@
|
||||
#############################################################
|
||||
# Author: JBM
|
||||
# Date: 2006-02-24
|
||||
# Purpose: Trying to test ability to replicate from cluster
|
||||
# to innodb, or myisam, or replicate from innodb/myisam to
|
||||
# cluster slave. Due to limitations I have created wrappers
|
||||
# to be able to use the same code for all these different
|
||||
# test and to have control over the tests.
|
||||
##############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
SET storage_engine=myisam;
|
||||
--source extra/rpl_tests/rpl_ndb_2multi_eng.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,10 @@
|
||||
############################################################
|
||||
# By JBM 2006-02-15 Wrapper for rpl_relayrotate.test #
|
||||
# to reuse test code between engine runs #
|
||||
############################################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_ndb_extra.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_relayrotate.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,58 @@
|
||||
###########################################################
|
||||
# Author: Jeb
|
||||
# Date: 15-12-2006
|
||||
# Purpose: To test --replicate-ignore-table=db_name.tbl_name
|
||||
# and --replicate-ignore-db=db_name
|
||||
# using cluster. Only replica should replicate.
|
||||
##########################################################
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS replica;
|
||||
--enable_warnings
|
||||
|
||||
# Create database and tables for the test.
|
||||
CREATE DATABASE replica;
|
||||
CREATE TABLE t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
CREATE TABLE t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
USE replica;
|
||||
CREATE TABLE replica.t1 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
CREATE TABLE replica.t2 (a INT NOT NULL KEY, b text NOT NULL)ENGINE=NDB;
|
||||
|
||||
# Insert data into db that should not be picked up by slave
|
||||
USE test;
|
||||
INSERT INTO t1 VALUES(1, repeat('abc',10));
|
||||
INSERT INTO t2 VALUES(1, repeat('abc',10));
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
# Insert data into db that should be replicated
|
||||
USE replica;
|
||||
INSERT INTO replica.t1 VALUES(2, repeat('def',200));
|
||||
INSERT INTO replica.t2 VALUES(2, repeat('def',200));
|
||||
SHOW TABLES;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
|
||||
# Check results on slave
|
||||
--sync_slave_with_master
|
||||
SHOW TABLES;
|
||||
USE replica;
|
||||
SHOW TABLES;
|
||||
#SELECT COUNT(*) FROM t1;
|
||||
SELECT COUNT(*) FROM t2;
|
||||
USE test;
|
||||
SHOW TABLES;
|
||||
|
||||
# Cleanup from testing
|
||||
connection master;
|
||||
USE test;
|
||||
DROP TABLE t1, t2;
|
||||
DROP DATABASE IF EXISTS replica;
|
||||
--sync_slave_with_master
|
||||
|
||||
# End 5.1 test case
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,8 @@
|
||||
########################################################
|
||||
# By JBM 2005-02-15 Wrapped to allow reuse of test code#
|
||||
########################################################
|
||||
--source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_row_001.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,7 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
-- let $engine= NDB
|
||||
-- source extra/rpl_tests/rpl_set_null.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
#################################
|
||||
# Wrapper for rpl_row_sp003.test#
|
||||
# These tests have been wrapped #
|
||||
# so the same code can be used #
|
||||
# For different engines #
|
||||
#################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDBCLUSTER;
|
||||
-- source extra/rpl_tests/rpl_row_sp003.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,11 @@
|
||||
#################################
|
||||
# Wrapper for rpl_row_sp006.test#
|
||||
# These tests have been wrapped #
|
||||
# so the same code can be used #
|
||||
# For different engines #
|
||||
#################################
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDBCLUSTER;
|
||||
-- source extra/rpl_tests/rpl_row_sp006.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,38 @@
|
||||
#############################################
|
||||
#Authors: TU and Jeb
|
||||
#Date: 2007/04
|
||||
#Purpose: Generic replication to cluster
|
||||
# and ensuring that the ndb_apply_status
|
||||
# table is updated.
|
||||
#############################################
|
||||
# Notes:
|
||||
# include/select_ndb_apply_status.inc
|
||||
# Selects out the log name, start & end pos
|
||||
# from the ndb_apply_status table
|
||||
#
|
||||
# include/show_binlog_using_logname.inc
|
||||
# To select out 1 row from offset 1
|
||||
# from the start position in the binlog whose
|
||||
# name is = log_name
|
||||
#
|
||||
# include/tpcb.inc
|
||||
# Creates DATABASE tpcb, the tables and
|
||||
# stored procedures for loading the DB
|
||||
# and for running transactions against DB.
|
||||
##############################################
|
||||
|
||||
|
||||
## Includes ##
|
||||
|
||||
--disable_query_log
|
||||
--source include/have_ndb.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
--enable_query_log
|
||||
|
||||
# statement format is supported because master uses innodb
|
||||
SET binlog_format = STATEMENT;
|
||||
let $off_set = 6;
|
||||
let $rpl_format = 'SBR';
|
||||
--source extra/rpl_tests/rpl_ndb_apply_status.test
|
||||
--source include/rpl_end.inc
|
||||
102
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
Normal file
102
build/lib/mysql/mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test
Normal file
@@ -0,0 +1,102 @@
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_default_cluster.inc
|
||||
--source include/not_embedded.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
|
||||
#
|
||||
# Currently test only works with ndb since it retrieves "old"
|
||||
# binlog positions with mysql.ndb_binlog_index and ndb_apply_status;
|
||||
#
|
||||
|
||||
# stop the save
|
||||
--connection slave
|
||||
STOP SLAVE;
|
||||
CREATE DATABASE ndbsynctest;
|
||||
USE ndbsynctest;
|
||||
|
||||
# get some data on the master
|
||||
--connection master
|
||||
CREATE DATABASE ndbsynctest;
|
||||
USE ndbsynctest;
|
||||
CREATE TABLE t1 (c1 BIT(1) NOT NULL, c2 BIT(1) NOT NULL, c3 CHAR(15), PRIMARY KEY(c3)) ENGINE = NDB ;
|
||||
INSERT INTO t1 VALUES (1,1,"row1"),(0,1,"row2"),(1,0,"row3"),(0,0,"row4");
|
||||
CREATE TABLE t2 (c1 CHAR(15), c2 BIT(1) NOT NULL, c3 BIT(1) NOT NULL, PRIMARY KEY(c1)) ENGINE = NDB ;
|
||||
INSERT INTO t2 VALUES ("ABC",1,1),("BCDEF",0,1),("CD",1,0),("DEFGHIJKL",0,0);
|
||||
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
|
||||
SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
|
||||
|
||||
# take a backup on master
|
||||
--source include/ndb_backup.inc
|
||||
|
||||
# update a row
|
||||
UPDATE t1 SET c2=0 WHERE c3="row2";
|
||||
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
|
||||
|
||||
# restore on slave, first check that nothing is there
|
||||
--connection slave
|
||||
|
||||
# we should have no tables
|
||||
SHOW TABLES;
|
||||
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
#
|
||||
# BUG#11960
|
||||
# prior to bugfix "DROP DATABASE" would give a warning since
|
||||
# the events were not created by ndb_restore
|
||||
#
|
||||
DROP DATABASE ndbsynctest;
|
||||
CREATE DATABASE ndbsynctest;
|
||||
USE ndbsynctest;
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 1 -m -r --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
--exec $NDB_TOOLS_DIR/ndb_restore --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING_SLAVE" -b $the_backup_id -n 2 -r -e --print --print_meta $NDB_BACKUP_DIR/BACKUP/BACKUP-$the_backup_id >> $NDB_TOOLS_OUTPUT
|
||||
|
||||
# continue test
|
||||
SHOW TABLES;
|
||||
|
||||
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
|
||||
SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
|
||||
|
||||
#
|
||||
# now setup replication to continue from last epoch
|
||||
--source include/ndb_setup_slave.inc
|
||||
--connection slave
|
||||
START SLAVE;
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
--connection master
|
||||
--sync_slave_with_master
|
||||
--source include/check_slave_is_running.inc
|
||||
|
||||
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
|
||||
SELECT hex(c2),hex(c3),c1 FROM t2 ORDER BY c1;
|
||||
|
||||
#
|
||||
# Cleanup
|
||||
#
|
||||
|
||||
--connection master
|
||||
DROP DATABASE ndbsynctest;
|
||||
--sync_slave_with_master
|
||||
STOP SLAVE;
|
||||
|
||||
#
|
||||
# Test some replication commands
|
||||
#
|
||||
--connection master
|
||||
reset master;
|
||||
# should now contain nothing
|
||||
select * from mysql.ndb_binlog_index;
|
||||
|
||||
--connection slave
|
||||
reset slave;
|
||||
# should now contain nothing
|
||||
select * from mysql.ndb_apply_status;
|
||||
|
||||
# End 5.1 Test
|
||||
--let $rpl_only_running_threads= 1
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,15 @@
|
||||
#############################################################################
|
||||
# Original Author: JBM #
|
||||
# Original Date: 2006-02-14 #
|
||||
#############################################################################
|
||||
# TEST: Use before insert triggers and has the second insert fail #
|
||||
# Test is wrapped to save code and share between engines #
|
||||
#############################################################################
|
||||
|
||||
# Includes
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
let $engine_type=NDB;
|
||||
-- source extra/rpl_tests/rpl_trig004.test
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,12 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/have_ndbapi_examples.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
--exec echo Running ndbapi_simple_dual
|
||||
--exec $NDB_EXAMPLES_DIR/ndbapi_simple_dual/ndbapi_simple_dual $MASTER_MYSOCK "$NDB_CONNECTSTRING" $SLAVE_MYSOCK "$NDB_CONNECTSTRING_SLAVE" >> $NDB_EXAMPLES_OUTPUT
|
||||
|
||||
--exec echo Running mgmapi_logevent
|
||||
--exec $NDB_EXAMPLES_DIR/mgmapi_logevent/mgmapi_logevent "$NDB_CONNECTSTRING" "$NDB_CONNECTSTRING_SLAVE" 1 >> $NDB_EXAMPLES_OUTPUT
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,8 @@
|
||||
-- source include/have_ndb.inc
|
||||
-- source include/have_binlog_format_mixed_or_row.inc
|
||||
-- source include/ndb_master-slave.inc
|
||||
|
||||
let $type= 'NDB' ;
|
||||
let $extra_index= ;
|
||||
-- source extra/rpl_tests/rpl_row_basic.test
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
--source include/have_ndb.inc
|
||||
--source include/ndb_master-slave.inc
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
|
||||
--disable_query_log
|
||||
--disable_warnings
|
||||
connection slave;
|
||||
STOP SLAVE;
|
||||
connection master;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
RESET SLAVE;
|
||||
START SLAVE;
|
||||
--enable_warnings
|
||||
--enable_query_log
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Slave ****
|
||||
# This is silly, but NDB doesn't add to the binlog fast enough
|
||||
--real_sleep 10
|
||||
sync_slave_with_master;
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
# Should be empty
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB;
|
||||
INSERT INTO t1 VALUES (1,1), (2,2);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
INSERT INTO t1 VALUE (3,3);
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Slave ****
|
||||
sync_slave_with_master;
|
||||
# Should be empty
|
||||
SELECT * FROM t1 ORDER BY a,b;
|
||||
--echo **** On Master ****
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -0,0 +1,12 @@
|
||||
# Same test as rpl_truncate_7ndb.test, but with mixed mode
|
||||
# This is marked with 'big_test' just because the rpl_truncate_7ndb test is
|
||||
# so slow...
|
||||
|
||||
# Last Change: 2008-09-03
|
||||
# Change Author: pcrews
|
||||
# Change: Moved test to rpl_ndb suite, updated location of --source .test file
|
||||
|
||||
--source include/have_binlog_format_mixed.inc
|
||||
--source include/big_test.inc
|
||||
--source suite/rpl_ndb/t/rpl_truncate_7ndb.test
|
||||
--source include/rpl_end.inc
|
||||
Reference in New Issue
Block a user