Commit 89a89950 authored by unknown's avatar unknown

Merge kindahl-laptop.dnsalias.net:/home/bkroot/mysql-5.1-rpl

into  kindahl-laptop.dnsalias.net:/home/bk/b31582-mysql-5.1-rpl


sql/log_event.cc:
  Auto merged
parents 29fb5d17 f989bb4f
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
amd64_cflags="-m64 -mtune=athlon64"
extra_flags="$amd64_cflags $debug_cflags $max_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$amd64_configs $debug_configs $max_configs --enable-thread-safe-client"
. "$path/FINISH.sh"
#! /bin/sh
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
# For "optimal" code for this computer add -fast to EXTRA
# To compile 64 bit, add -xarch=v9 to EXTRA_64_BIT
EXTRA_64_BIT="-xarch=amd64"
EXTRA="-fast"
#
# The following should not need to be touched
#
export CC CXX CFLAGS CXXFLAGS
STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT"
ASFLAGS="$EXTRA_64_BIT"
CC=cc-5.0
CFLAGS="-Xa -xstrconst $STD"
CXX=CC
CXXFLAGS="-noex $STD"
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-named-curses=-lcurses \
--with-big-tables \
--with-innodb \
--with-example-storage-engine \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--with-csv-storage-engine \
--with-ssl \
--enable-assembler
# Not including:
# --with-ndbcluster
# --with-berkeley-db
gmake -j4
test $? = 0 && make test
#! /bin/sh
gmake -k clean || true
/bin/rm -f */.deps/*.P config.cache
path=`dirname $0`
. "$path/autorun.sh"
# To compile 64 bit, add -xarch=amd64 to EXTRA_64_BIT
EXTRA_64_BIT="-xarch=amd64"
# For "optimal" code for this computer add -fast to EXTRA. Note that
# this causes problem with debugging the program since -fast implies
# -xO5.
EXTRA=""
#
# The following should not need to be touched
#
export CC CXX CFLAGS CXXFLAGS
STD="-g -mt -D_FORTEC_ $EXTRA $EXTRA_64_BIT $debug_cflags"
ASFLAGS="$EXTRA_64_BIT"
CC=cc-5.0
CFLAGS="-Xa -xstrconst $STD"
CXX=CC
CXXFLAGS="-noex $STD"
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--libexecdir=/usr/local/mysql/bin \
--with-extra-charsets=complex \
--enable-thread-safe-client \
--enable-local-infile \
--with-zlib-dir=bundled \
--with-big-tables \
--with-readline \
--with-archive-storage-engine \
--with-named-curses=-lcurses \
--with-big-tables \
--with-innodb \
--with-example-storage-engine \
--with-blackhole-storage-engine \
--with-federated-storage-engine \
--with-csv-storage-engine \
--with-ssl \
--with-debug \
--enable-assembler
# Not including:
# --with-ndbcluster
# --with-berkeley-db
gmake -j4
......@@ -159,6 +159,22 @@ static inline my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
#define bitmap_set_all(MAP) \
(memset((MAP)->bitmap, 0xFF, 4*no_words_in_map((MAP))))
/**
check, set and clear a bit of interest of an integer.
If the bit is out of range @retval -1. Otherwise
bit_is_set @return 0 or 1 reflecting the bit is set or not;
bit_do_set @return 1 (bit is set 1)
bit_do_clear @return 0 (bit is cleared to 0)
*/
#define bit_is_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
(((I) & (ULL(1) << (B))) == 0 ? 0 : 1) : -1)
#define bit_do_set(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
((I) |= (ULL(1) << (B)), 1) : -1)
#define bit_do_clear(I,B) (sizeof(I) * CHAR_BIT > (B) ? \
((I) &= ~(ULL(1) << (B)), 0) : -1)
#ifdef __cplusplus
}
#endif
......
......@@ -32,3 +32,34 @@ SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1;
sync_slave_with_master;
#
# Bug #32468 delete rows event on a table with foreign key constraint fails
#
connection master;
eval create table t1 (b int primary key) engine = $engine_type;
eval create table t2 (a int primary key, b int, foreign key (b) references t1(b))
engine = $engine_type;
insert into t1 set b=1;
insert into t2 set a=1, b=1;
set foreign_key_checks=0;
set @@session.binlog_format=row;
delete from t1;
--echo must sync w/o a problem (could not with the buggy code)
sync_slave_with_master;
select count(*) from t1 /* must be zero */;
# cleanup for bug#32468
connection master;
drop table t2,t1;
sync_slave_with_master;
......@@ -174,11 +174,18 @@ sync_slave_with_master;
INSERT INTO t7 VALUES (1,3), (2,6), (3,9);
SELECT * FROM t7 ORDER BY C1;
# since bug#31552/31609 idempotency is not default any longer. In order
# the preceeding test INSERT INTO t7 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master: new values inserted ---
INSERT INTO t7 VALUES (1,2), (2,4), (3,6);
SELECT * FROM t7 ORDER BY C1;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave: old values should be overwritten by replicated values ---
SELECT * FROM t7 ORDER BY C1;
......@@ -206,12 +213,19 @@ SELECT * FROM t8 ORDER BY a;
INSERT INTO t8 VALUES (1,2,3), (2,4,6), (3,6,9);
SELECT * FROM t8 ORDER BY a;
# since bug#31552/31609 idempotency is not default any longer. In order
# the preceeding test INSERT INTO t8 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
connection master;
--echo --- on master ---
# We insert a row that will cause conflict on the primary key but not
# on the other keys.
INSERT INTO t8 VALUES (2,4,8);
sync_slave_with_master;
set @@global.slave_exec_mode= default;
--echo --- on slave ---
SELECT * FROM t8 ORDER BY a;
......@@ -234,12 +248,17 @@ connection master;
INSERT INTO t1 VALUES ('K','K'), ('L','L'), ('M','M');
--echo **** On Master ****
sync_slave_with_master;
# since bug#31552/31609 idempotency is not default any longer. In order
# the following test DELETE FROM t1 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
DELETE FROM t1 WHERE C1 = 'L';
connection master;
DELETE FROM t1;
query_vertical SELECT COUNT(*) FROM t1 ORDER BY c1,c2;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
......
......@@ -69,6 +69,11 @@ ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
# Insert some values for tables on slave side. These should not be
# modified when the row from the master is applied.
# since bug#31552/31609 idempotency is not default any longer. In order
# the following INSERTs to pass the mode is switched temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
# so the inserts are going to be overriden
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
......@@ -86,6 +91,8 @@ SELECT * FROM t1_bit ORDER BY a;
SELECT * FROM t1_char ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
set @@global.slave_exec_mode= default;
SELECT a,b,x FROM t1_int ORDER BY a;
SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
SELECT a,b,x FROM t1_char ORDER BY a;
......
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;
drop table if exists t1, t2;
drop view if exists v1, v2, v3, not_exist_view;
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create view v1 as select * from t1;
create view v2 as select * from t2;
create view v3 as select * from t3;
drop view not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
drop view v1, not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
drop view v2, v3;
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
select * from v2;
ERROR 42S02: Table 'test.v2' doesn't exist
select * from v3;
ERROR 42S02: Table 'test.v3' doesn't exist
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;
drop table if exists t1, t2;
drop view if exists v1, v2, v3, not_exist_view;
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create view v1 as select * from t1;
create view v2 as select * from t2;
create view v3 as select * from t3;
drop view not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
drop view v1, not_exist_view;
ERROR 42S02: Unknown table 'not_exist_view'
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
drop view v2, v3;
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
select * from v2;
ERROR 42S02: Table 'test.v2' doesn't exist
select * from v3;
ERROR 42S02: Table 'test.v3' doesn't exist
......@@ -40,3 +40,16 @@ Got one of the listed errors
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS t1,t2,t3;
SET FOREIGN_KEY_CHECKS=1;
create table t1 (b int primary key) engine = INNODB;
create table t2 (a int primary key, b int, foreign key (b) references t1(b))
engine = INNODB;
insert into t1 set b=1;
insert into t2 set a=1, b=1;
set foreign_key_checks=0;
set @@session.binlog_format=row;
delete from t1;
must sync w/o a problem (could not with the buggy code)
select count(*) from t1 /* must be zero */;
count(*)
0
drop table t2,t1;
......@@ -69,3 +69,158 @@ a
Last_SQL_Error
0
DROP TABLE t1, t2;
select @@global.slave_exec_mode /* must be IDEMPOTENT */;
@@global.slave_exec_mode
IDEMPOTENT
create table ti1 (b int primary key) engine = innodb;
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
engine = innodb;
set foreign_key_checks=1 /* ensure the check */;
insert into ti1 values (1),(2),(3);
insert into ti2 set a=2, b=2;
select * from ti1 order by b /* must be (1),(2),(3) */;
b
1
2
3
insert into ti2 set a=1, b=1;
select * from ti2 order by b /* must be (1,1) (2,2) */;
a b
1 1
2 2
set @save_binlog_format= @@session.binlog_format;
set @@session.binlog_format= row;
delete from ti1 where b=1;
select * from ti1 order by b /* must be (2),(3) */;
b
2
3
select * from ti1 order by b /* must stays as were on master (1),(2),(3) */;
b
1
2
3
delete from ti1 where b=3;
insert into ti2 set a=3, b=3;
select * from ti2 order by b /* must be (1,1),(2,2) - not inserted */;
a b
1 1
2 2
set global slave_exec_mode='IDEMPOTENT';
set global slave_exec_mode='STRICT';
set global slave_exec_mode='IDEMPOTENT,STRICT';
ERROR HY000: Ambiguous slave modes combination.
select @@global.slave_exec_mode /* must be STRICT */;
@@global.slave_exec_mode
STRICT
*** foreign keys errors as above now forces to stop
set foreign_key_checks=0;
drop table ti2, ti1;
create table ti1 (b int primary key) engine = innodb;
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
engine = innodb;
set foreign_key_checks=1 /* ensure the check */;
insert into ti1 values (1),(2),(3);
insert into ti2 set a=2, b=2;
select * from ti1 order by b /* must be (1),(2),(3) */;
b
1
2
3
*** conspire future problem
insert into ti2 set a=1, b=1;
select * from ti2 order by b /* must be (1,1) (2,2) */;
a b
1 1
2 2
delete from ti1 where b=1 /* offending delete event */;
select * from ti1 order by b /* must be (2),(3) */;
b
2
3
*** slave must stop
Last_SQL_Error
0
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
b
1
2
3
set foreign_key_checks= 0;
delete from ti2 where b=1;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
*** conspire the following insert failure
*** conspire future problem
delete from ti1 where b=3;
insert into ti2 set a=3, b=3 /* offending write event */;
*** slave must stop
Last_SQL_Error
1452
select * from ti2 order by b /* must be (2,2) */;
a b
2 2
set foreign_key_checks= 0;
insert into ti1 set b=3;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
select * from ti2 order by b /* must be (2,2),(3,3) */;
a b
2 2
3 3
*** other errors
*** conspiring query
insert into ti1 set b=1;
insert into ti1 set b=1 /* offending write event */;
*** slave must stop
Last_SQL_Error
1062
set foreign_key_checks= 0;
delete from ti1 where b=1;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (-1),(-2),(-3);
INSERT INTO t2 VALUES (-1),(-2),(-3);
DELETE FROM t1 WHERE a = -2;
DELETE FROM t2 WHERE a = -2;
DELETE FROM t1 WHERE a = -2;
*** slave must stop
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
DELETE FROM t2 WHERE a = -2;
*** slave must stop
Last_SQL_Error
0
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
UPDATE t1 SET a = 1 WHERE a = -1;
UPDATE t2 SET a = 1 WHERE a = -1;
UPDATE t1 SET a = 1 WHERE a = -1;
*** slave must stop
Last_SQL_Error
1032
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
UPDATE t2 SET a = 1 WHERE a = -1;
*** slave must stop
Last_SQL_Error
0
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
set global slave_exec_mode='STRICT';
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
*** end of tests
......@@ -115,6 +115,7 @@ GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltes
show grants for mysqltest4@localhost;
Grants for mysqltest4@localhost
GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
set global slave_exec_mode='IDEMPOTENT';
drop table t1, t4, mysqltest2.t2;
drop database mysqltest2;
delete from mysql.user where user like "mysqltest%";
......@@ -132,6 +133,7 @@ INSERT INTO t5 (word) VALUES ('TEST’');
SELECT HEX(word) FROM t5;
HEX(word)
54455354E28099
set @@global.slave_exec_mode= default;
SELECT HEX(word) FROM t5;
HEX(word)
54455354E28099
......
......@@ -257,6 +257,7 @@ SELECT * FROM t1 ORDER BY a;
a b
2 master,slave
5 slave
set @@global.slave_exec_mode= 'IDEMPOTENT';
**** On Master ****
UPDATE t1 SET a = 5, b = 'master' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
......@@ -264,6 +265,7 @@ a b
2 master,slave
5 master
**** On Slave ****
set @@global.slave_exec_mode= default;
Last_SQL_Error
SELECT * FROM t1 ORDER BY a;
......
......@@ -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;
......
......@@ -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;
......
......@@ -5,6 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1(n int auto_increment primary key, s char(10));
set @@global.slave_exec_mode= 'IDEMPOTENT';
insert into t1 values (2,'old');
insert into t1 values(NULL,'new');
insert into t1 values(NULL,'new');
......@@ -28,3 +29,4 @@ n s
1 new
3 new
drop table t1;
set @@global.slave_exec_mode= default;
......@@ -37,6 +37,7 @@ ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
set @@global.slave_exec_mode= 'IDEMPOTENT';
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
......@@ -60,6 +61,7 @@ a b
1 2
2 5
**** On Slave ****
set @@global.slave_exec_mode= default;
SELECT a,b,x FROM t1_int ORDER BY a;
a b x
1 2 42
......@@ -123,7 +125,7 @@ Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1364
Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef.
Last_Error Could not execute Write_rows event on table test.t1_nodef; handler error <unknown>; the event's master log master-bin.000001, end_log_pos 2674
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
......@@ -141,7 +143,7 @@ Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 1364
Last_SQL_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef.
Last_SQL_Error Could not execute Write_rows event on table test.t1_nodef; handler error <unknown>; the event's master log master-bin.000001, end_log_pos 2674
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
......
......@@ -37,6 +37,7 @@ ALTER TABLE t8 ADD e1 INT NOT NULL DEFAULT 0, ADD e2 INT NOT NULL DEFAULT 0,
ADD e3 INT NOT NULL DEFAULT 0, ADD e4 INT NOT NULL DEFAULT 0,
ADD e5 INT NOT NULL DEFAULT 0, ADD e6 INT NOT NULL DEFAULT 0,
ADD e7 INT NOT NULL DEFAULT 0, ADD e8 INT NOT NULL DEFAULT 0;
set @@global.slave_exec_mode= 'IDEMPOTENT';
INSERT INTO t1_int VALUES (2, 4, 4711);
INSERT INTO t1_char VALUES (2, 4, 'Foo is a bar');
INSERT INTO t1_bit VALUES (2, 4, b'101', b'11100', b'01');
......@@ -60,6 +61,7 @@ a b
1 2
2 5
**** On Slave ****
set @@global.slave_exec_mode= default;
SELECT a,b,x FROM t1_int ORDER BY a;
a b x
1 2 42
......@@ -123,7 +125,7 @@ Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 1364
Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef.
Last_Error Could not execute Write_rows event on table test.t1_nodef; handler error <unknown>; the event's master log master-bin.000001, end_log_pos 2944
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
......@@ -141,7 +143,7 @@ Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 1364
Last_SQL_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef.
Last_SQL_Error Could not execute Write_rows event on table test.t1_nodef; handler error <unknown>; the event's master log master-bin.000001, end_log_pos 2944
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
......
......@@ -4,8 +4,8 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
stop slave;
create table t1(n int);
stop slave;
start slave;
stop slave io_thread;
start slave io_thread;
......
......@@ -12,6 +12,7 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
SHOW STATUS LIKE 'Slave_retried_transactions';
Variable_name Value
Slave_retried_transactions 0
set @@global.slave_exec_mode= 'IDEMPOTENT';
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
a b
......@@ -28,6 +29,7 @@ a b
3 3
4 4
**** On Slave ****
set @@global.slave_exec_mode= default;
SHOW STATUS LIKE 'Slave_retried_transactions';
Variable_name Value
Slave_retried_transactions 0
......
......@@ -34,7 +34,8 @@ connection master1;
# This sleep is picked so that the query above has started to insert
# some rows into t2. If it hasn't the slave will not stop below.
sleep 4;
let $wait_condition= SELECT COUNT(*) > 1000 FROM t1;
source include/wait_condition.inc
# SHOW PROCESSLIST;
......
# test case for bug#30998
# Drop View breaks replication if view does not exist
#
source include/master-slave.inc;
--disable_warnings
drop table if exists t1, t2;
drop view if exists v1, v2, v3, not_exist_view;
--enable_warnings
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create view v1 as select * from t1;
create view v2 as select * from t2;
create view v3 as select * from t3;
--error 1051
drop view not_exist_view;
--error 1051
drop view v1, not_exist_view;
--error 1146
select * from v1;
drop view v2, v3;
save_master_pos;
connection slave;
sync_with_master;
--error 1146
select * from v1;
--error 1146
select * from v2;
--error 1146
select * from v3;
......@@ -43,7 +43,8 @@ insert into t3 values(connection_id());
send update t2 set a = a + 1 + get_lock('crash_lock%20C', 10);
connection master1;
real_sleep 2;
let $wait_condition= SELECT a > 1 FROM t2;
source include/wait_condition.inc;
select (@id := id) - id from t3;
kill @id;
drop table t2,t3;
......
--slave-exec-mode=IDEMPOTENT --innodb
......@@ -77,3 +77,335 @@ enable_query_log;
connection master;
DROP TABLE t1, t2;
sync_slave_with_master;
# bug#31609 Not all RBR slave errors reported as errors
# bug#31552 Replication breaks when deleting rows from out-of-sync table
# without PK
#
# Idempotent applying is not default any longer.
# The default for slave-exec-mode option and server
# variable slave_exec_mode is 'STRICT'.
# When 'STRICT' mode is set, the slave SQL thread will stop whenever
# the row to change is not found. In 'IDEMPOTENT' mode, the SQL thread
# will continue running and apply the row - replace if it's Write_rows event -
# or skip to the next event.
# the previous part of the tests was with IDEMPOTENT slave's mode.
#
# Other than above idempotent errors dealing with foreign keys constraint
#
select @@global.slave_exec_mode /* must be IDEMPOTENT */;
connection master;
create table ti1 (b int primary key) engine = innodb;
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
engine = innodb;
set foreign_key_checks=1 /* ensure the check */;
insert into ti1 values (1),(2),(3);
insert into ti2 set a=2, b=2;
sync_slave_with_master;
#connection slave;
select * from ti1 order by b /* must be (1),(2),(3) */;
insert into ti2 set a=1, b=1;
select * from ti2 order by b /* must be (1,1) (2,2) */;
connection master;
# from now on checking rbr specific idempotent errors
set @save_binlog_format= @@session.binlog_format;
set @@session.binlog_format= row;
delete from ti1 where b=1;
select * from ti1 order by b /* must be (2),(3) */;
# slave must catch up (expect some warnings in error.log)
sync_slave_with_master;
#connection slave;
select * from ti1 order by b /* must stays as were on master (1),(2),(3) */;
delete from ti1 where b=3;
connection master;
insert into ti2 set a=3, b=3;
# slave must catch up (expect some warnings in error.log)
sync_slave_with_master;
#connection slave;
select * from ti2 order by b /* must be (1,1),(2,2) - not inserted */;
#
# Checking the new global sys variable
#
connection slave;
set global slave_exec_mode='IDEMPOTENT';
set global slave_exec_mode='STRICT';
# checking mutual exclusion for the options
--error ER_SLAVE_AMBIGOUS_EXEC_MODE
set global slave_exec_mode='IDEMPOTENT,STRICT';
select @@global.slave_exec_mode /* must be STRICT */;
#
# Checking stops.
# In the following sections strict slave sql thread is going to
# stop when faces an idempotent error. In order to proceed
# the mode is temporarily switched to indempotent.
#
#
--echo *** foreign keys errors as above now forces to stop
#
connection master;
set foreign_key_checks=0;
drop table ti2, ti1;
create table ti1 (b int primary key) engine = innodb;
create table ti2 (a int primary key, b int, foreign key (b) references ti1(b))
engine = innodb;
set foreign_key_checks=1 /* ensure the check */;
insert into ti1 values (1),(2),(3);
insert into ti2 set a=2, b=2;
sync_slave_with_master;
#connection slave;
select * from ti1 order by b /* must be (1),(2),(3) */;
--echo *** conspire future problem
insert into ti2 set a=1, b=1;
select * from ti2 order by b /* must be (1,1) (2,2) */;
connection master;
delete from ti1 where b=1 /* offending delete event */;
select * from ti1 order by b /* must be (2),(3) */;
# foreign key: row is referenced
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
select * from ti1 order by b /* must be (1),(2),(3) - not deleted */;
set foreign_key_checks= 0;
delete from ti2 where b=1;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
connection master;
sync_slave_with_master;
#connection slave;
--echo *** conspire the following insert failure
# foreign key: no referenced row
--echo *** conspire future problem
delete from ti1 where b=3;
connection master;
insert into ti2 set a=3, b=3 /* offending write event */;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
select * from ti2 order by b /* must be (2,2) */;
set foreign_key_checks= 0;
insert into ti1 set b=3;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
connection master;
sync_slave_with_master;
select * from ti2 order by b /* must be (2,2),(3,3) */;
#
--echo *** other errors
#
# dup key insert
#connection slave;
--echo *** conspiring query
insert into ti1 set b=1;
connection master;
insert into ti1 set b=1 /* offending write event */;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
set foreign_key_checks= 0;
delete from ti1 where b=1;
set foreign_key_checks= 1;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
# key not found
connection master;
CREATE TABLE t1 (a INT PRIMARY KEY);
CREATE TABLE t2 (a INT);
INSERT INTO t1 VALUES (-1),(-2),(-3);
INSERT INTO t2 VALUES (-1),(-2),(-3);
sync_slave_with_master;
#connection slave;
DELETE FROM t1 WHERE a = -2;
DELETE FROM t2 WHERE a = -2;
connection master;
DELETE FROM t1 WHERE a = -2;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
connection master;
DELETE FROM t2 WHERE a = -2;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
UPDATE t1 SET a = 1 WHERE a = -1;
UPDATE t2 SET a = 1 WHERE a = -1;
connection master;
UPDATE t1 SET a = 1 WHERE a = -1;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
connection master;
UPDATE t2 SET a = 1 WHERE a = -1;
--echo *** slave must stop
source include/wait_for_slave_sql_to_stop.inc;
connection slave;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
enable_query_log;
set global slave_exec_mode='IDEMPOTENT';
start slave sql_thread;
connection master;
sync_slave_with_master;
#connection slave;
set global slave_exec_mode='STRICT';
# cleanup for bug#31609 tests
connection master;
set @@session.binlog_format= @save_binlog_format;
drop table t1,t2,ti2,ti1;
sync_slave_with_master;
--echo *** end of tests
......@@ -119,6 +119,13 @@ show grants for mysqltest3@localhost;
show grants for mysqltest4@localhost;
# Cleanup
# connection slave;
# BUG31552 changes idempotency is not default any longer
# In order the following `delete from mysql.user',
# where mysqltest1 does not exist on slave,
# to succeed on slave the mode is temporarily changed
set global slave_exec_mode='IDEMPOTENT';
connection master;
drop table t1, t4, mysqltest2.t2;
drop database mysqltest2;
......@@ -129,7 +136,10 @@ delete from mysql.db where user like "mysqltest%";
# move it to slave instead
#delete from mysql.tables_priv where user like "mysqltest%";
delete from mysql.columns_priv where user like "mysqltest%";
sync_slave_with_master;
# bug#31552: do not restore the mode here but later in order
# to succeed with yet the following delete from mysql.tables_priv
#BUG27606
delete from mysql.tables_priv where user like "mysqltest%";
......@@ -155,6 +165,7 @@ CREATE TEMPORARY TABLE tmptbl504451f4258$1 (id INT NOT NULL) ENGINE=MEMORY;
INSERT INTO t5 (word) VALUES ('TEST’');
SELECT HEX(word) FROM t5;
sync_slave_with_master;
set @@global.slave_exec_mode= default; # bug#31552 comments above
connection slave;
SELECT HEX(word) FROM t5;
--error 1146
......
......@@ -6,7 +6,6 @@ source include/master-slave.inc;
save_master_pos;
connection slave;
sleep 1;
show variables like 'init_slave';
show variables like 'max_connections';
sync_with_master;
......
......@@ -17,18 +17,8 @@ let $query = "INSERT DELAYED INTO t1 VALUES (1, 'Dr. No'), (2, 'From Russia With
--exec $MYSQL_SLAP --silent --concurrency=5 --iterations=200 --query=$query --delimiter=";"
# Wait until all the 5000 inserts has been inserted into the table
--disable_query_log
let $counter= 300; # Max 30 seconds wait
while (`select count(*)!=5000 from mysqlslap.t1`)
{
sleep 0.1;
dec $counter;
if (!$counter)
{
Number of records in t1 didnt reach 5000;
}
}
--enable_query_log
let $wait_condition= SELECT COUNT(*) = 5000 FROM mysqlslap.t1;
--source include/wait_condition.inc
SELECT COUNT(*) FROM mysqlslap.t1;
sync_slave_with_master;
......
......@@ -36,11 +36,12 @@ delimiter ;|
CALL test.p1();
SELECT * FROM test.t1 ORDER BY blob_column;
save_master_pos;
# Need to allow some time when NDB engine is used for
# the injector thread to have time to populate binlog
sleep 10;
sync_slave_with_master;
connection slave;
# Need to allow some time when NDB engine is used for
# the injector thread to have time to populate binlog
let $wait_condition= SELECT INSTR(blob_column,'aberration') > 0 FROM test.t1 WHERE a = 2;
--source include/wait_condition.inc
SELECT * FROM test.t1 ORDER BY blob_column;
# Cleanup
......
......@@ -242,12 +242,17 @@ INSERT INTO t1 VALUES (1,'master,slave'), (2,'master,slave');
sync_slave_with_master;
UPDATE t1 SET a = 5, b = 'slave' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
# since bug#31552/31609 idempotency is not default any longer. In
# order the preceeding test UPDATE t1 to pass the mode is switched
# temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
--echo **** On Master ****
connection master;
UPDATE t1 SET a = 5, b = 'master' WHERE a = 1;
SELECT * FROM t1 ORDER BY a;
--echo **** On Slave ****
sync_slave_with_master;
set @@global.slave_exec_mode= default;
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
disable_query_log;
eval SELECT "$last_error" AS Last_SQL_Error;
......
......@@ -9,6 +9,12 @@
# first, cause a duplicate key problem on the slave
create table t1(n int auto_increment primary key, s char(10));
sync_slave_with_master;
# bug#31552/31609 idempotency is not default any longer
# so that the declared in heading comments aim of the test
# should be backed up with explicit setting of the slave mode
set @@global.slave_exec_mode= 'IDEMPOTENT';
insert into t1 values (2,'old');
connection master;
insert into t1 values(NULL,'new');
......@@ -43,3 +49,4 @@ select * from t1 order by n;
connection master;
drop table t1;
sync_slave_with_master;
set @@global.slave_exec_mode= default;
......@@ -46,11 +46,15 @@ delimiter ;//
-- disable_query_log
-- disable_result_log
SET @wait_count=1;
let $1=10;
while ($1)
{
call test.p1();
sleep 1;
let $wait_condition= SELECT COUNT(*) = @wait_count FROM test.t1;
-- source include/wait_condition.inc
-- disable_query_log
SET @wait_count = @wait_count + 1;
dec $1;
}
-- enable_result_log
......
......@@ -84,7 +84,8 @@ let $message=< ---- Master selects-- >;
--source include/show_msg.inc
connection master;
CALL test.p1();
sleep 6;
let $wait_condition= SELECT COUNT(*) = 4 FROM t3;
--source include/wait_condition.inc
SELECT * FROM test.t3 ORDER BY id3;
let $message=< ---- Slave selects-- >;
......
......@@ -33,7 +33,8 @@ start slave;
# hope one second is not enough for slave to reach the last
# Rows_log_event, so that test actually tests something.
real_sleep 1;
let $wait_condition= SELECT COUNT(*) >= 10 FROM t1;
--source include/wait_condition.inc
stop slave;
# see if slave hangs on DROP TABLE
......
......@@ -53,11 +53,15 @@ delimiter ;//
-- disable_query_log
-- disable_result_log
SET @wait_count = 1;
let $1=10;
while ($1)
{
CALL test.p2();
sleep 1;
let $wait_condition= SELECT COUNT(*) = @wait_count FROM test.t3;
--source include/wait_condition.inc
--disable_query_log
SET @wait_count = @wait_count + 1;
dec $1;
}
-- enable_result_log
......
......@@ -108,11 +108,13 @@ UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
# To make sure BUG#14698 is gone, we sleep 2 seconds before calling trigger
# To make sure BUG#14698 is gone, we sleep before calling trigger
# (with the bug in, that caused differences in TIMESTAMP columns).
# We just need to let the machine's clock advance, it's not
# to do synchronization, so real_sleep is good.
real_sleep 2;
# to do synchronization.
let $wait_condition= SELECT SUM(f)= ROUND(SUM(f)) FROM t3;
--source include/wait_condition.inc
DELETE FROM test.t1 WHERE id = 1;
......
......@@ -24,7 +24,8 @@ start slave;
connection master;
insert into t1 values (1);
#reasonable timeout for changes to propagate to slave
sleep 3;
let $wait_condition= SELECT COUNT(*) = 1 FROM t1;
source include/wait_condition.inc;
connection slave;
select * from t1;
......
......@@ -3,12 +3,12 @@ source include/master-slave.inc;
#
# Bug#6148 ()
#
connection slave;
stop slave;
# Let the master do lots of insertions
connection master;
create table t1(n int);
sync_slave_with_master;
stop slave;
connection master;
let $1=5000;
disable_query_log;
while ($1)
......@@ -21,7 +21,8 @@ save_master_pos;
connection slave;
start slave;
sleep 1;
let $wait_condition= SELECT COUNT(*) > 0 FROM t1;
source include/wait_condition.inc;
stop slave io_thread;
start slave io_thread;
sync_with_master;
......
......@@ -293,7 +293,8 @@ insert delayed into t2 values(rand());
set @a=2.345;
insert delayed into t2 values(@a);
sleep 4; # time for the delayed inserts to reach disk
let $wait_condition= SELECT COUNT(*) = 19 FROM t2;
--source include/wait_condition.inc
# If you want to do manual testing of the mixed mode regarding UDFs (not
# testable automatically as quite platform- and compiler-dependent),
......
......@@ -60,23 +60,24 @@ insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
connection con1;
create temporary table t3(f int);
insert into t3 select * from t1 where f<6;
sleep 1;
let $wait_condition= SELECT COUNT(*) = 5 FROM t3;
--source include/wait_condition.inc
connection con2;
create temporary table t3(f int);
sleep 1;
connection con1;
insert into t2 select count(*) from t3;
sleep 1;
let $wait_condition= SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
connection con2;
insert into t3 select * from t1 where f>=4;
sleep 1;
let $wait_condition= SELECT COUNT(*) = 7 FROM t3;
--source include/wait_condition.inc
connection con1;
drop temporary table t3;
sleep 1;
connection con2;
insert into t2 select count(*) from t3;
......
......@@ -8,6 +8,9 @@ INSERT INTO t1 VALUES (1,1), (2,2), (3,3), (4,4);
--echo **** On Slave ****
sync_slave_with_master;
SHOW STATUS LIKE 'Slave_retried_transactions';
# since bug#31552/31609 idempotency is not default any longer. In order
# the following UPDATE t1 to pass the mode is switched temprorarily
set @@global.slave_exec_mode= 'IDEMPOTENT';
UPDATE t1 SET a = 5, b = 47 WHERE a = 1;
SELECT * FROM t1;
--echo **** On Master ****
......@@ -17,6 +20,7 @@ SELECT * FROM t1;
#SHOW BINLOG EVENTS;
--echo **** On Slave ****
sync_slave_with_master;
set @@global.slave_exec_mode= default;
SHOW STATUS LIKE 'Slave_retried_transactions';
SELECT * FROM t1;
source include/show_slave_status.inc;
......
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
......@@ -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;
......
......@@ -15,7 +15,6 @@ rpl_ndb_2innodb : Bug #32648 Test failure between NDB Cluster and oth
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_ddl : BUG#28798 2007-05-31 lars Valgrind failure in NDB
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
......
# test case for bug#30998
# Drop View breaks replication if view does not exist
#
source include/master-slave.inc;
--disable_warnings
drop table if exists t1, t2;
drop view if exists v1, v2, v3, not_exist_view;
--enable_warnings
create table t1 (a int);
create table t2 (b int);
create table t3 (c int);
create view v1 as select * from t1;
create view v2 as select * from t2;
create view v3 as select * from t3;
--error 1051
drop view not_exist_view;
--error 1051
drop view v1, not_exist_view;
--error 1146
select * from v1;
drop view v2, v3;
save_master_pos;
connection slave;
sync_with_master;
--error 1146
select * from v1;
--error 1146
select * from v2;
--error 1146
select * from v3;
......@@ -775,7 +775,7 @@ static int ndbcluster_create_ndb_apply_status_table(THD *thd)
" 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=NDB");
" PRIMARY KEY USING HASH (server_id) ) ENGINE=NDB CHARACTER SET utf8");
const int no_print_error[4]= {ER_TABLE_EXISTS_ERROR,
701,
......@@ -835,7 +835,7 @@ static int ndbcluster_create_schema_table(THD *thd)
" id INT UNSIGNED NOT NULL,"
" version INT UNSIGNED NOT NULL,"
" type INT UNSIGNED NOT NULL,"
" PRIMARY KEY USING HASH (db,name) ) ENGINE=NDB");
" PRIMARY KEY USING HASH (db,name) ) ENGINE=NDB CHARACTER SET utf8");
const int no_print_error[4]= {ER_TABLE_EXISTS_ERROR,
701,
......@@ -3960,6 +3960,7 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
i_ndb->setReportThreshEventFreeMem(ndb_report_thresh_binlog_mem_usage);
bzero((char*) &row, sizeof(row));
thd->variables.character_set_client= &my_charset_latin1;
injector::transaction trans;
// pass table map before epoch
{
......
This diff is collapsed.
......@@ -809,6 +809,12 @@ class Log_event
bool cache_stmt;
/**
A storage to cache the global system variable's value.
Handling of a separate event will be governed its member.
*/
ulong slave_exec_mode;
#ifndef MYSQL_CLIENT
THD* thd;
......
......@@ -1812,6 +1812,7 @@ extern uint volatile thread_count, thread_running, global_read_lock;
extern my_bool opt_sql_bin_update, opt_safe_user_create, opt_no_mix_types;
extern my_bool opt_safe_show_db, opt_local_infile, opt_myisam_use_mmap;
extern my_bool opt_slave_compressed_protocol, use_temp_pool;
extern ulong slave_exec_mode_options;
extern my_bool opt_readonly, lower_case_file_system;
extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
extern my_bool opt_secure_auth;
......
......@@ -445,6 +445,8 @@ ulong thread_stack, what_to_log;
ulong query_buff_size, slow_launch_time, slave_open_temp_tables;
ulong open_files_limit, max_binlog_size, max_relay_log_size;
ulong slave_net_timeout, slave_trans_retries;
ulong slave_exec_mode_options;
const char *slave_exec_mode_str= "STRICT";
ulong thread_cache_size=0, thread_pool_size= 0;
ulong binlog_cache_size=0, max_binlog_cache_size=0;
ulong query_cache_size=0;
......@@ -5105,7 +5107,8 @@ enum options_mysqld
OPT_SECURE_FILE_PRIV,
OPT_MIN_EXAMINED_ROW_LIMIT,
OPT_LOG_SLOW_SLAVE_STATEMENTS,
OPT_OLD_MODE
OPT_OLD_MODE,
OPT_SLAVE_EXEC_MODE
};
......@@ -5803,8 +5806,11 @@ replicating a LOAD DATA INFILE command.",
(uchar**) &slave_load_tmpdir, (uchar**) &slave_load_tmpdir, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-skip-errors", OPT_SLAVE_SKIP_ERRORS,
"Tells the slave thread to continue replication when a query returns an error from the provided list.",
"Tells the slave thread to continue replication when a query event returns an error from the provided list.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"slave-exec-mode", OPT_SLAVE_EXEC_MODE,
"Modes for how replication events should be executed. Legal values are STRICT (default) and IDEMPOTENT. In IDEMPOTENT mode, replication will not stop for operations that are idempotent. In STRICT mode, replication will stop on any unexpected difference between the master and the slave.",
(uchar**) &slave_exec_mode_str, (uchar**) &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"slow-query-log", OPT_SLOW_LOG,
"Enable|disable slow query log", (uchar**) &opt_slow_log,
......@@ -7113,6 +7119,9 @@ static void mysql_init_variables(void)
/* Things with default values that are not zero */
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
slave_exec_mode_options= 0;
slave_exec_mode_options= (uint)
find_bit_type_or_exit(slave_exec_mode_str, &slave_exec_mode_typelib, NULL);
opt_specialflag= SPECIAL_ENGLISH;
unix_sock= ip_sock= INVALID_SOCKET;
mysql_home_ptr= mysql_home;
......@@ -7322,6 +7331,10 @@ mysqld_get_one_option(int optid,
case OPT_SLAVE_SKIP_ERRORS:
init_slave_skip_errors(argument);
break;
case OPT_SLAVE_EXEC_MODE:
slave_exec_mode_options= (uint)
find_bit_type_or_exit(argument, &slave_exec_mode_typelib, "");
break;
#endif
case OPT_SAFEMALLOC_MEM_LIMIT:
#if !defined(DBUG_OFF) && defined(SAFEMALLOC)
......@@ -7867,6 +7880,8 @@ static void get_options(int *argc,char **argv)
}
/* Set global MyISAM variables from delay_key_write_options */
fix_delay_key_write((THD*) 0, OPT_GLOBAL);
/* Set global slave_exec_mode from its option */
fix_slave_exec_mode(OPT_GLOBAL);
#ifndef EMBEDDED_LIBRARY
if (mysqld_chroot)
......
......@@ -1160,6 +1160,11 @@ void Relay_log_info::cleanup_context(THD *thd, bool error)
close_thread_tables(thd);
clear_tables_to_lock();
clear_flag(IN_STMT);
/*
Cleanup for the flags that have been set at do_apply_event.
*/
thd->options&= ~OPTION_NO_FOREIGN_KEY_CHECKS;
thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS;
last_event_start_time= 0;
DBUG_VOID_RETURN;
}
......
......@@ -88,6 +88,16 @@ TYPELIB delay_key_write_typelib=
delay_key_write_type_names, NULL
};
const char *slave_exec_mode_names[]=
{ "STRICT", "IDEMPOTENT", NullS };
static const unsigned int slave_exec_mode_names_len[]=
{ sizeof("STRICT") - 1, sizeof("IDEMPOTENT") - 1, 0 };
TYPELIB slave_exec_mode_typelib=
{
array_elements(slave_exec_mode_names)-1, "",
slave_exec_mode_names, (unsigned int *) slave_exec_mode_names_len
};
static int sys_check_ftb_syntax(THD *thd, set_var *var);
static bool sys_update_ftb_syntax(THD *thd, set_var * var);
static void sys_default_ftb_syntax(THD *thd, enum_var_type type);
......@@ -408,6 +418,11 @@ static sys_var_const_str_ptr sys_secure_file_priv(&vars, "secure_file_priv",
static sys_var_long_ptr sys_server_id(&vars, "server_id", &server_id, fix_server_id);
static sys_var_bool_ptr sys_slave_compressed_protocol(&vars, "slave_compressed_protocol",
&opt_slave_compressed_protocol);
static sys_var_set_slave_mode slave_exec_mode(&vars,
"slave_exec_mode",
&slave_exec_mode_options,
&slave_exec_mode_typelib,
0);
static sys_var_long_ptr sys_slow_launch_time(&vars, "slow_launch_time",
&slow_launch_time);
static sys_var_thd_ulong sys_sort_buffer(&vars, "sort_buffer_size",
......@@ -985,6 +1000,79 @@ extern void fix_delay_key_write(THD *thd, enum_var_type type)
}
}
bool sys_var_set::update(THD *thd, set_var *var)
{
*value= var->save_result.ulong_value;
return 0;
};
uchar *sys_var_set::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
char buff[256];
String tmp(buff, sizeof(buff), &my_charset_latin1);
ulong length;
ulong val= *value;
tmp.length(0);
for (uint i= 0; val; val>>= 1, i++)
{
if (val & 1)
{
tmp.append(enum_names->type_names[i],
enum_names->type_lengths[i]);
tmp.append(',');
}
}
if ((length= tmp.length()))
length--;
return (uchar*) thd->strmake(tmp.ptr(), length);
}
void sys_var_set_slave_mode::set_default(THD *thd, enum_var_type type)
{
slave_exec_mode_options= 0;
bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
}
bool sys_var_set_slave_mode::check(THD *thd, set_var *var)
{
bool rc= sys_var_set::check(thd, var);
if (!rc &&
bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_STRICT) == 1 &&
bit_is_set(var->save_result.ulong_value, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
{
rc= true;
my_error(ER_SLAVE_AMBIGOUS_EXEC_MODE, MYF(0), "");
}
return rc;
}
bool sys_var_set_slave_mode::update(THD *thd, set_var *var)
{
bool rc;
pthread_mutex_lock(&LOCK_global_system_variables);
rc= sys_var_set::update(thd, var);
pthread_mutex_unlock(&LOCK_global_system_variables);
return rc;
}
void fix_slave_exec_mode(enum_var_type type)
{
DBUG_ENTER("fix_slave_exec_mode");
compile_time_assert(sizeof(slave_exec_mode_options) * CHAR_BIT
> SLAVE_EXEC_MODE_LAST_BIT - 1);
if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT) == 1 &&
bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 1)
{
sql_print_error("Ambiguous slave modes combination."
" STRICT will be used");
bit_do_clear(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT);
}
if (bit_is_set(slave_exec_mode_options, SLAVE_EXEC_MODE_IDEMPOTENT) == 0)
bit_do_set(slave_exec_mode_options, SLAVE_EXEC_MODE_STRICT);
}
bool sys_var_thd_binlog_format::is_readonly() const
{
......@@ -3169,7 +3257,18 @@ int set_var::light_check(THD *thd)
return 0;
}
/**
Update variable
@param thd thread handler
@returns 0|1 ok or ERROR
@note ERROR can be only due to abnormal operations involving
the server's execution evironment such as
out of memory, hard disk failure or the computer blows up.
Consider set_var::check() method if there is a need to return
an error due to logics.
*/
int set_var::update(THD *thd)
{
if (!value)
......
......@@ -30,7 +30,8 @@ class sys_var_pluginvar; /* opaque */
typedef struct system_variables SV;
typedef struct my_locale_st MY_LOCALE;
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib;
extern TYPELIB bool_typelib, delay_key_write_typelib, sql_mode_typelib,
slave_exec_mode_typelib;
typedef int (*sys_check_func)(THD *, set_var *);
typedef bool (*sys_update_func)(THD *, set_var *);
......@@ -771,6 +772,42 @@ class sys_var_log_state :public sys_var_bool_ptr
};
class sys_var_set :public sys_var
{
protected:
ulong *value;
TYPELIB *enum_names;
public:
sys_var_set(sys_var_chain *chain, const char *name_arg, ulong *value_arg,
TYPELIB *typelib, sys_after_update_func func)
:sys_var(name_arg, func), value(value_arg), enum_names(typelib)
{ chain_sys_var(chain); }
virtual bool check(THD *thd, set_var *var)
{
return check_set(thd, var, enum_names);
}
virtual void set_default(THD *thd, enum_var_type type)
{
*value= 0;
}
bool update(THD *thd, set_var *var);
uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check_update_type(Item_result type) { return 0; }
SHOW_TYPE show_type() { return SHOW_CHAR; }
};
class sys_var_set_slave_mode :public sys_var_set
{
public:
sys_var_set_slave_mode(sys_var_chain *chain, const char *name_arg,
ulong *value_arg,
TYPELIB *typelib, sys_after_update_func func) :
sys_var_set(chain, name_arg, value_arg, typelib, func) {}
void set_default(THD *thd, enum_var_type type);
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var);
};
class sys_var_log_output :public sys_var
{
ulong *value;
......@@ -1189,6 +1226,7 @@ sys_var *find_sys_var(THD *thd, const char *str, uint length=0);
int sql_set_variables(THD *thd, List<set_var_base> *var_list);
bool not_all_support_one_shot(List<set_var_base> *var_list);
void fix_delay_key_write(THD *thd, enum_var_type type);
void fix_slave_exec_mode(enum_var_type type);
ulong fix_sql_mode(ulong sql_mode);
extern sys_var_const_str sys_charset_system;
extern sys_var_str sys_init_connect;
......
......@@ -6114,3 +6114,5 @@ ER_TRG_CANT_OPEN_TABLE
ER_CANT_CREATE_SROUTINE
eng "Cannot create stored routine `%-.64s`. Check warnings"
ER_SLAVE_AMBIGOUS_EXEC_MODE
eng "Ambiguous slave modes combination. %s"
......@@ -38,6 +38,9 @@ enum enum_ha_read_modes { RFIRST, RNEXT, RPREV, RLAST, RKEY, RNEXT_SAME };
enum enum_duplicates { DUP_ERROR, DUP_REPLACE, DUP_UPDATE };
enum enum_delay_key_write { DELAY_KEY_WRITE_NONE, DELAY_KEY_WRITE_ON,
DELAY_KEY_WRITE_ALL };
enum enum_slave_exec_mode { SLAVE_EXEC_MODE_STRICT,
SLAVE_EXEC_MODE_IDEMPOTENT,
SLAVE_EXEC_MODE_LAST_BIT};
enum enum_mark_columns
{ MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE};
......
......@@ -297,8 +297,8 @@ bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset,
return TRUE;
/*
Note, this is only safe for little-endian UCS-2.
If we add big-endian UCS-2 sometimes, this code
Note, this is only safe for big-endian UCS-2.
If we add little-endian UCS-2 sometimes, this code
will be more complicated. But it's OK for now.
*/
bzero((char*) Ptr, offset);
......
......@@ -1465,6 +1465,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
char *wrong_object_db= NULL, *wrong_object_name= NULL;
bool error= FALSE;
enum legacy_db_type not_used;
bool some_views_deleted= FALSE;
bool something_wrong= FALSE;
DBUG_ENTER("mysql_drop_view");
VOID(pthread_mutex_lock(&LOCK_open));
......@@ -1506,6 +1508,8 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
if (my_delete(path, MYF(MY_WME)))
error= TRUE;
some_views_deleted= TRUE;
/*
For a view, there is only one table_share object which should never
be used outside of LOCK_open
......@@ -1523,29 +1527,32 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
sp_cache_invalidate();
}
if (error)
{
VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(TRUE);
}
if (wrong_object_name)
{
VOID(pthread_mutex_unlock(&LOCK_open));
my_error(ER_WRONG_OBJECT, MYF(0), wrong_object_db, wrong_object_name,
"VIEW");
DBUG_RETURN(TRUE);
}
if (non_existant_views.length())
{
VOID(pthread_mutex_unlock(&LOCK_open));
my_error(ER_BAD_TABLE_ERROR, MYF(0), non_existant_views.c_ptr());
DBUG_RETURN(TRUE);
}
write_bin_log(thd, TRUE, thd->query, thd->query_length);
something_wrong= error || wrong_object_name || non_existant_views.length();
if (some_views_deleted || !something_wrong)
{
/* if something goes wrong, bin-log with possible error code,
otherwise bin-log with error code cleared.
*/
write_bin_log(thd, !something_wrong, thd->query, thd->query_length);
}
send_ok(thd);
VOID(pthread_mutex_unlock(&LOCK_open));
if (something_wrong)
{
DBUG_RETURN(TRUE);
}
send_ok(thd);
DBUG_RETURN(FALSE);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment