Commit 37486843 authored by msvensson@pilot.mysql.com's avatar msvensson@pilot.mysql.com

Merge bk-internal:/home/bk/mysql-5.1-rpl

into  pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-rpl
parents 78392fbc f48aa05f
...@@ -282,6 +282,7 @@ typedef struct charset_info_st ...@@ -282,6 +282,7 @@ typedef struct charset_info_st
MY_COLLATION_HANDLER *coll; MY_COLLATION_HANDLER *coll;
} CHARSET_INFO; } CHARSET_INFO;
#define ILLEGAL_CHARSET_INFO_NUMBER (~0U)
extern CHARSET_INFO my_charset_bin; extern CHARSET_INFO my_charset_bin;
......
...@@ -403,45 +403,38 @@ sync_slave_with_master; ...@@ -403,45 +403,38 @@ sync_slave_with_master;
# added columns do not have default values# # added columns do not have default values#
# Expect: Proper error message # # Expect: Proper error message #
########################################### ###########################################
# Commented out due to 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.
######################################################## ########################################################
#--echo *** Create t9 on slave *** #--echo *** Create t9 on slave ***
#STOP SLAVE; STOP SLAVE;
#RESET SLAVE; RESET SLAVE;
#eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
# d TIMESTAMP, d TIMESTAMP,
# e INT DEFAULT '1')ENGINE=$engine_type; e INT NOT NULL) 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;
#RESET MASTER;
#--echo *** Start Slave *** --echo *** Create t9 on Master ***
#connection slave; connection master;
#START SLAVE; eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE=$engine_type;
RESET MASTER;
#--echo *** Master Data Insert *** --echo *** Start Slave ***
#connection master; connection slave;
#set @b1 = 'b1b1b1b1'; START SLAVE;
#set @b1 = concat(@b1,@b1);
#INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
#--echo ************************************************* --echo *** Master Data Insert ***
#--echo ** Currently giving wrong error see bug#22234 *** connection master;
#--echo ************************************************* set @b1 = 'b1b1b1b1';
#sync_slave_with_master; set @b1 = concat(@b1,@b1);
#connection slave; INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
#--echo *** Select from T9 *** --source include/wait_for_slave_sql_to_stop.inc
#--source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT
#--replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 #
#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS
#--query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE;
#START SLAVE;
#--echo *** Drop t9 *** #--echo *** Drop t9 ***
#connection master; #connection master;
......
...@@ -39,13 +39,6 @@ sync_with_master; ...@@ -39,13 +39,6 @@ sync_with_master;
select * from t1; select * from t1;
select * from t3; select * from t3;
# We want to be sure that LOAD DATA is in the slave's binlog.
# But we can't simply read this binlog, because as the slave has not been
# restarted for this test, the file_id is uncertain (would cause test
# failures). So instead, we test if the binlog looks long enough to
# contain LOAD DATA. Since 5.0.3 we assume that binlog of 1292 is ok.
# If LOAD DATA was not logged, the binlog would be shorter.
show master status;
connection master; connection master;
......
...@@ -148,5 +148,5 @@ drop table t1; ...@@ -148,5 +148,5 @@ drop table t1;
# End of 4.1 tests # End of 4.1 tests
sync_with_master; sync_slave_with_master;
...@@ -341,6 +341,14 @@ drop function if exists f1; ...@@ -341,6 +341,14 @@ drop function if exists f1;
drop procedure if exists p_verify_status_increment; drop procedure if exists p_verify_status_increment;
--enable_warnings --enable_warnings
# Save binlog_format in a user variable. References to system
# variables are "unsafe", meaning they are written as rows instead of
# as statements to the binlog, if the loggging mode is 'mixed'. But
# we don't want p_verify_status_increment to affect the logging mode.
# Hence, we save binlog_format in a user variable (which is not
# unsafe) and use that inside p_verify_status_increment.
set @binlog_format=@@global.binlog_format;
set sql_mode=no_engine_substitution; set sql_mode=no_engine_substitution;
create table t1 (a int unique); create table t1 (a int unique);
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
...@@ -367,7 +375,7 @@ begin ...@@ -367,7 +375,7 @@ begin
where variable_name='Handler_commit' or variable_name='Handler_prepare' where variable_name='Handler_commit' or variable_name='Handler_prepare'
order by variable_name; order by variable_name;
if @@global.binlog_format = 'ROW' then if @binlog_format = 'ROW' then
set commit_inc= commit_inc_row; set commit_inc= commit_inc_row;
set prepare_inc= prepare_inc_row; set prepare_inc= prepare_inc_row;
else else
......
# ==== Purpose ====
#
# Check if the two given tables (possibly residing on different
# master/slave servers) are equal.
#
# ==== Usage ====
#
# The tables to check are given by the test language variables
# $diff_table_1 and $diff_table_2. They must be of the
# following form:
#
# [master:|slave:]database.table
#
# I.e., both database and table must be speicified. Optionally, you
# can prefix the name with 'master:' (to read the table on master) or
# with 'slave:' (to read the table on slave). If no prefix is given,
# reads the table from the current connection. If one of these
# variables has a prefix, both should have a prefix.
#
# ==== Side effects ====
#
# - Prints "Comparing tables $diff_table_1 and $diff_tables_2".
#
# - If the tables are different, prints the difference in a
# system-specific format (unified diff if supported) and generates
# an error.
#
# - If $diff_table_1 or $diff_table_2 begins with 'master:' or
# 'slave:', it will stay connected to one of those hosts after
# execution. The host is only guaranteed to remain unchanged if
# none of $diff_table_1 or $diff_table_2 begins with 'master:' or
# 'slave:'.
#
# ==== Bugs ====
#
# - It is currently not possible to use this for tables that are
# supposed to be different, because if the files are different:
# - 'diff' produces system-dependent output,
# - the output includes the absolute path of the compared files,
# - the output includes a timestamp.
# To fix that, we'd probably have to use SQL to compute the
# symmetric difference between the tables. I'm not sure how to do
# that efficiently. If we implement this, it would be nice to
# compare the table definitions too.
#
# - It actually compares the result of "SELECT * FROM table ORDER BY
# col1, col2, ..., colN INTO OUTFILE 'file'". Hence, it is assumed
# that the comparison orders for both tables are equal and that two
# rows that are equal in the comparison order cannot differ, e.g.,
# by character case.
# ==== Save both tables to file ====
--echo Comparing tables $diff_table_1 and $diff_table_2
disable_query_log;
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
--error 0,1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
let $_diff_table=$diff_table_2;
let $_diff_i=2;
while ($_diff_i) {
# Parse out any leading "master:" or "slave:" from the table
# specification and connect the appropriate server.
let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`;
if ($_diff_conn_master) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`;
connection master;
}
let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`;
if ($_diff_conn_slave) {
let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`;
connection slave;
}
# Sanity-check the input.
let $_diff_error= `SELECT '$_diff_table' NOT LIKE '_%._%'`;
if ($_diff_error) {
--echo !!!ERROR IN TEST: \$diff_table_$_diff_i='$_diff_table' is not in the form database.table
exit;
}
# We need the output files to be sorted (so that diff_files does not
# think the files are different just because they are differently
# ordered). To this end, we first generate a query that sorts the
# table by all columns. Since ORDER BY accept column indices, we
# just generate a comma-separated list of all numbers from 1 to the
# number of columns in the table.
let $_diff_column_index=`SELECT MAX(ordinal_position)
FROM information_schema.columns
WHERE CONCAT(table_schema, '.', table_name) =
'$_diff_table'`;
let $_diff_column_list=$_diff_column_index;
dec $_diff_column_index;
while ($_diff_column_index) {
let $_diff_column_list=$_diff_column_index, $_diff_column_list;
dec $_diff_column_index;
}
# Now that we have the comma-separated list of columns, we can write
# the table to a file.
eval SELECT * FROM $_diff_table ORDER BY $_diff_column_list
INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/diff_table_$_diff_i';
# Do the same for $diff_table_1.
dec $_diff_i;
let $_diff_table=$diff_table_1;
}
# ==== Compare the generated files ====
diff_files $MYSQLTEST_VARDIR/tmp/diff_table_1 $MYSQLTEST_VARDIR/tmp/diff_table_2;
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_1
--remove_file $MYSQLTEST_VARDIR/tmp/diff_table_2
enable_query_log;
...@@ -331,6 +331,7 @@ drop table if exists t1; ...@@ -331,6 +331,7 @@ drop table if exists t1;
drop table if exists t2; drop table if exists t2;
drop function if exists f1; drop function if exists f1;
drop procedure if exists p_verify_status_increment; drop procedure if exists p_verify_status_increment;
set @binlog_format=@@global.binlog_format;
set sql_mode=no_engine_substitution; set sql_mode=no_engine_substitution;
create table t1 (a int unique); create table t1 (a int unique);
create table t2 (a int) engine=myisam; create table t2 (a int) engine=myisam;
...@@ -355,7 +356,7 @@ select variable_value ...@@ -355,7 +356,7 @@ select variable_value
from information_schema.session_status from information_schema.session_status
where variable_name='Handler_commit' or variable_name='Handler_prepare' where variable_name='Handler_commit' or variable_name='Handler_prepare'
order by variable_name; order by variable_name;
if @@global.binlog_format = 'ROW' then if @binlog_format = 'ROW' then
set commit_inc= commit_inc_row; set commit_inc= commit_inc_row;
set prepare_inc= prepare_inc_row; set prepare_inc= prepare_inc_row;
else else
......
...@@ -19,10 +19,14 @@ DELIMITER /*!*/; ...@@ -19,10 +19,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
drop table if exists t1,t2,t3,t4,t5,t03,t04 drop table if exists t1,t2,t3,t4,t5,t03,t04
/*!*/; /*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
...@@ -61,10 +65,14 @@ ROLLBACK /* added by mysqlbinlog */; ...@@ -61,10 +65,14 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
insert into t1 values ("Alas") insert into t1 values ("Alas")
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
...@@ -89,10 +97,14 @@ ROLLBACK /* added by mysqlbinlog */; ...@@ -89,10 +97,14 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
insert into t1 values ("Alas") insert into t1 values ("Alas")
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
...@@ -107,10 +119,14 @@ DELIMITER /*!*/; ...@@ -107,10 +119,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
drop table if exists t1,t2,t3,t4,t5,t03,t04 drop table if exists t1,t2,t3,t4,t5,t03,t04
/*!*/; /*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
...@@ -149,10 +165,14 @@ ROLLBACK /* added by mysqlbinlog */; ...@@ -149,10 +165,14 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
insert into t1 values ("Alas") insert into t1 values ("Alas")
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
...@@ -177,10 +197,14 @@ ROLLBACK /* added by mysqlbinlog */; ...@@ -177,10 +197,14 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
insert into t1 values ("Alas") insert into t1 values ("Alas")
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
...@@ -195,6 +219,10 @@ DELIMITER /*!*/; ...@@ -195,6 +219,10 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1108844556/*!*/; SET TIMESTAMP=1108844556/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN BEGIN
/*!*/; /*!*/;
SET TIMESTAMP=1108844555/*!*/; SET TIMESTAMP=1108844555/*!*/;
...@@ -209,6 +237,10 @@ ROLLBACK /* added by mysqlbinlog */; ...@@ -209,6 +237,10 @@ ROLLBACK /* added by mysqlbinlog */;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1108844556/*!*/; SET TIMESTAMP=1108844556/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN BEGIN
/*!*/; /*!*/;
SET TIMESTAMP=1108844555/*!*/; SET TIMESTAMP=1108844555/*!*/;
...@@ -265,10 +297,14 @@ ERROR 42000: PROCEDURE test.p1 does not exist ...@@ -265,10 +297,14 @@ ERROR 42000: PROCEDURE test.p1 does not exist
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE DEFINER=`root`@`localhost` procedure p1() CREATE DEFINER=`root`@`localhost` procedure p1()
begin begin
select 1; select 1;
...@@ -311,10 +347,14 @@ flush logs; ...@@ -311,10 +347,14 @@ flush logs;
DELIMITER /*!*/; DELIMITER /*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create table t1 (a varchar(64) character set utf8) create table t1 (a varchar(64) character set utf8)
/*!*/; /*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
......
This diff is collapsed.
...@@ -21,10 +21,14 @@ ROLLBACK/*!*/; ...@@ -21,10 +21,14 @@ ROLLBACK/*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/; SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=10000/*!*/; SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
INSERT INTO t1 VALUES(@`a b`) INSERT INTO t1 VALUES(@`a b`)
/*!*/; /*!*/;
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/; SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
......
...@@ -32,14 +32,17 @@ a ...@@ -32,14 +32,17 @@ a
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/; DELIMITER /*!*/;
# at 4 # at 4
#ROLLBACK/*!*/; <#>ROLLBACK/*!*/;
# at 102 # at 102
#use test/*!*/; <#>use test/*!*/;
SET TIMESTAMP=1196959712/*!*/; SET TIMESTAMP=1196959712/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; <#>SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
create table t1 (a int) engine= myisam create table t1 (a int) engine= myisam
/*!*/; /*!*/;
# at 203 # at 203
......
...@@ -15,10 +15,14 @@ ROLLBACK/*!*/; ...@@ -15,10 +15,14 @@ ROLLBACK/*!*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/; SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=10000/*!*/; SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
insert into t2 values (@v) insert into t2 values (@v)
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
......
SET BINLOG_FORMAT=STATEMENT; ==== Setup tables ====
CREATE TABLE t1 (a CHAR(40)); CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (a CHAR(40));
CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3; CREATE TABLE trigger_table (a CHAR(7));
INSERT INTO t1 SELECT UUID(); CREATE TABLE trigger_table2 (a INT);
Warnings: ==== Non-deterministic statements ====
Warning 1592 Statement is not safe to log in statement format. INSERT DELAYED INTO t1 VALUES (5);
SHOW WARNINGS; ==== Some variables that *should* be unsafe ====
Level Warning ---- Insert directly ----
Code 1592 INSERT INTO t1 VALUES (@@global.sync_binlog);
Message Statement is not safe to log in statement format. Warnings:
DROP TABLE t1,t2,t3; Warning 1592 Statement is not safe to log in statement format.
DROP VIEW v1; INSERT INTO t1 VALUES (@@session.insert_id);
Warnings:
Warning 1592 Statement is not safe to log in statement format.
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
Warnings:
Warning 1592 Statement is not safe to log in statement format.
INSERT INTO t2 SELECT UUID();
Warnings:
Warning 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@session.sql_mode);
Warnings:
Warning 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@global.init_slave);
Warnings:
Warning 1592 Statement is not safe to log in statement format.
INSERT INTO t2 VALUES (@@hostname);
Warnings:
Warning 1592 Statement is not safe to log in statement format.
---- Insert from stored procedure ----
CREATE PROCEDURE proc()
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
CALL proc();
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
---- Insert from stored function ----
CREATE FUNCTION func()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
RETURN 0;
END|
SELECT func();
func()
0
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
---- Insert from trigger ----
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
INSERT INTO trigger_table VALUES ('bye.');
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
---- Insert from prepared statement ----
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
EXECUTE p1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p2;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p3;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p4;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p5;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p6;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
EXECUTE p7;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
---- Insert from nested call of triggers / functions / procedures ----
CREATE PROCEDURE proc1()
INSERT INTO trigger_table VALUES ('ha!')|
CREATE FUNCTION func2()
RETURNS INT
BEGIN
CALL proc1();
RETURN 0;
END|
CREATE TRIGGER trig3
BEFORE INSERT ON trigger_table2
FOR EACH ROW
BEGIN
DECLARE tmp INT;
SELECT func2() INTO tmp;
END|
CREATE PROCEDURE proc4()
INSERT INTO trigger_table2 VALUES (1)|
CREATE FUNCTION func5()
RETURNS INT
BEGIN
CALL proc4;
RETURN 0;
END|
PREPARE prep6 FROM 'SELECT func5()'|
EXECUTE prep6;
func5()
0
Warnings:
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
Warning 1592 Statement is not safe to log in statement format.
==== Variables that should *not* be unsafe ====
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.unique_checks);
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
INSERT INTO t2 VALUES (@@session.character_set_client);
INSERT INTO t2 VALUES (@@session.collation_connection);
INSERT INTO t2 VALUES (@@session.collation_server);
INSERT INTO t2 VALUES (@@session.time_zone);
INSERT INTO t2 VALUES (@@session.lc_time_names);
INSERT INTO t2 VALUES (@@session.collation_database);
INSERT INTO t2 VALUES (@@session.timestamp);
INSERT INTO t2 VALUES (@@session.last_insert_id);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
SET insert_id=12;
INSERT INTO t3 VALUES (NULL);
==== Clean up ====
DROP PROCEDURE proc;
DROP FUNCTION func;
DROP TRIGGER trig;
DROP PROCEDURE proc1;
DROP FUNCTION func2;
DROP TRIGGER trig3;
DROP PROCEDURE proc4;
DROP FUNCTION func5;
DROP PREPARE prep6;
DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
...@@ -70,7 +70,7 @@ select * from t1; ...@@ -70,7 +70,7 @@ select * from t1;
--echo ==== Test --base64-output=never on a binlog with row events ==== --echo ==== Test --base64-output=never on a binlog with row events ====
# mysqlbinlog should fail # mysqlbinlog should fail
--replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/#/ --replace_regex /#[0-9][0-9][0-9][0-9][0-9][0-9] .*/<#>/ /SET \@\@session.pseudo_thread_id.*/<#>/
error 1; error 1;
exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001; exec $MYSQL_BINLOG --base64-output=never suite/binlog/std_data/bug32407.001;
# the above line should output the query log event and then stop # the above line should output the query log event and then stop
......
# Test to check that a warning is generated for unsafe statements # ==== Purpose ====
# executed under statement mode logging. #
# Some statements can not be written to the binlog in a safe manner
# with statement-based replication, either because they rely on
# features that are local to the server they are replicated from
# (e.g., @@variables), or because they include nondeterministic
# queries (e.g., LIMIT), or because the time at which the query is
# executed cannot be determined (e.g., INSERT DELAYED). Such
# statements should be marked unsafe. All unsafe statements should
# give a warning.
#
# This test verifies that a warning is generated for statements that
# should be unsafe, when they are executed under statement mode
# logging.
#
# All variables should be unsafe, with some exceptions. Therefore,
# this test also verifies that the exceptions do *not* generare a
# warning.
#
#
# ==== Method ====
#
# We try an INSERT DELAYED statement and verify that a warning is
# issued.
#
# We try to insert unsafe variables into a table in several ways:
# directly with an INSERT statement, from a stored procedure, from a
# stored function, from a trigger, from a prepared statement, and from
# a complicated nesting of triggers, functions, procedures, and
# prepared statements. In all cases, a warning should be issued.
#
# We try to insert the variables that should not be unsafe into a
# table, and verify that *no* warning is issued.
#
#
# ==== Related bugs and worklogs ====
#
# WL#3339: Issue warnings when statement-based replication may fail
# BUG#31168: @@hostname does not replicate
# BUG#34732: mysqlbinlog does not print default values for auto_increment variables
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
#
#
# ==== Related test cases ====
#
# rpl.rpl_variables verifies that variables which cannot be replicated
# safely in statement mode are replicated correctly in mixed or row
# mode.
#
# rpl.rpl_variables_stm tests the small subset of variables that
# actually can be replicated safely in statement mode.
#
#
# ==== Todo ====
#
# There are several other ways to create unsafe statements: see, e.g.,
# WL#3339, BUG#34768.
source include/have_log_bin.inc; source include/have_log_bin.inc;
source include/have_binlog_format_statement.inc;
SET BINLOG_FORMAT=STATEMENT; --echo ==== Setup tables ====
CREATE TABLE t1 (a CHAR(40)); CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t2 (a CHAR(40));
CREATE TABLE t3 (b INT AUTO_INCREMENT PRIMARY KEY); CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
CREATE VIEW v1(a,b) AS SELECT a,b FROM t2,t3; CREATE TABLE trigger_table (a CHAR(7));
CREATE TABLE trigger_table2 (a INT);
INSERT INTO t1 SELECT UUID();
query_vertical SHOW WARNINGS;
DROP TABLE t1,t2,t3; --echo ==== Non-deterministic statements ====
DROP VIEW v1;
INSERT DELAYED INTO t1 VALUES (5);
--echo ==== Some variables that *should* be unsafe ====
--echo ---- Insert directly ----
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
--echo ---- Insert from stored procedure ----
DELIMITER |;
CREATE PROCEDURE proc()
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
DELIMITER ;|
CALL proc();
--echo ---- Insert from stored function ----
DELIMITER |;
CREATE FUNCTION func()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
RETURN 0;
END|
DELIMITER ;|
SELECT func();
--echo ---- Insert from trigger ----
DELIMITER |;
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
DELIMITER ;|
INSERT INTO trigger_table VALUES ('bye.');
--echo ---- Insert from prepared statement ----
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5;
EXECUTE p6; EXECUTE p7;
--echo ---- Insert from nested call of triggers / functions / procedures ----
DELIMITER |;
# proc1: cause trigger 'trig' above to be triggered.
CREATE PROCEDURE proc1()
INSERT INTO trigger_table VALUES ('ha!')|
# func2: call proc1 above.
CREATE FUNCTION func2()
RETURNS INT
BEGIN
CALL proc1();
RETURN 0;
END|
# trig3: call func2 above
CREATE TRIGGER trig3
BEFORE INSERT ON trigger_table2
FOR EACH ROW
BEGIN
DECLARE tmp INT;
SELECT func2() INTO tmp;
END|
# proc4: cause trig3 above to be triggered.
CREATE PROCEDURE proc4()
INSERT INTO trigger_table2 VALUES (1)|
# func5: call proc4 above.
CREATE FUNCTION func5()
RETURNS INT
BEGIN
CALL proc4;
RETURN 0;
END|
# prep6: call func5() above.
PREPARE prep6 FROM 'SELECT func5()'|
DELIMITER ;|
# try a complicated call path to trigger 'trig'.
EXECUTE prep6;
--echo ==== Variables that should *not* be unsafe ====
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.unique_checks);
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
INSERT INTO t2 VALUES (@@session.character_set_client);
INSERT INTO t2 VALUES (@@session.collation_connection);
INSERT INTO t2 VALUES (@@session.collation_server);
INSERT INTO t2 VALUES (@@session.time_zone);
INSERT INTO t2 VALUES (@@session.lc_time_names);
INSERT INTO t2 VALUES (@@session.collation_database);
INSERT INTO t2 VALUES (@@session.timestamp);
INSERT INTO t2 VALUES (@@session.last_insert_id);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
# using insert_id implicitly should be ok.
SET insert_id=12;
INSERT INTO t3 VALUES (NULL);
--echo ==== Clean up ====
DROP PROCEDURE proc;
DROP FUNCTION func;
DROP TRIGGER trig;
DROP PROCEDURE proc1;
DROP FUNCTION func2;
DROP TRIGGER trig3;
DROP PROCEDURE proc4;
DROP FUNCTION func5;
DROP PREPARE prep6;
DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
...@@ -399,6 +399,62 @@ set @b1 = concat(@b1,@b1); ...@@ -399,6 +399,62 @@ 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='InnoDB';
*** Create t9 on Master ***
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE='InnoDB';
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 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;
......
...@@ -399,6 +399,62 @@ set @b1 = concat(@b1,@b1); ...@@ -399,6 +399,62 @@ 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='MyISAM';
*** Create t9 on Master ***
CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
) ENGINE='MyISAM';
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 262
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 262
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;
......
...@@ -26,9 +26,6 @@ day id category name ...@@ -26,9 +26,6 @@ day id category name
2003-02-22 2461 b a a a @ %  ' " a 2003-02-22 2461 b a a a @ %  ' " a
2003-03-22 2161 c asdf 2003-03-22 2161 c asdf
2003-03-22 2416 a bbbbb 2003-03-22 2416 a bbbbb
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
slave-bin.000001 1280
drop table t1; drop table t1;
drop table t2; drop table t2;
drop table t3; drop table t3;
......
...@@ -16,3 +16,9 @@ select master_pos_wait('master-bin.999999',0); ...@@ -16,3 +16,9 @@ select master_pos_wait('master-bin.999999',0);
stop slave sql_thread; stop slave sql_thread;
master_pos_wait('master-bin.999999',0) master_pos_wait('master-bin.999999',0)
NULL NULL
"*** must be empty ***"
show slave status;
"*** must be NULL ***"
select master_pos_wait('foo', 98);
master_pos_wait('foo', 98)
NULL
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;
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_host';
VARIABLE_NAME VARIABLE_VALUE
REPORT_HOST 127.0.0.1
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_port';
VARIABLE_NAME VARIABLE_VALUE
REPORT_PORT 9308
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_user';
VARIABLE_NAME VARIABLE_VALUE
REPORT_USER my_user
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_password';
VARIABLE_NAME VARIABLE_VALUE
REPORT_PASSWORD my_password
show global variables like 'report_host';
Variable_name report_host
Value 127.0.0.1
show global variables like 'report_port';
Variable_name report_port
Value 9308
show global variables like 'report_user';
Variable_name report_user
Value my_user
show global variables like 'report_password';
Variable_name report_password
Value my_password
set @@global.report_host='my.new.address.net';
ERROR HY000: Variable 'report_host' is a read only variable
end of tests
...@@ -158,10 +158,14 @@ DELIMITER /*!*/; ...@@ -158,10 +158,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
...@@ -176,10 +180,14 @@ DELIMITER /*!*/; ...@@ -176,10 +180,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
DROP TABLE IF EXISTS t1,t2,t3 DROP TABLE IF EXISTS t1,t2,t3
/*!*/; /*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
...@@ -281,10 +289,14 @@ DELIMITER /*!*/; ...@@ -281,10 +289,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
DROP TABLE IF EXISTS t1,t2,t3 DROP TABLE IF EXISTS t1,t2,t3
/*!*/; /*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
...@@ -308,10 +320,14 @@ DELIMITER /*!*/; ...@@ -308,10 +320,14 @@ DELIMITER /*!*/;
ROLLBACK/*!*/; ROLLBACK/*!*/;
use test/*!*/; use test/*!*/;
SET TIMESTAMP=1000000000/*!*/; SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/; SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1/*!*/;
SET @@session.sql_mode=0/*!*/; SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/; /*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/; SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT) CREATE TABLE t3(c1 INT NOT NULL PRIMARY KEY, c2 LONGBLOB, c3 TIMESTAMP, c4 TEXT, c5 FLOAT)
/*!*/; /*!*/;
DELIMITER ; DELIMITER ;
......
...@@ -4,31 +4,89 @@ reset master; ...@@ -4,31 +4,89 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
==== Test Without sql_mode=strict_trans_tables ====
[on master]
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
[on slave]
insert into t1 values (1); insert into t1 values (1);
[on master]
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2),(3); insert into t1 values (2),(3);
select * from t1 ORDER BY n; [on slave]
select * from t1 order by n;
n n
1 1
2 2
3 3
==== Test With sql_mode=strict_trans_tables ====
insert into t1 values (7),(8);
[on master]
set sql_mode=strict_trans_tables;
insert into t1 values (7), (8), (9);
[on slave]
select * from t1 order by n;
n
1
2
3
7
8
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_PORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running Yes
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table #
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
==== Clean Up ====
drop table t1; drop table t1;
create table t1(a int primary key); create table t1(a int primary key);
insert into t1 values (1),(2); insert into t1 values (1),(2);
delete from t1 where @@server_id=1; delete from t1 where @@server_id=1;
Warnings:
Warning 1592 Statement is not safe to log in statement format.
set sql_mode=strict_trans_tables; set sql_mode=strict_trans_tables;
select @@server_id; insert into t1 values (7), (8), (9);
@@server_id [on slave]
1
insert into t1 values (1),(2),(3);
select @@server_id;
@@server_id
2
select * from t1; select * from t1;
a a
1 1
2 2
7
8
9
SHOW SLAVE STATUS; SHOW SLAVE STATUS;
Slave_IO_State # Slave_IO_State #
Master_Host 127.0.0.1 Master_Host 127.0.0.1
...@@ -68,4 +126,5 @@ Last_IO_Errno # ...@@ -68,4 +126,5 @@ Last_IO_Errno #
Last_IO_Error # Last_IO_Error #
Last_SQL_Errno 0 Last_SQL_Errno 0
Last_SQL_Error Last_SQL_Error
==== Clean Up ====
drop table t1; drop table t1;
This diff is collapsed.
This diff is collapsed.
...@@ -15,4 +15,15 @@ stop slave sql_thread; ...@@ -15,4 +15,15 @@ stop slave sql_thread;
connection slave; connection slave;
reap; reap;
#
# bug#26622 MASTER_POS_WAIT does not work as documented
#
connection master;
echo "*** must be empty ***";
query_vertical show slave status;
echo "*** must be NULL ***";
select master_pos_wait('foo', 98);
# End of 4.1 tests # End of 4.1 tests
--report-host=127.0.0.1 --report-user='my_user' --report-password='my_password' --report-port=9308
# Verify that mysqld init time --report-{host,port,user,password} parameters
# are SHOW-able and SELECT-able FROM INFORMATION_SCHEMA.global_variables
source include/master-slave.inc;
connection slave;
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_host';
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_port';
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_user';
select * from Information_schema.GLOBAL_VARIABLES where variable_name like 'report_password';
query_vertical show global variables like 'report_host';
query_vertical show global variables like 'report_port';
query_vertical show global variables like 'report_user';
query_vertical show global variables like 'report_password';
# to demonstrate that report global variables are read-only
error ER_INCORRECT_GLOBAL_LOCAL_VAR;
set @@global.report_host='my.new.address.net';
--echo end of tests
########################################## # ==== Purpose ====
# 2006-02-07 By JBM: Added order by #
######################################### # Verify that --slave-skip-errors works correctly. The error messages
# Note that errors are ignored by opt file. # specified by --slave-skip-errors on slave should be ignored. If
source include/master-slave.inc; # such errors occur, they should not be reported and not cause the
source include/have_binlog_format_mixed_or_statement.inc; # slave to stop.
#
# ==== Method ====
# #
# Bug #30594 # We run the slave with --slave-skip-errors=1062 (the code for
# Skipping error due to applying Row-based repliation events # duplicate key). On slave, we insert value 1 in a table, and then,
# should be checked with another test file # on master, we insert value 1 in the table. The error should be
# consider names like rpl_row_skip_error # ignored on slave.
# #
# ==== Related bugs ====
#
# BUG#28839: Errors in strict mode silently stop SQL thread if --slave-skip-errors exists
# bug in this test: BUG#30594: rpl.rpl_skip_error is nondeterministic
source include/master-slave.inc;
source include/have_binlog_format_statement.inc;
--echo ==== Test Without sql_mode=strict_trans_tables ====
--echo [on master]
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
save_master_pos;
connection slave; --echo [on slave]
sync_with_master; sync_slave_with_master;
insert into t1 values (1); insert into t1 values (1);
--echo [on master]
connection master; connection master;
# Here we expect (ignored) error, since 1 is already in slave table # Here we expect (ignored) error, since 1 is already in slave table
insert into t1 values (1); insert into t1 values (1);
# These should work fine # These should work fine
insert into t1 values (2),(3); insert into t1 values (2),(3);
save_master_pos; sync_slave_with_master;
connection slave; --echo [on slave]
sync_with_master; select * from t1 order by n;
select * from t1 ORDER BY n;
# Cleanup --echo ==== Test With sql_mode=strict_trans_tables ====
insert into t1 values (7),(8);
--echo [on master]
connection master; connection master;
drop table t1; set sql_mode=strict_trans_tables;
insert into t1 values (7), (8), (9);
--echo [on slave]
sync_slave_with_master; sync_slave_with_master;
select * from t1 order by n;
source include/show_slave_status2.inc;
--echo ==== Clean Up ====
connection master;
drop table t1;
sync_slave_with_master;
# End of 4.1 tests # End of 4.1 tests
# #
...@@ -44,14 +66,17 @@ create table t1(a int primary key); ...@@ -44,14 +66,17 @@ create table t1(a int primary key);
insert into t1 values (1),(2); insert into t1 values (1),(2);
delete from t1 where @@server_id=1; delete from t1 where @@server_id=1;
set sql_mode=strict_trans_tables; set sql_mode=strict_trans_tables;
select @@server_id; insert into t1 values (7), (8), (9);
insert into t1 values (1),(2),(3);
--echo [on slave]
sync_slave_with_master; sync_slave_with_master;
connection slave;
select @@server_id;
select * from t1; select * from t1;
source include/show_slave_status2.inc; source include/show_slave_status2.inc;
--echo ==== Clean Up ====
connection master; connection master;
drop table t1; drop table t1;
sync_with_master; sync_slave_with_master;
# End of 5.0 tests # End of 5.0 tests
...@@ -50,9 +50,10 @@ show slave status; ...@@ -50,9 +50,10 @@ show slave status;
connection slave; connection slave;
drop table t1; drop table t1;
delete from mysql.user where user='rpl'; delete from mysql.user where user='rpl';
# cleanup: slave io thread has been stopped "irrecoverably"
# so we clean up mess manually
connection master; connection master;
drop table t1; drop table t1;
# end of test case for BUG#10780
# end of 4.1 tests # end of 4.1 tests
...@@ -132,7 +132,7 @@ drop table t1,t2; ...@@ -132,7 +132,7 @@ drop table t1,t2;
# don't get any memory leaks for this # don't get any memory leaks for this
create temporary table t3 (f int); create temporary table t3 (f int);
sync_with_master; sync_slave_with_master;
# The server will now close done # The server will now close done
...@@ -143,7 +143,8 @@ sync_with_master; ...@@ -143,7 +143,8 @@ sync_with_master;
connection master; connection master;
create temporary table t4 (f int); create temporary table t4 (f int);
create table t5 (f int); create table t5 (f int);
sync_with_master; sync_slave_with_master;
connection master;
# find dumper's $id # find dumper's $id
select id from information_schema.processlist where command='Binlog Dump' into @id; select id from information_schema.processlist where command='Binlog Dump' into @id;
kill @id; # to stimulate reconnection by slave w/o timeout kill @id; # to stimulate reconnection by slave w/o timeout
......
This diff is collapsed.
This diff is collapsed.
...@@ -399,6 +399,62 @@ set @b1 = concat(@b1,@b1); ...@@ -399,6 +399,62 @@ 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;
......
...@@ -184,14 +184,11 @@ set GLOBAL slave_transaction_retries=1; ...@@ -184,14 +184,11 @@ set GLOBAL slave_transaction_retries=1;
--echo **** On Master **** --echo **** On Master ****
UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
# wait for deadlock to be detected # Wait for deadlock to be detected.
# sleep longer than dead lock detection timeout in config # When detected, the slave will stop, so we just wait for it to stop.
# we do this 2 times, once with few retries to verify that we source include/wait_for_slave_sql_to_stop.inc;
# get a failure with the set sleep, and once with the _same_
# sleep, but with more retries to get it to succeed # Replication should have stopped, since max retries were not enough.
--sleep 5
# replication should have stopped, since max retries where not enough
# verify with show slave status # verify with show slave status
--connection slave --connection slave
--echo **** On Slave **** --echo **** On Slave ****
...@@ -202,9 +199,14 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1; ...@@ -202,9 +199,14 @@ UPDATE t1 SET `nom`="DEAD" WHERE `nid`=1;
# now set max retries high enough to succeed, and start slave again # now set max retries high enough to succeed, and start slave again
set GLOBAL slave_transaction_retries=10; set GLOBAL slave_transaction_retries=10;
START SLAVE; START SLAVE;
# wait for deadlock to be detected and retried source include/wait_for_slave_to_start.inc;
# should be the same sleep as above for test to be valid # Wait for deadlock to be detected and retried.
--sleep 5 # We want to wait until at least one retry has been made, but before
# the slave stops. currently, there is no safe way to do that: we
# would need to access the retry counter, but that is not exposed.
# Failing that, we just wait sufficiently long that one but not all
# retries have been made. See BUG#35183.
sleep 5;
# commit transaction to release lock on row and let replication succeed # commit transaction to release lock on row and let replication succeed
select * from t1 order by nid; select * from t1 order by nid;
......
...@@ -41,8 +41,7 @@ select "--- Local --" as ""; ...@@ -41,8 +41,7 @@ select "--- Local --" as "";
# be time dependent (the Start events). Better than nothing. # be time dependent (the Start events). Better than nothing.
# #
--replace_regex /[[:<:]][0-9]{6} [0-9 ][0-9]:[0-9]{2}:[0-9]{2}[[:>:]]/{yymmdd} {HH:MM:SS}/ /=[0-9]+ /={integer} / /# at [0-9]+/# at {pos}/ /(pos:?) [0-9]+/\1 {pos}/ /binlog v [0-9]+, server v [^ ]* created/binlog v #, server v ## created/ --exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLTEST_VARDIR/log/master-bin.000001
--exec $MYSQL_BINLOG --base64-output=never $MYSQLTEST_VARDIR/log/master-bin.000001
--disable_query_log --disable_query_log
select "--- offset --" as ""; select "--- offset --" as "";
......
...@@ -4789,6 +4789,12 @@ Item_func_get_system_var::fix_fields(THD *thd, Item **ref) ...@@ -4789,6 +4789,12 @@ Item_func_get_system_var::fix_fields(THD *thd, Item **ref)
} }
bool Item_func_get_system_var::is_written_to_binlog()
{
return var->is_written_to_binlog(var_type);
}
longlong Item_func_inet_aton::val_int() longlong Item_func_inet_aton::val_int()
{ {
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
......
...@@ -1435,6 +1435,15 @@ public: ...@@ -1435,6 +1435,15 @@ public:
void fix_length_and_dec() { DBUG_ASSERT(0); } void fix_length_and_dec() { DBUG_ASSERT(0); }
/* TODO: fix to support views */ /* TODO: fix to support views */
const char *func_name() const { return "get_system_var"; } const char *func_name() const { return "get_system_var"; }
/**
Indicates whether this system variable is written to the binlog or not.
Variables are written to the binlog as part of "status_vars" in
Query_log_event, as an Intvar_log_event, or a Rand_log_event.
@return true if the variable is written to the binlog, false otherwise.
*/
bool is_written_to_binlog();
}; };
......
...@@ -14,7 +14,11 @@ ...@@ -14,7 +14,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef MYSQL_CLIENT #ifdef MYSQL_CLIENT
#include "mysql_priv.h"
#else
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
...@@ -28,7 +32,9 @@ ...@@ -28,7 +32,9 @@
#include "rpl_utility.h" #include "rpl_utility.h"
#include "rpl_record.h" #include "rpl_record.h"
#include <my_dir.h> #include <my_dir.h>
#endif /* MYSQL_CLIENT */ #endif /* MYSQL_CLIENT */
#include <base64.h> #include <base64.h>
#include <my_bitmap.h> #include <my_bitmap.h>
...@@ -137,7 +143,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error, ...@@ -137,7 +143,7 @@ static void inline slave_rows_error_report(enum loglevel level, int ha_error,
" %s, Error_code: %d;", err->msg, err->code); " %s, Error_code: %d;", err->msg, err->code);
} }
rli->report(level, thd->net.last_errno, rli->report(level, thd->is_error()? thd->main_da.sql_errno() : 0,
"Could not execute %s event on table %s.%s;" "Could not execute %s event on table %s.%s;"
"%s handler error %s; " "%s handler error %s; "
"the event's master log %s, end_log_pos %lu", "the event's master log %s, end_log_pos %lu",
...@@ -1589,7 +1595,7 @@ bool Query_log_event::write(IO_CACHE* file) ...@@ -1589,7 +1595,7 @@ bool Query_log_event::write(IO_CACHE* file)
recognize Q_CATALOG_CODE and have no problem. recognize Q_CATALOG_CODE and have no problem.
*/ */
} }
if (auto_increment_increment != 1) if (auto_increment_increment != 1 || auto_increment_offset != 1)
{ {
*start++= Q_AUTO_INCREMENT; *start++= Q_AUTO_INCREMENT;
int2store(start, auto_increment_increment); int2store(start, auto_increment_increment);
...@@ -2102,9 +2108,17 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -2102,9 +2108,17 @@ void Query_log_event::print_query_header(IO_CACHE* file,
end= strmov(end, print_event_info->delimiter); end= strmov(end, print_event_info->delimiter);
*end++='\n'; *end++='\n';
my_b_write(file, (uchar*) buff, (uint) (end-buff)); my_b_write(file, (uchar*) buff, (uint) (end-buff));
if (flags & LOG_EVENT_THREAD_SPECIFIC_F) if ((!print_event_info->thread_id_printed ||
((flags & LOG_EVENT_THREAD_SPECIFIC_F) &&
thread_id != print_event_info->thread_id)))
{
// If --short-form, print deterministic value instead of pseudo_thread_id.
my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n", my_b_printf(file,"SET @@session.pseudo_thread_id=%lu%s\n",
(ulong)thread_id, print_event_info->delimiter); short_form ? 999999999 : (ulong)thread_id,
print_event_info->delimiter);
print_event_info->thread_id= thread_id;
print_event_info->thread_id_printed= 1;
}
/* /*
If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to If flags2_inited==0, this is an event from 3.23 or 4.0; nothing to
...@@ -2151,20 +2165,14 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -2151,20 +2165,14 @@ void Query_log_event::print_query_header(IO_CACHE* file,
gracefully). So this code should always be good. gracefully). So this code should always be good.
*/ */
if (likely(sql_mode_inited)) if (likely(sql_mode_inited) &&
{ (unlikely(print_event_info->sql_mode != sql_mode ||
if (unlikely(!print_event_info->sql_mode_inited)) /* first Query event */ !print_event_info->sql_mode_inited)))
{
print_event_info->sql_mode_inited= 1;
/* force a difference to force write */
print_event_info->sql_mode= ~sql_mode;
}
if (unlikely(print_event_info->sql_mode != sql_mode))
{ {
my_b_printf(file,"SET @@session.sql_mode=%lu%s\n", my_b_printf(file,"SET @@session.sql_mode=%lu%s\n",
(ulong)sql_mode, print_event_info->delimiter); (ulong)sql_mode, print_event_info->delimiter);
print_event_info->sql_mode= sql_mode; print_event_info->sql_mode= sql_mode;
} print_event_info->sql_mode_inited= 1;
} }
if (print_event_info->auto_increment_increment != auto_increment_increment || if (print_event_info->auto_increment_increment != auto_increment_increment ||
print_event_info->auto_increment_offset != auto_increment_offset) print_event_info->auto_increment_offset != auto_increment_offset)
...@@ -2178,14 +2186,9 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -2178,14 +2186,9 @@ void Query_log_event::print_query_header(IO_CACHE* file,
/* TODO: print the catalog when we feature SET CATALOG */ /* TODO: print the catalog when we feature SET CATALOG */
if (likely(charset_inited)) if (likely(charset_inited) &&
{ (unlikely(!print_event_info->charset_inited ||
if (unlikely(!print_event_info->charset_inited)) /* first Query event */ bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6))))
{
print_event_info->charset_inited= 1;
print_event_info->charset[0]= ~charset[0]; // force a difference to force write
}
if (unlikely(bcmp((uchar*) print_event_info->charset, (uchar*) charset, 6)))
{ {
CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME)); CHARSET_INFO *cs_info= get_charset(uint2korr(charset), MYF(MY_WME));
if (cs_info) if (cs_info)
...@@ -2204,7 +2207,7 @@ void Query_log_event::print_query_header(IO_CACHE* file, ...@@ -2204,7 +2207,7 @@ void Query_log_event::print_query_header(IO_CACHE* file,
uint2korr(charset+4), uint2korr(charset+4),
print_event_info->delimiter); print_event_info->delimiter);
memcpy(print_event_info->charset, charset, 6); memcpy(print_event_info->charset, charset, 6);
} print_event_info->charset_inited= 1;
} }
if (time_zone_len) if (time_zone_len)
{ {
...@@ -8631,3 +8634,34 @@ Incident_log_event::write_data_body(IO_CACHE *file) ...@@ -8631,3 +8634,34 @@ Incident_log_event::write_data_body(IO_CACHE *file)
DBUG_ENTER("Incident_log_event::write_data_body"); DBUG_ENTER("Incident_log_event::write_data_body");
DBUG_RETURN(write_str(file, m_message.str, m_message.length)); DBUG_RETURN(write_str(file, m_message.str, m_message.length));
} }
#ifdef MYSQL_CLIENT
/**
The default values for these variables should be values that are
*incorrect*, i.e., values that cannot occur in an event. This way,
they will always be printed for the first event.
*/
st_print_event_info::st_print_event_info()
:flags2_inited(0), sql_mode_inited(0),
auto_increment_increment(0),auto_increment_offset(0), charset_inited(0),
lc_time_names_number(~0),
charset_database_number(ILLEGAL_CHARSET_INFO_NUMBER),
thread_id(0), thread_id_printed(false),
base64_output_mode(BASE64_OUTPUT_UNSPEC), printed_fd_event(FALSE)
{
/*
Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
program's startup, but these explicit bzero() is for the day someone
creates dynamic instances.
*/
bzero(db, sizeof(db));
bzero(charset, sizeof(charset));
bzero(time_zone_str, sizeof(time_zone_str));
delimiter[0]= ';';
delimiter[1]= 0;
myf const flags = MYF(MY_WME | MY_NABP);
open_cached_file(&head_cache, NULL, NULL, 0, flags);
open_cached_file(&body_cache, NULL, NULL, 0, flags);
}
#endif
...@@ -592,7 +592,8 @@ typedef struct st_print_event_info ...@@ -592,7 +592,8 @@ typedef struct st_print_event_info
{ {
/* /*
Settings for database, sql_mode etc that comes from the last event Settings for database, sql_mode etc that comes from the last event
that was printed. that was printed. We cache these so that we don't have to print
them if they are unchanged.
*/ */
// TODO: have the last catalog here ?? // TODO: have the last catalog here ??
char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is char db[FN_REFLEN+1]; // TODO: make this a LEX_STRING when thd->db is
...@@ -606,26 +607,10 @@ typedef struct st_print_event_info ...@@ -606,26 +607,10 @@ typedef struct st_print_event_info
char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH]; char time_zone_str[MAX_TIME_ZONE_NAME_LENGTH];
uint lc_time_names_number; uint lc_time_names_number;
uint charset_database_number; uint charset_database_number;
st_print_event_info() uint thread_id;
:flags2_inited(0), sql_mode_inited(0), bool thread_id_printed;
auto_increment_increment(1),auto_increment_offset(1), charset_inited(0),
lc_time_names_number(0), charset_database_number(0), st_print_event_info();
base64_output_mode(BASE64_OUTPUT_UNSPEC), printed_fd_event(FALSE)
{
/*
Currently we only use static PRINT_EVENT_INFO objects, so zeroed at
program's startup, but these explicit bzero() is for the day someone
creates dynamic instances.
*/
bzero(db, sizeof(db));
bzero(charset, sizeof(charset));
bzero(time_zone_str, sizeof(time_zone_str));
delimiter[0]= ';';
delimiter[1]= 0;
myf const flags = MYF(MY_WME | MY_NABP);
open_cached_file(&head_cache, NULL, NULL, 0, flags);
open_cached_file(&body_cache, NULL, NULL, 0, flags);
}
~st_print_event_info() { ~st_print_event_info() {
close_cached_file(&head_cache); close_cached_file(&head_cache);
......
...@@ -615,7 +615,7 @@ int Relay_log_info::wait_for_pos(THD* thd, String* log_name, ...@@ -615,7 +615,7 @@ int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
DBUG_ENTER("Relay_log_info::wait_for_pos"); DBUG_ENTER("Relay_log_info::wait_for_pos");
if (!inited) if (!inited)
DBUG_RETURN(-1); DBUG_RETURN(-2);
DBUG_PRINT("enter",("log_name: '%s' log_pos: %lu timeout: %lu", DBUG_PRINT("enter",("log_name: '%s' log_pos: %lu timeout: %lu",
log_name->c_ptr(), (ulong) log_pos, (ulong) timeout)); log_name->c_ptr(), (ulong) log_pos, (ulong) timeout));
......
This diff is collapsed.
This diff is collapsed.
...@@ -7389,6 +7389,7 @@ variable_aux: ...@@ -7389,6 +7389,7 @@ variable_aux:
} }
| '@' opt_var_ident_type ident_or_text opt_component | '@' opt_var_ident_type ident_or_text opt_component
{ {
/* disallow "SELECT @@global.global.variable" */
if ($3.str && $4.str && check_reserved_words(&$3)) if ($3.str && $4.str && check_reserved_words(&$3))
{ {
my_parse_error(ER(ER_SYNTAX_ERROR)); my_parse_error(ER(ER_SYNTAX_ERROR));
...@@ -7396,6 +7397,8 @@ variable_aux: ...@@ -7396,6 +7397,8 @@ variable_aux:
} }
if (!($$= get_system_var(YYTHD, $2, $3, $4))) if (!($$= get_system_var(YYTHD, $2, $3, $4)))
MYSQL_YYABORT; MYSQL_YYABORT;
if (!((Item_func_get_system_var*) $$)->is_written_to_binlog())
Lex->set_stmt_unsafe();
} }
; ;
......
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