mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl
into dl145h.mysql.com:/data0/mkindahl/mysql-5.1-rpl-merge mysql-test/include/have_multi_ndb.inc: Auto merged mysql-test/lib/mtr_cases.pl: Auto merged mysql-test/lib/mtr_report.pl: Auto merged mysql-test/suite/binlog/r/binlog_stm_blackhole.result: Auto merged mysql-test/suite/rpl_ndb/r/rpl_row_basic_7ndb.result: Auto merged mysql-test/suite/rpl_ndb/t/disabled.def: Auto merged sql/ha_ndbcluster_binlog.cc: Auto merged sql/log.cc: Auto merged sql/log_event_old.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/rpl_rli.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_binlog.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_string.cc: Auto merged mysql-test/Makefile.am: SCCS merged mysql-test/mysql-test-run.pl: Manual merge. mysql-test/suite/binlog/t/disabled.def: Manual merge. mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result: Manual merge. mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result: Manual merge. sql/log_event.cc: Manual merge. ,
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
show variables like 'collation_server';
|
||||
Variable_name Value
|
||||
collation_server ucs2_unicode_ci
|
||||
@ -5,5 +11,17 @@ show variables like "%character_set_ser%";
|
||||
Variable_name Value
|
||||
character_set_server ucs2
|
||||
DROP TABLE IF EXISTS t1;
|
||||
create table t1 (a int);
|
||||
create table t1 (a int) ENGINE=NDB;
|
||||
drop table t1;
|
||||
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;
|
||||
nid nom prenom
|
||||
1 XYZ1 ABC1
|
||||
select * from t1 order by nid;
|
||||
nid nom prenom
|
||||
1 XYZ1 ABC1
|
||||
|
@ -22,11 +22,11 @@ from mysql.ndb_apply_status;
|
||||
|
||||
show binlog events from <start_pos> limit 1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; insert into t1 values (1,2)
|
||||
master-bin.000001 <start_pos> Query 1 # use `test`; BEGIN
|
||||
|
||||
show binlog events from <start_pos> limit 1,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Xid 1 445 COMMIT /* XID */
|
||||
master-bin.000001 # Query 1 486 use `test`; insert into t1 values (1,2)
|
||||
|
||||
begin;
|
||||
insert into t1 values (2,3);
|
||||
|
140
mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result
Normal file
140
mysql-test/suite/rpl_ndb/r/rpl_ndb_transaction.result
Normal file
@ -0,0 +1,140 @@
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
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;
|
||||
Table Create Table
|
||||
tmyisam CREATE TABLE `tmyisam` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE tinnodb;
|
||||
Table Create Table
|
||||
tinnodb CREATE TABLE `tinnodb` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
SHOW CREATE TABLE tndb;
|
||||
Table Create Table
|
||||
tndb CREATE TABLE `tndb` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
|
||||
==== Test 1: Non-XA Engines ====
|
||||
--- on master ---
|
||||
SET AUTOCOMMIT = 1;
|
||||
INSERT INTO tndb VALUES (1);
|
||||
INSERT INTO tmyisam VALUES (1);
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (2);
|
||||
INSERT INTO tndb VALUES (3);
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (2);
|
||||
INSERT INTO tmyisam VALUES (3);
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (4);
|
||||
INSERT INTO tmyisam VALUES (4);
|
||||
COMMIT;
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (5);
|
||||
INSERT INTO tndb VALUES (6);
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (5);
|
||||
INSERT INTO tmyisam VALUES (6);
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (7);
|
||||
INSERT INTO tmyisam VALUES (7);
|
||||
ROLLBACK;
|
||||
Warnings:
|
||||
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
||||
SELECT * FROM tndb ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT * FROM tmyisam ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
--- on slave ---
|
||||
SELECT * FROM tndb ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
SELECT * FROM tmyisam ORDER BY a;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
==== Test 2: Master crash before writing XID event on XA engine ====
|
||||
--- on master ---
|
||||
INSERT INTO tinnodb VALUES (1);
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
a
|
||||
1
|
||||
--- on slave ---
|
||||
STOP SLAVE;
|
||||
SHOW SLAVE STATUS;
|
||||
Slave_IO_State #
|
||||
Master_Host 127.0.0.1
|
||||
Master_User root
|
||||
Master_Port MASTER_PORT
|
||||
Connect_Retry 1
|
||||
Master_Log_File master-bin.000001
|
||||
Read_Master_Log_Pos 1740
|
||||
Relay_Log_File #
|
||||
Relay_Log_Pos #
|
||||
Relay_Master_Log_File master-bin.000001
|
||||
Slave_IO_Running No
|
||||
Slave_SQL_Running No
|
||||
Replicate_Do_DB
|
||||
Replicate_Ignore_DB
|
||||
Replicate_Do_Table
|
||||
Replicate_Ignore_Table #
|
||||
Replicate_Wild_Do_Table
|
||||
Replicate_Wild_Ignore_Table
|
||||
Last_Errno 0
|
||||
Last_Error
|
||||
Skip_Counter 0
|
||||
Exec_Master_Log_Pos 1579
|
||||
Relay_Log_Space #
|
||||
Until_Condition None
|
||||
Until_Log_File
|
||||
Until_Log_Pos 0
|
||||
Master_SSL_Allowed No
|
||||
Master_SSL_CA_File
|
||||
Master_SSL_CA_Path
|
||||
Master_SSL_Cert
|
||||
Master_SSL_Cipher
|
||||
Master_SSL_Key
|
||||
Seconds_Behind_Master #
|
||||
Master_SSL_Verify_Server_Cert No
|
||||
Last_IO_Errno #
|
||||
Last_IO_Error #
|
||||
Last_SQL_Errno 0
|
||||
Last_SQL_Error
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
a
|
||||
DROP TABLE tmyisam;
|
||||
DROP TABLE tinnodb;
|
||||
DROP TABLE tndb;
|
@ -370,6 +370,7 @@ C1 C2
|
||||
1 3
|
||||
2 6
|
||||
3 9
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
--- on master: new values inserted ---
|
||||
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
|
||||
SELECT * FROM t7 ORDER BY C1;
|
||||
@ -377,6 +378,7 @@ C1 C2
|
||||
1 2
|
||||
2 4
|
||||
3 6
|
||||
set @@global.slave_exec_mode= default;
|
||||
--- on slave: old values should be overwritten by replicated values ---
|
||||
SELECT * FROM t7 ORDER BY C1;
|
||||
C1 C2
|
||||
@ -406,8 +408,10 @@ a b c
|
||||
2 4 6
|
||||
3 6 9
|
||||
99 99 99
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
--- on master ---
|
||||
INSERT INTO t8 VALUES (2,4,8);
|
||||
set @@global.slave_exec_mode= default;
|
||||
--- on slave ---
|
||||
SELECT * FROM t8 ORDER BY a;
|
||||
a b c
|
||||
@ -426,10 +430,12 @@ START SLAVE;
|
||||
**** On Master ****
|
||||
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
|
||||
**** On Master ****
|
||||
set @@global.slave_exec_mode= 'IDEMPOTENT';
|
||||
DELETE FROM t1 WHERE C1 = 'L';
|
||||
DELETE FROM t1;
|
||||
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
COUNT(*) 0
|
||||
set @@global.slave_exec_mode= default;
|
||||
Last_SQL_Error
|
||||
0
|
||||
SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
|
||||
|
@ -14,7 +14,6 @@
|
||||
rpl_ndb_2innodb : Bug #32648 Test failure between NDB Cluster and other engines
|
||||
rpl_ndb_2myisam : Bug #32648 Test failure between NDB Cluster and other engines
|
||||
rpl_ndb_2other : Bug #32648 Test failure between NDB Cluster and other engines
|
||||
rpl_ndb_ctype_ucs2_def : BUG#27404 util thd mysql_parse sig11 when mysqld default multibyte charset
|
||||
rpl_ndb_extraColMaster : BUG#30854 : Tables name show as binary in slave err msg on vm-win2003-64-b and Solaris
|
||||
rpl_ndb_mix_innodb : Bug #32720 Test rpl_ndb_mix_innodb fails on SPARC and PowerPC
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
--innodb --debug=d,do_not_write_xid
|
1
mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt
Normal file
1
mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction-slave.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb
|
122
mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test
Normal file
122
mysql-test/suite/rpl_ndb/t/rpl_ndb_transaction.test
Normal file
@ -0,0 +1,122 @@
|
||||
# Tests that transactions are replicated correctly, with various
|
||||
# combinations of non-transactional and transactional non-XA tables.
|
||||
# Also tests that an XA transaction where the master crashes just
|
||||
# before writing the XID log event is executed correctly. See below
|
||||
# for implementation details.
|
||||
|
||||
source include/ndb_master-slave.inc;
|
||||
source include/have_ndb.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 ==== Test 1: Non-XA Engines ====
|
||||
# Test that everything works fine with non-XA engines. We just try
|
||||
# all ways to do transactions involving ndb and/or myisam, with
|
||||
# rollback or commit.
|
||||
|
||||
--echo --- on master ---
|
||||
|
||||
SET AUTOCOMMIT = 1;
|
||||
|
||||
INSERT INTO tndb VALUES (1);
|
||||
INSERT INTO tmyisam VALUES (1);
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (2);
|
||||
INSERT INTO tndb VALUES (3);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (2);
|
||||
INSERT INTO tmyisam VALUES (3);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (4);
|
||||
INSERT INTO tmyisam VALUES (4);
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (5);
|
||||
INSERT INTO tndb VALUES (6);
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tmyisam VALUES (5);
|
||||
INSERT INTO tmyisam VALUES (6);
|
||||
--warning 1196
|
||||
ROLLBACK;
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO tndb VALUES (7);
|
||||
INSERT INTO tmyisam VALUES (7);
|
||||
--warning 1196
|
||||
ROLLBACK;
|
||||
|
||||
SELECT * FROM tndb ORDER BY a;
|
||||
SELECT * FROM tmyisam ORDER BY a;
|
||||
|
||||
--echo --- on slave ---
|
||||
--sync_slave_with_master
|
||||
SELECT * FROM tndb ORDER BY a;
|
||||
SELECT * FROM tmyisam ORDER BY a;
|
||||
|
||||
|
||||
--echo ==== Test 2: Master crash before writing XID event on XA engine ====
|
||||
# We now want to test the following scenario, to verify that BUG#26395
|
||||
# has been fixed:
|
||||
|
||||
# "master and slave have a transactional table that uses XA. Master
|
||||
# has AUTOCOMMIT on and executes a statement (in this case an
|
||||
# INSERT). Master crashes just before writing the XID event."
|
||||
|
||||
# In this scenario, master will roll back, so slave should not execute
|
||||
# the statement, and slave should roll back later when master is
|
||||
# restarted.
|
||||
|
||||
# However, we the master to be alive so that we are sure it replicates
|
||||
# the statement to the slave. So in the test case, we must therefore
|
||||
# not crash the master. Instead, we fake the crash by just not writing
|
||||
# the XID event to the binlog. This is done by the
|
||||
# --debug=d,do_not_write_xid flag in the .opt file.
|
||||
|
||||
# So, unlike if the master had crashed, the master *will* execute the
|
||||
# statement. But the slave should not execute it. Hence, after the
|
||||
# first test is executed, the expected result on master is a table
|
||||
# with one row, and on slave a table with no rows.
|
||||
|
||||
# To simulate the slave correctly, we wait until everything up to the
|
||||
# XID is replicated. We cannot sync_slave_with_master, because that
|
||||
# would wait for the transaction to end. Instead, we wait for
|
||||
# "sufficiently long time". Then we stop the slave.
|
||||
|
||||
# Note: since this puts the master binlog in an inconsistent state,
|
||||
# this should be the last test of the file.
|
||||
|
||||
--echo --- on master ---
|
||||
--connection master
|
||||
|
||||
INSERT INTO tinnodb VALUES (1);
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
|
||||
--echo --- on slave ---
|
||||
--connection slave
|
||||
--sleep 3
|
||||
STOP SLAVE;
|
||||
--source include/show_slave_status.inc
|
||||
# the following statement should show that nothing has been replicated
|
||||
SELECT * FROM tinnodb ORDER BY a;
|
||||
|
||||
|
||||
# clean up
|
||||
DROP TABLE tmyisam;
|
||||
DROP TABLE tinnodb;
|
||||
DROP TABLE tndb;
|
Reference in New Issue
Block a user