Commit 7c9503b7 authored by Alfranio Correia's avatar Alfranio Correia

merge 5.1-bugteam (local) --> 5.1-bugteam

parents 0b876508 9f768be5
...@@ -407,37 +407,57 @@ sync_slave_with_master; ...@@ -407,37 +407,57 @@ sync_slave_with_master;
########################################### ###########################################
# Bug#22234, Bug#23907 Extra Slave Col is not # Bug#22234, Bug#23907 Extra Slave Col is not
# erroring on extra col with no default values. # erroring on extra col with no default values.
######################################################## ###############################################################
# Error reaction is up to sql_mode of the slave sql (bug#38173)
#--echo *** Create t9 on slave *** #--echo *** Create t9 on slave ***
STOP SLAVE; # Please, check BUG#47741 to see why you are not testing NDB.
RESET SLAVE; if (`SELECT $engine_type != 'NDB'`)
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), {
d TIMESTAMP, STOP SLAVE;
e INT NOT NULL) ENGINE=$engine_type; RESET SLAVE;
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
--echo *** Create t9 on Master *** d TIMESTAMP,
connection master; e INT NOT NULL,
eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) f text not null,
g text,
h blob not null,
i blob) ENGINE=$engine_type;
--echo *** Create t9 on Master ***
connection master;
eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type; ) ENGINE=$engine_type;
RESET MASTER; RESET MASTER;
--echo *** Start Slave *** --echo *** Start Slave ***
connection slave; connection slave;
START SLAVE; START SLAVE;
--echo *** Master Data Insert *** --echo *** Master Data Insert ***
connection master; connection master;
set @b1 = 'b1b1b1b1'; set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
connection slave; set @b1 = concat(@b1,@b1);
--source include/wait_for_slave_sql_to_stop.inc INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # # the test would stop slave if @@sql_mode for the sql thread
--query_vertical SHOW SLAVE STATUS # was set to strict. Otherwise, as with this tests setup,
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; # the implicit defaults will be inserted into fields even though
START SLAVE; # they are declared without DEFAULT clause.
sync_slave_with_master;
select * from t9;
# todo: fix Bug #43992 slave sql thread can't tune own sql_mode ...
# and add/restore waiting for stop test
#--source include/wait_for_slave_sql_to_stop.inc
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
#--query_vertical SHOW SLAVE STATUS
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#START SLAVE;
}
#--echo *** Drop t9 *** #--echo *** Drop t9 ***
#connection master; #connection master;
......
#################################################################################
# This test checks if the replication between "null" fields to either "null"
# fields or "not null" fields works properly. In the first case, the execution
# should work fine. In the second case, it may fail according to the sql_mode
# being used.
#
# The test is devided in three main parts:
#
# 1 - NULL --> NULL (no failures)
# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures)
# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
#
#################################################################################
connection master;
SET SQL_LOG_BIN= 0;
eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
connection slave;
eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
--echo ************* EXECUTION WITH INSERTS *************
connection master;
INSERT INTO t1(a,b,c) VALUES (1, null, 1);
INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, 4);
INSERT INTO t1(a) VALUES (5);
INSERT INTO t2(a,b) VALUES (1, null);
INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
INSERT INTO t2(a) VALUES (3);
INSERT INTO t3(a,b) VALUES (1, null);
INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
INSERT INTO t3(a) VALUES (3);
INSERT INTO t4(a,b,c) VALUES (1, null, 1);
INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t4(a,b) VALUES (3, null);
INSERT INTO t4(a,c) VALUES (4, 4);
INSERT INTO t4(a) VALUES (5);
--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
let $diff_table_1=master:test.t2;
let $diff_table_2=slave:test.t2;
source include/diff_tables.inc;
--echo TABLES t2 and t3 must be different.
connection master;
SELECT * FROM t3 ORDER BY a;
connection slave;
SELECT * FROM t3 ORDER BY a;
connection master;
SELECT * FROM t4 ORDER BY a;
connection slave;
SELECT * FROM t4 ORDER BY a;
--echo ************* EXECUTION WITH UPDATES and REPLACES *************
connection master;
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
UPDATE t1 set b= NULL, c= 300 where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
sync_slave_with_master;
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
--echo ************* CLEANING *************
connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
sync_slave_with_master;
connection master;
SET SQL_LOG_BIN= 0;
eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= $engine;
SET SQL_LOG_BIN= 1;
connection slave;
eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= $engine;
--echo ************* EXECUTION WITH INSERTS *************
connection master;
INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, b'01');
INSERT INTO t1(a) VALUES (5);
--echo ************* SHOWING THE RESULT SETS WITH INSERTS *************
--echo TABLES t1 and t2 must be different.
sync_slave_with_master;
connection master;
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
connection slave;
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
--echo ************* EXECUTION WITH UPDATES and REPLACES *************
connection master;
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
UPDATE t1 set b= NULL, c= b'00' where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
--echo TABLES t1 and t2 must be equal otherwise an error will be thrown.
sync_slave_with_master;
let $diff_table_1=master:test.t1;
let $diff_table_2=slave:test.t1;
source include/diff_tables.inc;
connection master;
DROP TABLE t1;
sync_slave_with_master;
--echo ################################################################################
--echo # NULL ---> NOT NULL (STRICT MODE)
--echo # UNCOMMENT THIS AFTER FIXING BUG#43992
--echo ################################################################################
#connection slave;
#SET GLOBAL sql_mode="TRADITIONAL";
#
#STOP SLAVE;
#--source include/wait_for_slave_to_stop.inc
#START SLAVE;
#--source include/wait_for_slave_to_start.inc
#
#let $y=0;
#while (`select $y < 6`)
#{
# connection master;
#
# SET SQL_LOG_BIN= 0;
# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
# SET SQL_LOG_BIN= 1;
#
# connection slave;
#
# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
# `c` INT NOT NULL,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
# `c` INT,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
# `c` INT DEFAULT 500,
# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
#
# if (`select $y=0`)
# {
# --echo ************* EXECUTION WITH INSERTS *************
# connection master;
# INSERT INTO t1(a) VALUES (1);
# }
#
# if (`select $y=1`)
# {
# --echo ************* EXECUTION WITH INSERTS *************
# connection master;
# INSERT INTO t1(a, b) VALUES (1, NULL);
# }
#
# if (`select $y=2`)
# {
# --echo ************* EXECUTION WITH UPDATES *************
# connection master;
# INSERT INTO t3(a, b) VALUES (1, 1);
# INSERT INTO t3(a, b) VALUES (2, 1);
# UPDATE t3 SET b = NULL where a= 1;
# }
#
# if (`select $y=3`)
# {
# --echo ************* EXECUTION WITH INSERTS/REPLACES *************
# connection master;
# REPLACE INTO t3(a, b) VALUES (1, null);
# }
#
# if (`select $y=4`)
# {
# --echo ************* EXECUTION WITH UPDATES/REPLACES *************
# connection master;
# INSERT INTO t3(a, b) VALUES (1, 1);
# REPLACE INTO t3(a, b) VALUES (1, null);
# }
#
# if (`select $y=5`)
# {
# --echo ************* EXECUTION WITH MULTI-ROW INSERTS *************
# connection master;
#
# SET SQL_LOG_BIN= 0;
# INSERT INTO t2(a, b) VALUES (1, 1);
# INSERT INTO t2(a, b) VALUES (2, 1);
# INSERT INTO t2(a, b) VALUES (3, null);
# INSERT INTO t2(a, b) VALUES (4, 1);
# INSERT INTO t2(a, b) VALUES (5, 1);
# SET SQL_LOG_BIN= 1;
#
# INSERT INTO t2 SELECT a + 10, b from t2;
# --echo The statement below is just executed to stop processing
# INSERT INTO t1(a) VALUES (1);
# }
#
# --echo ************* SHOWING THE RESULT SETS *************
# connection slave;
# --source include/wait_for_slave_sql_to_stop.inc
# connection master;
# SELECT * FROM t1 ORDER BY a;
# connection slave;
# SELECT * FROM t1 ORDER BY a;
# connection master;
# SELECT * FROM t2 ORDER BY a;
# connection slave;
# SELECT * FROM t2 ORDER BY a;
# connection master;
# SELECT * FROM t3 ORDER BY a;
# connection slave;
# SELECT * FROM t3 ORDER BY a;
# --source include/reset_master_and_slave.inc
#
# connection master;
#
# DROP TABLE t1;
# DROP TABLE t2;
# DROP TABLE t3;
#
# sync_slave_with_master;
#
# inc $y;
#}
#connection slave;
#SET GLOBAL sql_mode="";
#
#STOP SLAVE;
#source include/wait_for_slave_to_stop.inc;
#START SLAVE;
#--source include/wait_for_slave_to_start.inc
--echo ################################################################################
--echo # NULL ---> NOT NULL (NON-STRICT MODE)
--echo ################################################################################
connection master;
SET SQL_LOG_BIN= 0;
eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
connection slave;
eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT NOT NULL,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1;
--echo ************* EXECUTION WITH INSERTS *************
connection master;
INSERT INTO t1(a) VALUES (1);
INSERT INTO t1(a, b) VALUES (2, NULL);
INSERT INTO t1(a, b) VALUES (3, 1);
INSERT INTO t2(a) VALUES (1);
INSERT INTO t2(a, b) VALUES (2, NULL);
INSERT INTO t2(a, b) VALUES (3, 1);
INSERT INTO t3(a) VALUES (1);
INSERT INTO t3(a, b) VALUES (2, NULL);
INSERT INTO t3(a, b) VALUES (3, 1);
INSERT INTO t3(a, b) VALUES (4, 1);
REPLACE INTO t3(a, b) VALUES (5, null);
REPLACE INTO t3(a, b) VALUES (3, null);
UPDATE t3 SET b = NULL where a = 4;
--echo ************* SHOWING THE RESULT SETS *************
connection master;
sync_slave_with_master;
connection master;
SELECT * FROM t1 ORDER BY a;
connection slave;
SELECT * FROM t1 ORDER BY a;
connection master;
SELECT * FROM t2 ORDER BY a;
connection slave;
SELECT * FROM t2 ORDER BY a;
connection master;
SELECT * FROM t3 ORDER BY a;
connection slave;
SELECT * FROM t3 ORDER BY a;
connection master;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
sync_slave_with_master;
...@@ -111,21 +111,18 @@ SELECT a,b,x FROM t1_int ORDER BY a; ...@@ -111,21 +111,18 @@ 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,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a;
SELECT a,b,x FROM t1_char ORDER BY a; SELECT a,b,x FROM t1_char ORDER BY a;
# Each of these inserts should generate an error and stop the slave
connection master; connection master;
INSERT INTO t9 VALUES (2); INSERT INTO t9 VALUES (2);
sync_slave_with_master; sync_slave_with_master;
# Now slave is guaranteed to be running # Now slave is guaranteed to be running
connection master; connection master;
INSERT INTO t1_nodef VALUES (1,2); INSERT INTO t1_nodef VALUES (1,2);
connection slave;
--source include/wait_for_slave_sql_to_stop.inc # Last insert on wider slave table succeeds while slave sql sql_mode permits.
--replace_result $MASTER_MYPORT MASTER_PORT # The previous version of the above test expected slave sql to stop.
--replace_column 1 # 4 # 7 # 8 # 9 # 20 <Last_Error> 22 # 23 # 33 # 35 <Last_IO_Errno> 36 <Last_IO_Error> 38 <Last_SQL_Error> # bug#38173 relaxed conditions to stop only with the strict mode.
--query_vertical SHOW SLAVE STATUS sync_slave_with_master;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; select count(*) from t1_nodef;
START SLAVE;
# #
# Replicating to tables with fewer columns at the end works as of WL#3228 # Replicating to tables with fewer columns at the end works as of WL#3228
......
...@@ -404,7 +404,11 @@ STOP SLAVE; ...@@ -404,7 +404,11 @@ STOP SLAVE;
RESET SLAVE; RESET SLAVE;
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP, d TIMESTAMP,
e INT NOT NULL) ENGINE='InnoDB'; e INT NOT NULL,
f text not null,
g text,
h blob not null,
i blob) ENGINE='InnoDB';
*** Create t9 on Master *** *** Create t9 on Master ***
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE='InnoDB'; ) ENGINE='InnoDB';
...@@ -415,47 +419,11 @@ START SLAVE; ...@@ -415,47 +419,11 @@ START SLAVE;
set @b1 = 'b1b1b1b1'; set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1); set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SHOW SLAVE STATUS; select * from t9;
Slave_IO_State # a b c d e f g h i
Master_Host 127.0.0.1 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL
Master_User root 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL
Master_Port # 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
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 1364
Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
Skip_Counter 0
Exec_Master_Log_Pos #
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 1364
Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Create t10 on slave *** *** Create t10 on slave ***
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
...@@ -404,7 +404,11 @@ STOP SLAVE; ...@@ -404,7 +404,11 @@ STOP SLAVE;
RESET SLAVE; RESET SLAVE;
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP, d TIMESTAMP,
e INT NOT NULL) ENGINE='MyISAM'; e INT NOT NULL,
f text not null,
g text,
h blob not null,
i blob) ENGINE='MyISAM';
*** Create t9 on Master *** *** Create t9 on Master ***
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE='MyISAM'; ) ENGINE='MyISAM';
...@@ -415,47 +419,11 @@ START SLAVE; ...@@ -415,47 +419,11 @@ START SLAVE;
set @b1 = 'b1b1b1b1'; set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1); set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SHOW SLAVE STATUS; select * from t9;
Slave_IO_State # a b c d e f g h i
Master_Host 127.0.0.1 1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL
Master_User root 2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL
Master_Port # 3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
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 1364
Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
Skip_Counter 0
Exec_Master_Log_Pos #
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 1364
Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Create t10 on slave *** *** Create t10 on slave ***
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
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;
SET SQL_LOG_BIN= 0;
CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a,b,c) VALUES (1, null, 1);
INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, 4);
INSERT INTO t1(a) VALUES (5);
INSERT INTO t2(a,b) VALUES (1, null);
INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
INSERT INTO t2(a) VALUES (3);
INSERT INTO t3(a,b) VALUES (1, null);
INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
INSERT INTO t3(a) VALUES (3);
INSERT INTO t4(a,b,c) VALUES (1, null, 1);
INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t4(a,b) VALUES (3, null);
INSERT INTO t4(a,c) VALUES (4, 4);
INSERT INTO t4(a) VALUES (5);
************* SHOWING THE RESULT SETS WITH INSERTS *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.t2 and slave:test.t2
TABLES t2 and t3 must be different.
SELECT * FROM t3 ORDER BY a;
a b
1 NULL
2 1111-11-11
3 NULL
SELECT * FROM t3 ORDER BY a;
a b c
1 NULL 500
2 1111-11-11 500
3 NULL 500
SELECT * FROM t4 ORDER BY a;
a b c
1 NULL 1
2 1111-11-11 2
3 NULL NULL
4 NULL 4
5 NULL NULL
SELECT * FROM t4 ORDER BY a;
a b
1 NULL
2 1111-11-11
3 NULL
4 NULL
5 NULL
************* EXECUTION WITH UPDATES and REPLACES *************
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
UPDATE t1 set b= NULL, c= 300 where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
************* CLEANING *************
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
SET SQL_LOG_BIN= 0;
CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= Innodb;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= Innodb;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, b'01');
INSERT INTO t1(a) VALUES (5);
************* SHOWING THE RESULT SETS WITH INSERTS *************
TABLES t1 and t2 must be different.
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
a b+0 c+0
1 NULL 1
2 0 1
3 NULL NULL
4 NULL 1
5 NULL NULL
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
a b+0 c+0
1 NULL 1
2 0 1
3 NULL NULL
4 NULL 1
5 NULL NULL
************* EXECUTION WITH UPDATES and REPLACES *************
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
UPDATE t1 set b= NULL, c= b'00' where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
################################################################################
# NULL ---> NOT NULL (STRICT MODE)
# UNCOMMENT THIS AFTER FIXING BUG#43992
################################################################################
################################################################################
# NULL ---> NOT NULL (NON-STRICT MODE)
################################################################################
SET SQL_LOG_BIN= 0;
CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT NOT NULL,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a) VALUES (1);
INSERT INTO t1(a, b) VALUES (2, NULL);
INSERT INTO t1(a, b) VALUES (3, 1);
INSERT INTO t2(a) VALUES (1);
INSERT INTO t2(a, b) VALUES (2, NULL);
INSERT INTO t2(a, b) VALUES (3, 1);
INSERT INTO t3(a) VALUES (1);
INSERT INTO t3(a, b) VALUES (2, NULL);
INSERT INTO t3(a, b) VALUES (3, 1);
INSERT INTO t3(a, b) VALUES (4, 1);
REPLACE INTO t3(a, b) VALUES (5, null);
REPLACE INTO t3(a, b) VALUES (3, null);
UPDATE t3 SET b = NULL where a = 4;
************* SHOWING THE RESULT SETS *************
SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
3 1
SELECT * FROM t1 ORDER BY a;
a b c
1 0 0
2 0 0
3 1 0
SELECT * FROM t2 ORDER BY a;
a b
1 NULL
2 NULL
3 1
SELECT * FROM t2 ORDER BY a;
a b c
1 0 NULL
2 0 NULL
3 1 NULL
SELECT * FROM t3 ORDER BY a;
a b
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
SELECT * FROM t3 ORDER BY a;
a b c
1 0 500
2 0 500
3 0 500
4 0 500
5 0 500
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
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;
SET SQL_LOG_BIN= 0;
CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL,
`c` INT DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00',
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00',
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a,b,c) VALUES (1, null, 1);
INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, 4);
INSERT INTO t1(a) VALUES (5);
INSERT INTO t2(a,b) VALUES (1, null);
INSERT INTO t2(a,b) VALUES (2,'1111-11-11');
INSERT INTO t2(a) VALUES (3);
INSERT INTO t3(a,b) VALUES (1, null);
INSERT INTO t3(a,b) VALUES (2,'1111-11-11');
INSERT INTO t3(a) VALUES (3);
INSERT INTO t4(a,b,c) VALUES (1, null, 1);
INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2);
INSERT INTO t4(a,b) VALUES (3, null);
INSERT INTO t4(a,c) VALUES (4, 4);
INSERT INTO t4(a) VALUES (5);
************* SHOWING THE RESULT SETS WITH INSERTS *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
Comparing tables master:test.t2 and slave:test.t2
TABLES t2 and t3 must be different.
SELECT * FROM t3 ORDER BY a;
a b
1 NULL
2 1111-11-11
3 NULL
SELECT * FROM t3 ORDER BY a;
a b c
1 NULL 500
2 1111-11-11 500
3 NULL 500
SELECT * FROM t4 ORDER BY a;
a b c
1 NULL 1
2 1111-11-11 2
3 NULL NULL
4 NULL 4
5 NULL NULL
SELECT * FROM t4 ORDER BY a;
a b
1 NULL
2 1111-11-11
3 NULL
4 NULL
5 NULL
************* EXECUTION WITH UPDATES and REPLACES *************
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1);
REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2);
UPDATE t1 set b= NULL, c= 300 where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300);
************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
************* CLEANING *************
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
SET SQL_LOG_BIN= 0;
CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= MyISAM;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL,
PRIMARY KEY (`a`)) ENGINE= MyISAM;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a,b,c) VALUES (1, null, b'01');
INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01');
INSERT INTO t1(a,b) VALUES (3, null);
INSERT INTO t1(a,c) VALUES (4, b'01');
INSERT INTO t1(a) VALUES (5);
************* SHOWING THE RESULT SETS WITH INSERTS *************
TABLES t1 and t2 must be different.
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
a b+0 c+0
1 NULL 1
2 0 1
3 NULL NULL
4 NULL 1
5 NULL NULL
SELECT a,b+0,c+0 FROM t1 ORDER BY a;
a b+0 c+0
1 NULL 1
2 0 1
3 NULL NULL
4 NULL 1
5 NULL NULL
************* EXECUTION WITH UPDATES and REPLACES *************
DELETE FROM t1;
INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01');
REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01');
UPDATE t1 set b= NULL, c= b'00' where a= 1;
REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00');
************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES *************
TABLES t1 and t2 must be equal otherwise an error will be thrown.
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE t1;
################################################################################
# NULL ---> NOT NULL (STRICT MODE)
# UNCOMMENT THIS AFTER FIXING BUG#43992
################################################################################
################################################################################
# NULL ---> NOT NULL (NON-STRICT MODE)
################################################################################
SET SQL_LOG_BIN= 0;
CREATE TABLE t1(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT NOT NULL, `b` INT,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
SET SQL_LOG_BIN= 1;
CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT NOT NULL,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL,
`c` INT DEFAULT 500,
PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1;
************* EXECUTION WITH INSERTS *************
INSERT INTO t1(a) VALUES (1);
INSERT INTO t1(a, b) VALUES (2, NULL);
INSERT INTO t1(a, b) VALUES (3, 1);
INSERT INTO t2(a) VALUES (1);
INSERT INTO t2(a, b) VALUES (2, NULL);
INSERT INTO t2(a, b) VALUES (3, 1);
INSERT INTO t3(a) VALUES (1);
INSERT INTO t3(a, b) VALUES (2, NULL);
INSERT INTO t3(a, b) VALUES (3, 1);
INSERT INTO t3(a, b) VALUES (4, 1);
REPLACE INTO t3(a, b) VALUES (5, null);
REPLACE INTO t3(a, b) VALUES (3, null);
UPDATE t3 SET b = NULL where a = 4;
************* SHOWING THE RESULT SETS *************
SELECT * FROM t1 ORDER BY a;
a b
1 NULL
2 NULL
3 1
SELECT * FROM t1 ORDER BY a;
a b c
1 0 0
2 0 0
3 1 0
SELECT * FROM t2 ORDER BY a;
a b
1 NULL
2 NULL
3 1
SELECT * FROM t2 ORDER BY a;
a b c
1 0 NULL
2 0 NULL
3 1 NULL
SELECT * FROM t3 ORDER BY a;
a b
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
SELECT * FROM t3 ORDER BY a;
a b c
1 0 500
2 0 500
3 0 500
4 0 500
5 0 500
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
...@@ -105,47 +105,9 @@ a b x ...@@ -105,47 +105,9 @@ a b x
2 10 Foo is a bar 2 10 Foo is a bar
INSERT INTO t9 VALUES (2); INSERT INTO t9 VALUES (2);
INSERT INTO t1_nodef VALUES (1,2); INSERT INTO t1_nodef VALUES (1,2);
SHOW SLAVE STATUS; select count(*) from t1_nodef;
Slave_IO_State # count(*)
Master_Host 127.0.0.1 1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
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 1364
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
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_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1364
Last_SQL_Error <Last_SQL_Error>
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2); INSERT INTO t9 VALUES (2);
**** On Master **** **** On Master ****
INSERT INTO t2 VALUES (2,4); INSERT INTO t2 VALUES (2,4);
......
...@@ -105,47 +105,9 @@ a b x ...@@ -105,47 +105,9 @@ a b x
2 10 Foo is a bar 2 10 Foo is a bar
INSERT INTO t9 VALUES (2); INSERT INTO t9 VALUES (2);
INSERT INTO t1_nodef VALUES (1,2); INSERT INTO t1_nodef VALUES (1,2);
SHOW SLAVE STATUS; select count(*) from t1_nodef;
Slave_IO_State # count(*)
Master_Host 127.0.0.1 1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
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 1364
Last_Error <Last_Error>
Skip_Counter 0
Exec_Master_Log_Pos #
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_Errno>
Last_IO_Error <Last_IO_Error>
Last_SQL_Errno 1364
Last_SQL_Error <Last_SQL_Error>
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2); INSERT INTO t9 VALUES (2);
**** On Master **** **** On Master ****
INSERT INTO t2 VALUES (2,4); INSERT INTO t2 VALUES (2,4);
......
#################################################################################
# This test checks if the replication between "null" fields to either "null"
# fields or "not null" fields works properly. In the first case, the execution
# should work fine. In the second case, it may fail according to the sql_mode
# being used.
#
# The test is devided in three main parts:
#
# 1 - NULL --> NULL (no failures)
# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures)
# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
#
#################################################################################
--source include/master-slave.inc
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
let $engine=Innodb;
--source extra/rpl_tests/rpl_not_null.test
#################################################################################
# This test checks if the replication between "null" fields to either "null"
# fields or "not null" fields works properly. In the first case, the execution
# should work fine. In the second case, it may fail according to the sql_mode
# being used.
#
# The test is devided in three main parts:
#
# 1 - NULL --> NULL (no failures)
# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures)
# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures)
#
#################################################################################
--source include/master-slave.inc
--source include/have_binlog_format_row.inc
let $engine=MyISAM;
--source extra/rpl_tests/rpl_not_null.test
...@@ -400,62 +400,6 @@ set @b1 = concat(@b1,@b1); ...@@ -400,62 +400,6 @@ set @b1 = concat(@b1,@b1);
INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
*** Drop t8 *** *** Drop t8 ***
DROP TABLE t8; DROP TABLE t8;
STOP SLAVE;
RESET SLAVE;
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP,
e INT NOT NULL) ENGINE='NDB';
*** Create t9 on Master ***
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE='NDB';
RESET MASTER;
*** Start Slave ***
START SLAVE;
*** Master Data Insert ***
set @b1 = 'b1b1b1b1';
set @b1 = concat(@b1,@b1);
INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port #
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
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 1364
Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 447
Skip_Counter 0
Exec_Master_Log_Pos #
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 1364
Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 447
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Create t10 on slave *** *** Create t10 on slave ***
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
......
...@@ -8450,13 +8450,17 @@ Rows_log_event::write_row(const Relay_log_info *const rli, ...@@ -8450,13 +8450,17 @@ Rows_log_event::write_row(const Relay_log_info *const rli,
auto_afree_ptr<char> key(NULL); auto_afree_ptr<char> key(NULL);
/* fill table->record[0] with default values */ /* fill table->record[0] with default values */
bool abort_on_warnings= (rli->sql_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
if ((error= prepare_record(table, m_width, if ((error= prepare_record(table, m_width,
TRUE /* check if columns have def. values */))) table->file->ht->db_type != DB_TYPE_NDBCLUSTER,
abort_on_warnings, m_curr_row == m_rows_buf)))
DBUG_RETURN(error); DBUG_RETURN(error);
/* unpack row into table->record[0] */ /* unpack row into table->record[0] */
error= unpack_current_row(rli); // TODO: how to handle errors? if ((error= unpack_current_row(rli, abort_on_warnings)))
DBUG_RETURN(error);
if (m_curr_row == m_rows_buf) if (m_curr_row == m_rows_buf)
{ {
/* this is the first row to be inserted, we estimate the rows with /* this is the first row to be inserted, we estimate the rows with
...@@ -9253,8 +9257,12 @@ Update_rows_log_event::do_exec_row(const Relay_log_info *const rli) ...@@ -9253,8 +9257,12 @@ Update_rows_log_event::do_exec_row(const Relay_log_info *const rli)
store_record(m_table,record[1]); store_record(m_table,record[1]);
bool abort_on_warnings= (rli->sql_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES));
m_curr_row= m_curr_row_end; m_curr_row= m_curr_row_end;
error= unpack_current_row(rli); // this also updates m_curr_row_end /* this also updates m_curr_row_end */
if ((error= unpack_current_row(rli, abort_on_warnings)))
return error;
/* /*
Now we have the right row to update. The old row (the one we're Now we have the right row to update. The old row (the one we're
......
...@@ -3541,12 +3541,16 @@ protected: ...@@ -3541,12 +3541,16 @@ protected:
int write_row(const Relay_log_info *const, const bool); int write_row(const Relay_log_info *const, const bool);
// Unpack the current row into m_table->record[0] // Unpack the current row into m_table->record[0]
int unpack_current_row(const Relay_log_info *const rli) int unpack_current_row(const Relay_log_info *const rli,
const bool abort_on_warning= TRUE)
{ {
DBUG_ASSERT(m_table); DBUG_ASSERT(m_table);
bool first_row= (m_curr_row == m_rows_buf);
ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT); ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols, int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
&m_curr_row_end, &m_master_reclength); &m_curr_row_end, &m_master_reclength,
abort_on_warning, first_row);
if (m_curr_row_end > m_rows_end) if (m_curr_row_end > m_rows_end)
my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0)); my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0));
ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT); ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
......
...@@ -180,7 +180,8 @@ int ...@@ -180,7 +180,8 @@ int
unpack_row(Relay_log_info const *rli, unpack_row(Relay_log_info const *rli,
TABLE *table, uint const colcnt, TABLE *table, uint const colcnt,
uchar const *const row_data, MY_BITMAP const *cols, uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength) uchar const **const row_end, ulong *const master_reclength,
const bool abort_on_warning, const bool first_row)
{ {
DBUG_ENTER("unpack_row"); DBUG_ENTER("unpack_row");
DBUG_ASSERT(row_data); DBUG_ASSERT(row_data);
...@@ -224,8 +225,35 @@ unpack_row(Relay_log_info const *rli, ...@@ -224,8 +225,35 @@ unpack_row(Relay_log_info const *rli,
/* Field...::unpack() cannot return 0 */ /* Field...::unpack() cannot return 0 */
DBUG_ASSERT(pack_ptr != NULL); DBUG_ASSERT(pack_ptr != NULL);
if ((null_bits & null_mask) && f->maybe_null()) if (null_bits & null_mask)
f->set_null(); {
if (f->maybe_null())
{
DBUG_PRINT("debug", ("Was NULL; null mask: 0x%x; null bits: 0x%x",
null_mask, null_bits));
f->set_null();
}
else
{
MYSQL_ERROR::enum_warning_level error_type=
MYSQL_ERROR::WARN_LEVEL_NOTE;
if (abort_on_warning && (table->file->has_transactions() ||
first_row))
{
error = HA_ERR_ROWS_EVENT_APPLY;
error_type= MYSQL_ERROR::WARN_LEVEL_ERROR;
}
else
{
f->set_default();
error_type= MYSQL_ERROR::WARN_LEVEL_WARN;
}
push_warning_printf(current_thd, error_type,
ER_BAD_NULL_ERROR,
ER(ER_BAD_NULL_ERROR),
f->field_name);
}
}
else else
{ {
f->set_notnull(); f->set_notnull();
...@@ -305,13 +333,17 @@ unpack_row(Relay_log_info const *rli, ...@@ -305,13 +333,17 @@ unpack_row(Relay_log_info const *rli,
@param table Table whose record[0] buffer is prepared. @param table Table whose record[0] buffer is prepared.
@param skip Number of columns for which default/nullable check @param skip Number of columns for which default/nullable check
should be skipped. should be skipped.
@param check Indicates if errors should be raised when checking @param check Specifies if lack of default error needs checking.
default/nullable field properties. @param abort_on_warning
Controls how to react on lack of a field's default.
The parameter mimics the master side one for
@c check_that_all_fields_are_given_values.
@returns 0 on success or a handler level error code @returns 0 on success or a handler level error code
*/ */
int prepare_record(TABLE *const table, int prepare_record(TABLE *const table,
const uint skip, const bool check) const uint skip, const bool check,
const bool abort_on_warning, const bool first_row)
{ {
DBUG_ENTER("prepare_record"); DBUG_ENTER("prepare_record");
...@@ -326,17 +358,37 @@ int prepare_record(TABLE *const table, ...@@ -326,17 +358,37 @@ int prepare_record(TABLE *const table,
if (skip >= table->s->fields || !check) if (skip >= table->s->fields || !check)
DBUG_RETURN(0); DBUG_RETURN(0);
/* Checking if exists default/nullable fields in the default values. */ /*
For fields the extra fields on the slave, we check if they have a default.
for (Field **field_ptr= table->field+skip ; *field_ptr ; ++field_ptr) The check follows the same rules as the INSERT query without specifying an
explicit value for a field not having the explicit default
(@c check_that_all_fields_are_given_values()).
*/
for (Field **field_ptr= table->field+skip; *field_ptr; ++field_ptr)
{ {
uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG; uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG;
Field *const f= *field_ptr; Field *const f= *field_ptr;
if ((f->flags & NO_DEFAULT_VALUE_FLAG) &&
if (((f->flags & mask) == mask)) (f->real_type() != MYSQL_TYPE_ENUM))
{ {
my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), f->field_name);
error = HA_ERR_ROWS_EVENT_APPLY; MYSQL_ERROR::enum_warning_level error_type=
MYSQL_ERROR::WARN_LEVEL_NOTE;
if (abort_on_warning && (table->file->has_transactions() ||
first_row))
{
error= HA_ERR_ROWS_EVENT_APPLY;
error_type= MYSQL_ERROR::WARN_LEVEL_ERROR;
}
else
{
f->set_default();
error_type= MYSQL_ERROR::WARN_LEVEL_WARN;
}
push_warning_printf(current_thd, error_type,
ER_NO_DEFAULT_FOR_FIELD,
ER(ER_NO_DEFAULT_FOR_FIELD),
f->field_name);
} }
} }
......
...@@ -27,10 +27,13 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols, ...@@ -27,10 +27,13 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols,
int unpack_row(Relay_log_info const *rli, int unpack_row(Relay_log_info const *rli,
TABLE *table, uint const colcnt, TABLE *table, uint const colcnt,
uchar const *const row_data, MY_BITMAP const *cols, uchar const *const row_data, MY_BITMAP const *cols,
uchar const **const row_end, ulong *const master_reclength); uchar const **const row_end, ulong *const master_reclength,
const bool abort_on_warning= TRUE, const bool first_row= TRUE);
// Fill table's record[0] with default values. // Fill table's record[0] with default values.
int prepare_record(TABLE *const, const uint =0, const bool =FALSE); int prepare_record(TABLE *const table, const uint skip, const bool check,
const bool abort_on_warning= TRUE,
const bool first_row= TRUE);
#endif #endif
#endif #endif
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