mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Manual merge of mysql-trunk into mysql-trunk-merge.
Conflicts: Text conflict in client/mysqlbinlog.cc Text conflict in mysql-test/Makefile.am Text conflict in mysql-test/collections/default.daily Text conflict in mysql-test/r/mysqlbinlog_row_innodb.result Text conflict in mysql-test/suite/rpl/r/rpl_typeconv_innodb.result Text conflict in mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test Text conflict in mysql-test/suite/rpl/t/rpl_row_create_table.test Text conflict in mysql-test/suite/rpl/t/rpl_slave_skip.test Text conflict in mysql-test/suite/rpl/t/rpl_typeconv_innodb.test Text conflict in mysys/charset.c Text conflict in sql/field.cc Text conflict in sql/field.h Text conflict in sql/item.h Text conflict in sql/item_func.cc Text conflict in sql/log.cc Text conflict in sql/log_event.cc Text conflict in sql/log_event_old.cc Text conflict in sql/mysqld.cc Text conflict in sql/rpl_utility.cc Text conflict in sql/rpl_utility.h Text conflict in sql/set_var.cc Text conflict in sql/share/Makefile.am Text conflict in sql/sql_delete.cc Text conflict in sql/sql_plugin.cc Text conflict in sql/sql_select.cc Text conflict in sql/sql_table.cc Text conflict in storage/example/ha_example.h Text conflict in storage/federated/ha_federated.cc Text conflict in storage/myisammrg/ha_myisammrg.cc Text conflict in storage/myisammrg/myrg_open.c
This commit is contained in:
52
mysql-test/extra/rpl_tests/check_type.inc
Normal file
52
mysql-test/extra/rpl_tests/check_type.inc
Normal file
@@ -0,0 +1,52 @@
|
||||
# Helper file to perform one insert of a value into a table with
|
||||
# different types on master and slave. The file will insert the
|
||||
# result into the type_conversions table *on the slave* to get a
|
||||
# summary of failing and succeeding tests.
|
||||
|
||||
# Input:
|
||||
# $source_type Type on the master
|
||||
# $target_type Type on the slave
|
||||
# $source_value Value on the master (inserted into the table)
|
||||
# $target_value Value on the slave (expected value in the table
|
||||
# on the slave)
|
||||
# $can_convert True if conversion shall work, false if it
|
||||
# shall generate an error
|
||||
|
||||
|
||||
connection master;
|
||||
disable_warnings;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
enable_warnings;
|
||||
eval CREATE TABLE t1 (a $source_type);
|
||||
sync_slave_with_master;
|
||||
eval ALTER TABLE t1 MODIFY a $target_type;
|
||||
|
||||
connection master;
|
||||
eval INSERT INTO t1 VALUES($source_value);
|
||||
if ($can_convert) {
|
||||
sync_slave_with_master;
|
||||
eval SELECT a = $target_value into @compare FROM t1;
|
||||
eval INSERT INTO type_conversions SET
|
||||
Source = "$source_type",
|
||||
Target = "$target_type",
|
||||
Flags = @@slave_type_conversions,
|
||||
On_Master = $source_value,
|
||||
Expected = $target_value,
|
||||
Compare = @compare;
|
||||
UPDATE type_conversions
|
||||
SET On_Slave = (SELECT a FROM t1)
|
||||
WHERE TestNo = LAST_INSERT_ID();
|
||||
}
|
||||
if (!$can_convert) {
|
||||
connection slave;
|
||||
wait_for_slave_to_stop;
|
||||
let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
eval INSERT INTO type_conversions SET
|
||||
Source = "$source_type",
|
||||
Target = "$target_type",
|
||||
Flags = @@slave_type_conversions,
|
||||
On_Master = $source_value,
|
||||
Error = "$error";
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE;
|
||||
}
|
400
mysql-test/extra/rpl_tests/create_recursive_construct.inc
Normal file
400
mysql-test/extra/rpl_tests/create_recursive_construct.inc
Normal file
@@ -0,0 +1,400 @@
|
||||
# ==== Purpose ====
|
||||
#
|
||||
# Creates a stored routine, stored function, trigger, view, or
|
||||
# prepared statement (commonly referred to as "recursive construct")
|
||||
# that invokes a given unsafe statement.
|
||||
#
|
||||
# Then, it invokes the created recursive construct several times:
|
||||
#
|
||||
# - With SQL_LOG_BIN = 1 and binlog_format = STATEMENT, to verify
|
||||
# that it gives a warning.
|
||||
#
|
||||
# - With SQL_LOG_BIN = 0 and binlog_format = STATEMENT, to verify that
|
||||
# there is no warning and nothing is logged.
|
||||
#
|
||||
# - With SQL_LOG_BIN = 1 and binlog_format = MIXED, to verify that it
|
||||
# writes row events to the binlog.
|
||||
#
|
||||
# - In some cases, the recursive construct can be invoked so that it
|
||||
# has no side-effects but returns a value that may be
|
||||
# nondeterministic. An example is a function that returns UUID().
|
||||
# The function does not have side effects but its a return value
|
||||
# that may differ on slave. Such statements are invoked so that
|
||||
# the return value is discarded (e.g., SELECT func()), with
|
||||
# SQL_LOG_BIN = 1 and binlog_format = STATEMENT. In this case, no
|
||||
# warning should be given and nothing should be written to the
|
||||
# binlog.
|
||||
#
|
||||
# This is an auxiliary file particularly targeted to being used by the
|
||||
# test binlog_unsafe. In this context, the purpose is to check how
|
||||
# warnings for unsafe statements are propagated in recursive
|
||||
# constructs.
|
||||
#
|
||||
# The statement to invoke ("input") is described using mtr variables,
|
||||
# and the resulting recursive construct ("output") is stored in mtr
|
||||
# variables in a similar fashion. To create several levels of nested
|
||||
# recursive constructs, source this file once, then copy the values of
|
||||
# appropriate output variables to the input variables, and then source
|
||||
# this file again.
|
||||
#
|
||||
#
|
||||
# ==== Usage ====
|
||||
#
|
||||
# See binlog_unsafe for an example of how to use this file.
|
||||
#
|
||||
# let $CRC_ARG_level= <level>;
|
||||
# let $CRC_ARG_type= <type>;
|
||||
# let $CRC_ARG_stmt_sidef= <stmt>;
|
||||
# let $CRC_ARG_value= <stmt>;
|
||||
# let $CRC_ARG_sel_retval= <stmt>;
|
||||
# let $CRC_ARG_sel_sidef= <stmt>;
|
||||
# let $CRC_ARG_desc= <desc>;
|
||||
# source extra/rpl_tests/create_recursive_construct.inc;
|
||||
# let $my_stmt_sidef= $CRC_RET_stmt_sidef;
|
||||
# let $my_value= $CRC_RET_value;
|
||||
# let $my_sel_sidef= $CRC_RET_sel_sidef;
|
||||
# let $my_sel_retval= $CRC_RET_sel_retval;
|
||||
# let $my_drop= $CRC_RET_drop;
|
||||
# let $my_is_toplevel= $CRC_RET_top_is_toplevel;
|
||||
# let $my_desc= $CRC_RET_desc;
|
||||
#
|
||||
# $CRC_ARG_* are used as input parameters (arguments) to this file:
|
||||
#
|
||||
# $CRC_ARG_level is the recursion depth: 1 for the innermost
|
||||
# statement created, 2 for a statement that invokes a statement on
|
||||
# level 1, etc.
|
||||
#
|
||||
# $CRC_ARG_type is an integer from 0 to 6, indicating what type of
|
||||
# statement shall be created:
|
||||
# 0 - Create a stored function where the return value depends on
|
||||
# the value of the given statement.
|
||||
# 1 - Create a stored function that invokes the given statement as
|
||||
# a side-effect but may not return a value that depends on it.
|
||||
# 2 - Create a stored routine that invokes the given statement.
|
||||
# 3 - Create a trigger (on table trigger_table_$CRC_ARG_level) that
|
||||
# invokes the given statement.
|
||||
# 4 - Create a view that returns a value that depends on the value
|
||||
# of the given statement.
|
||||
# 5 - Create a view that invokes the given statement but may return
|
||||
# a value that does not depend on it.
|
||||
# 6 - Create a prepared statement that invokes the given statement.
|
||||
#
|
||||
# $CRC_ARG_stmt_sidef is the statement to invoke. It should be a
|
||||
# statement that can be invoked on its own (not sub-statement),
|
||||
# which causes something unsafe to be written to the binlog.
|
||||
#
|
||||
# $CRC_ARG_value is a sub-statement holding the value of the given
|
||||
# statement. Can be empty if the given statement does not have a
|
||||
# value. Typically, this is non-empty if the given statement is a
|
||||
# function call or user variable, but not if it is a stored routine
|
||||
# call, INSERT, SELECT, etc (because none of them has a value).
|
||||
# $CRC_ARG_value is used only when $CRC_ARG_type=6.
|
||||
#
|
||||
# $CRC_ARG_sel_sidef is a SELECT sub-statement that invokes the
|
||||
# statement as a side-effect, but returns a result set that may not
|
||||
# depend on the statement. Can be empty if the statement cannot
|
||||
# produce a result set from a SELECT. $CRC_ARG_sel_sidef is used
|
||||
# only if $CRC_ARG_type=2
|
||||
#
|
||||
# $CRC_ARG_sel_retval is a SELECT sub-statement that does not have
|
||||
# side-effects, but returns a result set that depends on the unsafe
|
||||
# statement. Can be empty if the statement cannot be invoked from a
|
||||
# SELECT. $CRC_ARG_sel_retval is used only if $CRC_ARG_type=3.
|
||||
#
|
||||
# $CRC_ARG_desc is a human-readable description of the statement to
|
||||
# invoke.
|
||||
#
|
||||
# $CRC_RET_* are used as output parameters (return values) of this
|
||||
# file:
|
||||
#
|
||||
# $CRC_RET_stmt_sidef is a statement invoking the resulting recursive
|
||||
# construct.
|
||||
#
|
||||
# $CRC_RET_value is a sub-statement invoking the resulting recursive
|
||||
# construct and returning the value of the recursive construct.
|
||||
# This is the empty string if the resulting recursive construct does
|
||||
# not have a value. In particular, this is non-empty only if
|
||||
# $CRC_ARG_value=7.
|
||||
#
|
||||
# $CRC_RET_sel_sidef is a SELECT sub-statement that invokes the
|
||||
# resulting recursive construct as a side-effect but where the
|
||||
# result set may not depend on the recursive construct. This is the
|
||||
# empty string if the recursive construct cannot be invoked from a
|
||||
# SELECT. In particular, this is non-empty only if $CRC_ARG_value=6
|
||||
# or $CRC_ARG_value=2.
|
||||
#
|
||||
# $CRC_RET_sel_retval is a SELECT sub-statement that does not have
|
||||
# side-effects, but returns a result set depending on the unsafe
|
||||
# statement. This is the empty string if the recursive construct
|
||||
# cannot produce a result set from a SELECT. In particular, this is
|
||||
# non-empty only if $CRC_ARG_value=7 or $CRC_ARG_value=3.
|
||||
#
|
||||
# $CRC_RET_drop is a statement that drops the created object. I.e.,
|
||||
# it is one of 'DROP FUNCTION <func>', 'DROP PROCEDURE <proc>', etc.
|
||||
#
|
||||
# $CRC_RET_top_is_toplevel is 0 normally, or 1 if the resulting
|
||||
# recursive construct can only be called from a top-level statement.
|
||||
# In particular, this is 1 only when $CRC_ARG_value=1, because
|
||||
# prepared statements cannot be invoked from other recursive
|
||||
# constructs.
|
||||
#
|
||||
# $CRC_RET_desc is a text string that describes the invokation of
|
||||
# the recursive construct in a human-readable fashion.
|
||||
#
|
||||
# Assumptions
|
||||
#
|
||||
# Before sourcing this file with $CRC_ARG_level=X, you need to
|
||||
# create three tables: tX, taX and trigger_table_X. These are used
|
||||
# as auxiliary tables.
|
||||
|
||||
|
||||
#--echo debug: >>>>ENTER create_recursive_construct
|
||||
#--echo debug: level=$CRC_ARG_level
|
||||
#--echo debug: type=$CRC_ARG_type
|
||||
#--echo debug: stmt_sidef=$CRC_ARG_stmt_sidef
|
||||
#--echo debug: value=$CRC_ARG_value
|
||||
#--echo debug: sel_retval=$CRC_ARG_sel_retval
|
||||
#--echo debug: sel_sidef=$CRC_ARG_sel_sidef
|
||||
|
||||
--let $CRC_RET_stmt_sidef=
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_drop=
|
||||
--let $CRC_RET_is_toplevel= 1
|
||||
--let $CRC_RET_desc=
|
||||
--let $CRC_name=
|
||||
--let $CRC_create=
|
||||
|
||||
######## func_retval ########
|
||||
if (`SELECT $CRC_ARG_type = 0 AND '$CRC_ARG_value' != ''`) {
|
||||
# It will be safe to call this function and discard the return
|
||||
# value, but it will be unsafe to use return value (e.g., in
|
||||
# INSERT...SELECT).
|
||||
--let $CRC_name= func_retval_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); RETURN $CRC_ARG_value; END
|
||||
--let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level VALUES ($CRC_name())
|
||||
--let $CRC_RET_value= $CRC_name()
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_sel_retval= SELECT $CRC_name()
|
||||
--let $CRC_RET_drop= DROP FUNCTION $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= function $CRC_name returning value from $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## func_sidef ########
|
||||
if (`SELECT $CRC_ARG_type = 1`) {
|
||||
# It will be unsafe to call func even if you discard return value.
|
||||
--let $CRC_name= func_sidef_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE FUNCTION $CRC_name() RETURNS VARCHAR(100) BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; RETURN 0; END
|
||||
--let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level SELECT $CRC_name()
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef= SELECT $CRC_name()
|
||||
--let $CRC_RET_drop= DROP FUNCTION $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= function $CRC_name invoking $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## proc ########
|
||||
if (`SELECT $CRC_ARG_type = 2`) {
|
||||
# It will be unsafe to call this procedure.
|
||||
--let $CRC_name= proc_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE PROCEDURE $CRC_name() BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
|
||||
--let $CRC_RET_stmt_sidef= CALL $CRC_name()
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_drop= DROP PROCEDURE $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= procedure $CRC_name invoking $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## trig ########
|
||||
if (`SELECT $CRC_ARG_type = 3`) {
|
||||
# It will be unsafe to invoke this trigger.
|
||||
--let $CRC_name= trig_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE TRIGGER $CRC_name BEFORE INSERT ON trigger_table_$CRC_ARG_level FOR EACH ROW BEGIN INSERT INTO ta$CRC_ARG_level VALUES (47); $CRC_ARG_stmt_sidef; END
|
||||
--let $CRC_RET_stmt_sidef= INSERT INTO trigger_table_$CRC_ARG_level VALUES (1)
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_drop= DROP TRIGGER $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= trigger $CRC_name invoking $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## view_retval ########
|
||||
if (`SELECT $CRC_ARG_type = 4 AND '$CRC_ARG_sel_retval' != ''`) {
|
||||
# It will be safe to select from this view if you discard the result
|
||||
# set, but unsafe to use result set (e.g., in INSERT..SELECT).
|
||||
--let $CRC_name= view_retval_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE VIEW $CRC_name AS $CRC_ARG_sel_retval
|
||||
--let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_LEVEL SELECT * FROM $CRC_name
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval= SELECT * FROM $CRC_name
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_drop= DROP VIEW $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= view $CRC_name returning value from $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## view_sidef ########
|
||||
if (`SELECT $CRC_ARG_type = 5 AND '$CRC_ARG_sel_sidef' != ''`) {
|
||||
# It will be unsafe to select from this view, even if you discard
|
||||
# the return value.
|
||||
--let $CRC_name= view_sidef_$CRC_ARG_level
|
||||
--let $CRC_create= CREATE VIEW $CRC_name AS $CRC_ARG_sel_sidef
|
||||
--let $CRC_RET_stmt_sidef= INSERT INTO t$CRC_ARG_level SELECT * FROM $CRC_name
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef= SELECT * FROM $CRC_name
|
||||
--let $CRC_RET_drop= DROP VIEW $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 0
|
||||
--let $CRC_RET_desc= view $CRC_name invoking $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## prep ########
|
||||
if (`SELECT $CRC_ARG_type = 6`) {
|
||||
# It will be unsafe to execute this prepared statement
|
||||
--let $CRC_name= prep_$CRC_ARG_level
|
||||
--let $CRC_create= PREPARE $CRC_name FROM "$CRC_ARG_stmt_sidef"
|
||||
--let $CRC_RET_stmt_sidef= EXECUTE $CRC_name
|
||||
--let $CRC_RET_value=
|
||||
--let $CRC_RET_sel_retval=
|
||||
--let $CRC_RET_sel_sidef=
|
||||
--let $CRC_RET_drop= DROP PREPARE $CRC_name
|
||||
--let $CRC_RET_is_toplevel= 1
|
||||
--let $CRC_RET_desc= prepared statement $CRC_name invoking $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## no recursive construct: just return the given statement ########
|
||||
if (`SELECT $CRC_ARG_type = 7`) {
|
||||
# CRC_ARG_type=7 is a special case. We just set $CRC_RET_x =
|
||||
# $CRC_ARG_x. This way, the $CRC_ARG_stmt gets executed directly
|
||||
# (below). In binlog_unsafe.test, it is used to invoke the unsafe
|
||||
# statement created in the outermost loop directly, without
|
||||
# enclosing it in a recursive construct.
|
||||
--let $CRC_RET_stmt_sidef= $CRC_ARG_stmt_sidef
|
||||
--let $CRC_RET_value= $CRC_ARG_value
|
||||
--let $CRC_RET_sel_retval= $CRC_ARG_sel_retval
|
||||
--let $CRC_RET_sel_sidef= $CRC_ARG_sel_sidef
|
||||
--let $CRC_RET_drop=
|
||||
--let $CRC_RET_is_toplevel= 1
|
||||
--let $CRC_RET_desc= $CRC_ARG_desc
|
||||
}
|
||||
|
||||
######## execute! ########
|
||||
if (`SELECT '$CRC_RET_stmt_sidef' != ''`) {
|
||||
--echo
|
||||
--echo Invoking $CRC_RET_desc.
|
||||
if (`SELECT '$CRC_create' != ''`) {
|
||||
--eval $CRC_create
|
||||
}
|
||||
|
||||
--echo * binlog_format = STATEMENT: expect $CRC_ARG_expected_number_of_warnings warnings.
|
||||
--eval $CRC_RET_stmt_sidef
|
||||
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
|
||||
if (`SELECT '$n_warnings' != '$CRC_ARG_expected_number_of_warnings'`) {
|
||||
--echo ******** Failure! Expected $CRC_ARG_expected_number_of_warnings warnings, got $n_warnings warnings. ********
|
||||
SHOW WARNINGS;
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Wrong number of warnings.
|
||||
}
|
||||
|
||||
# These queries are run without query log, to make result file more
|
||||
# readable. Debug info is only printed if something abnormal
|
||||
# happens.
|
||||
--disable_query_log
|
||||
|
||||
--echo * SQL_LOG_BIN = 0: expect nothing logged and no warning.
|
||||
SET SQL_LOG_BIN = 0;
|
||||
RESET MASTER;
|
||||
--eval $CRC_RET_stmt_sidef
|
||||
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
|
||||
if (`SELECT '$n_warnings' != '0'`) {
|
||||
--echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
|
||||
SHOW WARNINGS;
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Wrong number of warnings.
|
||||
}
|
||||
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
|
||||
if (`SELECT '$binlog_event' != 'No such row'`) {
|
||||
--enable_query_log
|
||||
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Binlog not empty
|
||||
}
|
||||
SET SQL_LOG_BIN = 1;
|
||||
|
||||
--echo * binlog_format = MIXED: expect row events in binlog and no warning.
|
||||
SET binlog_format = MIXED;
|
||||
RESET MASTER;
|
||||
--eval $CRC_RET_stmt_sidef
|
||||
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
|
||||
if (`SELECT '$n_warnings' != '0'`) {
|
||||
--echo ******** Failure! Expected 0 warnings, got $n_warnings warnings. ********
|
||||
SHOW WARNINGS;
|
||||
SHOW BINLOG EVENTS;
|
||||
--die Warnings printed
|
||||
}
|
||||
# The first event is format_description, the second is
|
||||
# Query_event('BEGIN'), and the third should be our Table_map.
|
||||
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
|
||||
if (`SELECT '$event_type' != 'Table_map'`) {
|
||||
--enable_query_log
|
||||
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
|
||||
|
||||
# Currently, there is a bug causing some statements to be logged
|
||||
# partially in statement format. Hence, we don't fail here, we
|
||||
# just print the events (masking out nondeterministic components
|
||||
# of the output) and continue. When binloggging works perfectly,
|
||||
# we should instead execute:
|
||||
#--enable_query_log
|
||||
#SHOW BINLOG EVENTS;
|
||||
#--die Wrong events in binlog.
|
||||
|
||||
# Here, we should really source
|
||||
# include/show_binlog_events.inc. But due to BUG#41913, that
|
||||
# doesn't work, and we have to inline the entire file here. Sigh
|
||||
# :-(
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR 107 <binlog_start>
|
||||
--replace_column 2 # 4 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/
|
||||
--eval SHOW BINLOG EVENTS FROM 107
|
||||
--disable_query_log
|
||||
}
|
||||
SET binlog_format = STATEMENT;
|
||||
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Invoke created object, discarding the return value. This should not
|
||||
# give any warning.
|
||||
if (`SELECT '$CRC_RET_sel_retval' != ''`) {
|
||||
--echo * Invoke statement so that return value is dicarded: expect no warning.
|
||||
--disable_result_log
|
||||
--eval $CRC_RET_sel_retval
|
||||
--enable_result_log
|
||||
|
||||
# Currently, due to a bug, we do get warnings here, so we don't
|
||||
# fail. When the bug is fixed, we should execute the following.
|
||||
|
||||
#--let $n_warnings= `SHOW COUNT(*) WARNINGS`
|
||||
#if (`SELECT '$n_warnings' != '0'`) {
|
||||
# --enable_query_log
|
||||
# --echo Failure! Expected 0 warnings, got $n_warnings warnings.
|
||||
# SHOW WARNINGS;
|
||||
# SHOW BINLOG EVENTS;
|
||||
# --die Wrong number of warnings.
|
||||
#}
|
||||
}
|
||||
|
||||
#--echo debug: <<<<EXIT create_recursive_construct
|
||||
#--echo debug: stmt_sidef=$CRC_RET_stmt_sidef
|
||||
#--echo debug: value=$CRC_RET_value
|
||||
#--echo debug: sel_retval=$CRC_RET_sel_retval
|
||||
#--echo debug: sel_sidef=$CRC_RET_sel_sidef
|
||||
#--echo debug: drop=$CRC_RET_drop
|
||||
#--echo debug: is_toplevel=$CRC_RET_is_toplevel
|
||||
#--echo debug: desc=$CRC_RET_desc
|
388
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
Normal file
388
mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test
Normal file
@@ -0,0 +1,388 @@
|
||||
########################################################################################
|
||||
# This test verifies if the binlog is not corrupted when the cache buffer is not
|
||||
# big enough to accommodate the changes and is divided in five steps:
|
||||
#
|
||||
# 1 - Single Statements:
|
||||
# 1.1 - Single statement on transactional table.
|
||||
# 1.2 - Single statement on non-transactional table.
|
||||
# 1.3 - Single statement on both transactional and non-transactional tables.
|
||||
# In both 1.2 and 1.3, an incident event is logged to notify the user that the
|
||||
# master and slave are diverging.
|
||||
#
|
||||
# 2 - Transactions ended by an implicit commit.
|
||||
#
|
||||
# 3 - Transactions ended by a COMMIT.
|
||||
#
|
||||
# 4 - Transactions ended by a ROLLBACK.
|
||||
#
|
||||
# 5 - Transactions with a failing statement that updates a non-transactional
|
||||
# table. In this case, a failure means that the statement does not get into
|
||||
# the cache and an incident event is logged to notify the user that the master
|
||||
# and slave are diverging.
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
|
||||
CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam;
|
||||
CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb;
|
||||
|
||||
let $data = `select concat('"', repeat('a',2000), '"')`;
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 1 - SINGLE STATEMENT
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
|
||||
--echo *** Single statement on transactional table ***
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval INSERT INTO t1 (a, data) VALUES (1,
|
||||
CONCAT($data, $data, $data, $data, $data));
|
||||
--enable_query_log
|
||||
|
||||
--echo *** Single statement on non-transactional table ***
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval INSERT INTO t2 (a, data) VALUES (2,
|
||||
CONCAT($data, $data, $data, $data, $data, $data));
|
||||
--enable_query_log
|
||||
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE SQL_THREAD;
|
||||
--source include/wait_for_slave_sql_to_start.inc
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_query_log
|
||||
eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (4, $data);
|
||||
eval INSERT INTO t2 (a, data) VALUES (5, $data);
|
||||
--enable_query_log
|
||||
|
||||
--echo *** Single statement on both transactional and non-transactional tables. ***
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
|
||||
t1.data = CONCAT($data, $data, $data, $data);
|
||||
--enable_query_log
|
||||
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
|
||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
}
|
||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2;
|
||||
}
|
||||
START SLAVE SQL_THREAD;
|
||||
--source include/wait_for_slave_sql_to_start.inc
|
||||
connection master;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
ALTER TABLE t3 ADD COLUMN d int;
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t2 (a, data) VALUES (10, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (11, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (12, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (13, $data);
|
||||
--enable_query_log
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (14, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (17, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (19, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (20, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (21, 's');
|
||||
--enable_query_log
|
||||
|
||||
if (`SELECT @@binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
--disable_query_log
|
||||
CREATE TABLE t4 SELECT * FROM t1;
|
||||
--enable_query_log
|
||||
}
|
||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
CREATE TABLE t4 SELECT * FROM t1;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t2 (a, data) VALUES (15, $data);
|
||||
--enable_query_log
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (22, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (23, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (24, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (25, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (26, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (27, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (28, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (29, 's');
|
||||
--enable_query_log
|
||||
|
||||
--disable_query_log
|
||||
CREATE TABLE t5 (a int);
|
||||
--enable_query_log
|
||||
|
||||
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'` )
|
||||
{
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
|
||||
START SLAVE SQL_THREAD;
|
||||
--source include/wait_for_slave_sql_to_start.inc
|
||||
connection master;
|
||||
}
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 3 - BEGIN - COMMIT
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 4 - BEGIN - ROLLBACK
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 5 - PROCEDURE
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
DELIMITER //;
|
||||
|
||||
CREATE PROCEDURE p1(pd VARCHAR(30000))
|
||||
BEGIN
|
||||
INSERT INTO t1 (a, data) VALUES (1, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (2, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (3, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (4, pd);
|
||||
INSERT INTO t1 (a, data) VALUES (5, 's');
|
||||
END//
|
||||
|
||||
DELIMITER ;//
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--disable_query_log
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
eval CALL p1($data);
|
||||
--enable_query_log
|
||||
ROLLBACK;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 6 - XID
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (3, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
SAVEPOINT sv;
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--enable_query_log
|
||||
ROLLBACK TO sv;
|
||||
COMMIT;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # 7 - NON-TRANS TABLE
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
TRUNCATE TABLE t1;
|
||||
TRUNCATE TABLE t2;
|
||||
TRUNCATE TABLE t3;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (1, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (2, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (3, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (5, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (6, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (7, $data);
|
||||
--eval UPDATE t2 SET data= CONCAT($data, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (8, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (9, 's');
|
||||
--eval INSERT INTO t2 (a, data) VALUES (10, 's');
|
||||
--eval INSERT INTO t1 (a, data) VALUES (11, 's');
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
BEGIN;
|
||||
--disable_query_log
|
||||
--eval INSERT INTO t1 (a, data) VALUES (15, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (16, $data);
|
||||
--eval INSERT INTO t2 (a, data) VALUES (17, $data);
|
||||
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
|
||||
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
|
||||
--eval INSERT INTO t1 (a, data) VALUES (19, $data);
|
||||
--enable_query_log
|
||||
COMMIT;
|
||||
|
||||
let $diff_statement= SELECT * FROM t1;
|
||||
--source include/diff_master_slave.inc
|
||||
|
||||
--echo ########################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ########################################################################################
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
DROP TABLE t3;
|
||||
DROP TABLE IF EXISTS t4;
|
||||
DROP TABLE IF EXISTS t5;
|
||||
DROP TABLE IF EXISTS t6;
|
||||
DROP PROCEDURE p1;
|
||||
sync_slave_with_master;
|
@@ -114,9 +114,7 @@ set @@character_set_server=latin5;
|
||||
select @@character_set_server;
|
||||
select @@character_set_server;
|
||||
|
||||
# ONE_SHOT on not charset/collation stuff is not allowed
|
||||
-- error 1382
|
||||
set one_shot max_join_size=10;
|
||||
set one_shot max_join_size=1000000;
|
||||
|
||||
# Test of wrong character set numbers;
|
||||
error 1115;
|
||||
|
@@ -36,6 +36,9 @@ sync_slave_with_master;
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
|
||||
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
||||
|
||||
eval CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
|
||||
d FLOAT DEFAULT '2.00',
|
||||
e CHAR(4) DEFAULT 'TEST')
|
||||
@@ -62,6 +65,8 @@ SELECT * FROM t1 ORDER BY a;
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
|
||||
--echo *** Drop t1 ***
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
@@ -97,9 +102,8 @@ SELECT * FROM t2 ORDER BY a;
|
||||
connection slave;
|
||||
START SLAVE;
|
||||
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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
@@ -146,13 +150,12 @@ set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
@@ -191,13 +194,12 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
|
||||
(30000.22,4,'QA TESTING');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
@@ -236,13 +238,12 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
|
||||
(2,'JOE',300.01,0,'b2b2',1.0000009);
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
@@ -282,13 +283,12 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
|
||||
(2,'JOE',300.01,0);
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
|
||||
#START SLAVE;
|
||||
|
||||
@@ -491,13 +491,12 @@ set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
@@ -515,7 +514,7 @@ sync_slave_with_master;
|
||||
--echo *** Create t11 on slave ***
|
||||
STOP SLAVE;
|
||||
RESET SLAVE;
|
||||
eval CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
|
||||
eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
|
||||
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
|
||||
|
||||
--echo *** Create t11 on Master ***
|
||||
@@ -535,13 +534,12 @@ set @b1 = concat(@b1,@b1);
|
||||
INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
@@ -811,9 +809,8 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
|
||||
START SLAVE;
|
||||
|
||||
@@ -918,13 +915,12 @@ connection master;
|
||||
INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
|
||||
|
||||
--echo ********************************************
|
||||
--echo *** Expect slave to fail with Error 1522 ***
|
||||
--echo *** Expect slave to fail with Error 1677 ***
|
||||
--echo ********************************************
|
||||
connection slave;
|
||||
--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
|
||||
--let $errno= query_get_value("SHOW SLAVE STATUS", Last_SQL_Errno, 1)
|
||||
--echo Slave failed with Error $errno
|
||||
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
||||
START SLAVE;
|
||||
|
||||
|
@@ -20,19 +20,15 @@ rename table t1 to t5, t2 to t1;
|
||||
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
|
||||
flush no_write_to_binlog tables;
|
||||
# Check that it's not in the binlog.
|
||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||
let $binlog_start= $rename_event_pos;
|
||||
source include/show_binlog_events.inc;
|
||||
# Check that the master is not confused.
|
||||
select * from t3;
|
||||
# This FLUSH should go into the binlog to not confuse the slave.
|
||||
flush tables;
|
||||
# Check that it's in the binlog.
|
||||
--replace_result $SERVER_VERSION SERVER_VERSION
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
|
||||
let $binlog_start= $rename_event_pos;
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
sync_slave_with_master;
|
||||
# Check that the slave is not confused.
|
||||
|
@@ -47,7 +47,6 @@ insert into t1 set b=1;
|
||||
insert into t2 set a=1, b=1;
|
||||
|
||||
set foreign_key_checks=0;
|
||||
set @@session.binlog_format=row;
|
||||
delete from t1;
|
||||
|
||||
--echo must sync w/o a problem (could not with the buggy code)
|
||||
|
670
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
Normal file
670
mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test
Normal file
@@ -0,0 +1,670 @@
|
||||
################################################################################
|
||||
# In this test case, we verify if some DDL statements implicitly commit a
|
||||
# transaction and are written directly to the binary log without going
|
||||
# through either the Statement- or Transactional-Cache.
|
||||
#
|
||||
# As any statement that goes through a cache is written to the binary log
|
||||
# wrapped in a BEGIN...COMMIT, we proceed as follows:
|
||||
#
|
||||
# - create a transaction and insert some values into a transactional table.
|
||||
# - execute a DDL statement that is supposed to implicitly commit the previous
|
||||
# transaction.
|
||||
# - Check in the binary log for a COMMIT mark which is supposed to be written
|
||||
# before the DDL statement.
|
||||
# - Check in the binary log if the DDL is not wrapped by a BEGIN..COMMIT.
|
||||
#
|
||||
# For further details, please, read WL#2687 and WL#5072.
|
||||
################################################################################
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # CONFIGURATION
|
||||
--echo #########################################################################
|
||||
connection master;
|
||||
|
||||
eval CREATE TABLE tt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = $engine;
|
||||
eval CREATE TABLE tt_2 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = $engine;
|
||||
eval CREATE TABLE nt_1 (ddl_case INT, PRIMARY KEY(ddl_case)) ENGINE = MyIsam;
|
||||
|
||||
INSERT INTO tt_1(ddl_case) VALUES(0);
|
||||
INSERT INTO tt_2(ddl_case) VALUES(0);
|
||||
|
||||
--echo #########################################################################
|
||||
--echo # CHECK IMPLICT COMMIT
|
||||
--echo #########################################################################
|
||||
SET AUTOCOMMIT= 0;
|
||||
let $ddl_cases= 41;
|
||||
while (`SELECT $ddl_cases >= 1`)
|
||||
{
|
||||
--echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
||||
let $in_temporary= "no";
|
||||
let $ok= "yes";
|
||||
#
|
||||
# In SBR and MIXED modes, the commit event is usually the third event in the
|
||||
# binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: INSERT
|
||||
# 3: COMMIT
|
||||
# 4: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
let $commit_event_row_number= 3;
|
||||
}
|
||||
#
|
||||
# In RBR mode, the commit event is usually the fourth event in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: COMMIT
|
||||
# 5: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`select @@binlog_format = 'ROW'`)
|
||||
{
|
||||
let $commit_event_row_number= 4;
|
||||
}
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is usually the seventh event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: COMMAND
|
||||
# 2: BEGIN
|
||||
# 3: TABLE MAP EVENT
|
||||
# 4: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 5: ROW EVENT
|
||||
# 6: ROW EVENT
|
||||
# 7: COMMIT
|
||||
#
|
||||
if (`select '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 7;
|
||||
}
|
||||
|
||||
let $first_binlog_position= query_get_value("SHOW MASTER STATUS", Position, 1);
|
||||
--enable_query_log
|
||||
eval INSERT INTO tt_1(ddl_case) VALUES ($ddl_cases);
|
||||
if (`SELECT $ddl_cases = 41`)
|
||||
{
|
||||
let $cmd= LOAD INDEX INTO CACHE nt_1 IGNORE LEAVES;
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
# This seems to be related to epochs.
|
||||
# We need to check this against an updated version or avoid it.
|
||||
let $ok= "no";
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 40`)
|
||||
{
|
||||
let $cmd= LOAD INDEX INTO CACHE tt_1, tt_2 IGNORE LEAVES;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 39`)
|
||||
{
|
||||
let $cmd= ANALYZE TABLE nt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 38`)
|
||||
{
|
||||
let $cmd= CHECK TABLE nt_1;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 37`)
|
||||
{
|
||||
let $cmd= OPTIMIZE TABLE nt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 36`)
|
||||
{
|
||||
let $cmd= REPAIR TABLE nt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 35`)
|
||||
{
|
||||
let $cmd= LOCK TABLES tt_1 WRITE;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 34`)
|
||||
{
|
||||
let $cmd= UNLOCK TABLES;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 33`)
|
||||
{
|
||||
let $cmd= CREATE USER 'user'@'localhost';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 32`)
|
||||
{
|
||||
let $cmd= GRANT ALL ON *.* TO 'user'@'localhost';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 31`)
|
||||
{
|
||||
let $cmd= SET PASSWORD FOR 'user'@'localhost' = PASSWORD('newpass');
|
||||
#
|
||||
# In NDB (RBR mode), the commit event is the eleventh event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: DDL EVENT which triggered the previous commmit.
|
||||
# 2: BEGIN
|
||||
# 3: TABLE MAP EVENT
|
||||
# 4: ROW EVENT
|
||||
# 5: COMMIT
|
||||
# 6: BEGIN
|
||||
# 7: TABLE MAP EVENT
|
||||
# 8: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 9: ROW EVENT
|
||||
# 10: ROW EVENT
|
||||
# 11: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'`)
|
||||
{
|
||||
let $commit_event_row_number= 11;
|
||||
}
|
||||
#
|
||||
# In NDB (MIXED mode), the commit event is the eighth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: DDL EVENT which triggered the previous commmit.
|
||||
# 2: BEGIN
|
||||
# 3: TABLE MAP EVENT
|
||||
# 4: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 5: ROW EVENT
|
||||
# 6: ROW EVENT
|
||||
# 7: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'`)
|
||||
{
|
||||
let $commit_event_row_number= 7;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 30`)
|
||||
{
|
||||
let $cmd= REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'user'@'localhost';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 29`)
|
||||
{
|
||||
let $cmd= RENAME USER 'user'@'localhost' TO 'user_new'@'localhost';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 28`)
|
||||
{
|
||||
let $cmd= DROP USER 'user_new'@'localhost';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 27`)
|
||||
{
|
||||
let $cmd= CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 26`)
|
||||
{
|
||||
let $cmd= ALTER EVENT evt COMMENT 'evt';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 25`)
|
||||
{
|
||||
let $cmd= DROP EVENT evt;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 24`)
|
||||
{
|
||||
let $cmd= CREATE TRIGGER tr AFTER INSERT ON tt_1 FOR EACH ROW UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 23`)
|
||||
{
|
||||
let $cmd= DROP TRIGGER tr;
|
||||
#
|
||||
# In RBR mode, due to the trigger the tt_2 is also updated:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT
|
||||
# 4: ROW EVENT
|
||||
# 5: COMMIT
|
||||
# 6: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`select @@binlog_format = 'ROW' && '$engine' != 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 5;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 22`)
|
||||
{
|
||||
let $cmd= CREATE FUNCTION fc () RETURNS VARCHAR(64) RETURN "fc";
|
||||
}
|
||||
if (`SELECT $ddl_cases = 21`)
|
||||
{
|
||||
let $cmd= ALTER FUNCTION fc COMMENT 'fc';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 20`)
|
||||
{
|
||||
let $cmd= DROP FUNCTION fc;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 19`)
|
||||
{
|
||||
let $cmd= CREATE PROCEDURE pc () UPDATE tt_2 SET ddl_case = ddl_case WHERE ddl_case= NEW.ddl_case;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 18`)
|
||||
{
|
||||
let $cmd= ALTER PROCEDURE pc COMMENT 'pc';
|
||||
}
|
||||
if (`SELECT $ddl_cases = 17`)
|
||||
{
|
||||
let $cmd= DROP PROCEDURE pc;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 16`)
|
||||
{
|
||||
let $cmd= CREATE VIEW v AS SELECT * FROM tt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 15`)
|
||||
{
|
||||
let $cmd= ALTER VIEW v AS SELECT * FROM tt_1;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 14`)
|
||||
{
|
||||
let $cmd= DROP VIEW v;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 13`)
|
||||
{
|
||||
let $cmd= CREATE INDEX ix ON tt_1(ddl_case);
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
# 7: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 12`)
|
||||
{
|
||||
let $cmd= DROP INDEX ix ON tt_1;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
# 7: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 11`)
|
||||
{
|
||||
let $cmd= CREATE TEMPORARY TABLE tt_xx (a int);
|
||||
let $in_temporary= "yes";
|
||||
# In SBR and MIXED modes, the DDL statement is written to the binary log but
|
||||
# does not commit the current transaction.
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: CREATE TEMPORARY
|
||||
# 3: COMMIT
|
||||
# 4: BEGIN
|
||||
# 5: INSERT
|
||||
# 6: COMMIT
|
||||
#
|
||||
# In RBR the transaction is not committed either and the statement is not
|
||||
# written to the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: COMMIT
|
||||
#
|
||||
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'` )
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
#
|
||||
# In NDB (RBR mode), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format = 'ROW'` )
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
#
|
||||
# In NDB (MIXED mode), the commit event is the nineth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: DDL EVENT which triggered the previous commmit.
|
||||
# 3: COMMIT
|
||||
# 4: BEGIN
|
||||
# 5: TABLE MAP EVENT
|
||||
# 6: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 7: ROW EVENT
|
||||
# 8: ROW EVENT
|
||||
# 9: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` )
|
||||
{
|
||||
let $commit_event_row_number= 9;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 10`)
|
||||
{
|
||||
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
|
||||
#
|
||||
# In MIXED mode, the changes are logged as rows and we have what follows:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: COMMIT
|
||||
# 5: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`select @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
let $commit_event_row_number= 4;
|
||||
}
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 9`)
|
||||
{
|
||||
let $cmd= ALTER TABLE tt_xx RENAME new_tt_xx;
|
||||
#
|
||||
# In MIXED mode, the changes are logged as rows and we have what follows:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: COMMIT
|
||||
# 5: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`select @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
let $commit_event_row_number= 4;
|
||||
}
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 8`)
|
||||
{
|
||||
let $cmd= DROP TEMPORARY TABLE IF EXISTS new_tt_xx;
|
||||
let $in_temporary= "yes";
|
||||
#
|
||||
# In SBR and MIXED modes, the DDL statement is written to the binary log
|
||||
# but does not commit the current transaction:
|
||||
#
|
||||
# In SBR, we have what follows:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: DROP TEMPORARY
|
||||
# 3: COMMIT
|
||||
# 4: BEGIN
|
||||
# 5: INSERT
|
||||
# 6: COMMIT
|
||||
#
|
||||
# In RBR the transaction is not committed either and the statement is not
|
||||
# written to the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: COMMIT
|
||||
#
|
||||
if (`select @@binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
if (`select @@binlog_format = 'ROW'`)
|
||||
{
|
||||
let $commit_event_row_number= 4;
|
||||
}
|
||||
# In MIXED mode, the changes are logged as rows and we have what follows:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: ROW EVENT
|
||||
# 4: DROP TEMPORARY table IF EXISTS
|
||||
# 5: COMMIT
|
||||
#
|
||||
if (`select @@binlog_format = 'MIXED'`)
|
||||
{
|
||||
let $commit_event_row_number= 5;
|
||||
}
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
#
|
||||
# In NDB (MIXED mode), the commit event is the nineth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: DDL EVENT which triggered the previous commmit.
|
||||
# 3: COMMIT
|
||||
# 4: BEGIN
|
||||
# 5: TABLE MAP EVENT
|
||||
# 6: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 7: ROW EVENT
|
||||
# 8: ROW EVENT
|
||||
# 9: COMMIT
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB' && @@binlog_format != 'ROW'` )
|
||||
{
|
||||
let $commit_event_row_number= 9;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 7`)
|
||||
{
|
||||
let $cmd= CREATE TABLE tt_xx (a int);
|
||||
}
|
||||
if (`SELECT $ddl_cases = 6`)
|
||||
{
|
||||
let $cmd= ALTER TABLE tt_xx ADD COLUMN (b int);
|
||||
}
|
||||
if (`SELECT $ddl_cases = 5`)
|
||||
{
|
||||
let $cmd= RENAME TABLE tt_xx TO new_tt_xx;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 4`)
|
||||
{
|
||||
let $cmd= TRUNCATE TABLE new_tt_xx;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 3`)
|
||||
{
|
||||
let $cmd= DROP TABLE IF EXISTS tt_xx, new_tt_xx;
|
||||
}
|
||||
if (`SELECT $ddl_cases = 2`)
|
||||
{
|
||||
let $cmd= CREATE DATABASE db;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
# 7: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
if (`SELECT $ddl_cases = 1`)
|
||||
{
|
||||
let $cmd= DROP DATABASE IF EXISTS db;
|
||||
#
|
||||
# In NDB (RBR and MIXED modes), the commit event is the sixth event
|
||||
# in the binary log:
|
||||
#
|
||||
# 1: BEGIN
|
||||
# 2: TABLE MAP EVENT
|
||||
# 3: TABLE MAP EVENT (ndb_apply_status)
|
||||
# 4: ROW EVENT
|
||||
# 5: ROW EVENT
|
||||
# 6: COMMIT
|
||||
# 7: DDL EVENT which triggered the previous commmit.
|
||||
#
|
||||
if (`SELECT '$engine' = 'NDB'`)
|
||||
{
|
||||
let $commit_event_row_number= 6;
|
||||
}
|
||||
}
|
||||
--eval $cmd
|
||||
--disable_query_log
|
||||
#
|
||||
# When a temporary table is either created or dropped, there is no implicit
|
||||
# commit. The flag in_temporary is used to avoid aborting the test in such
|
||||
# cases. Thus we force the commit.
|
||||
#
|
||||
if (`SELECT $in_temporary = "yes"`)
|
||||
{
|
||||
--eval COMMIT
|
||||
}
|
||||
let $event_commit= query_get_value("SHOW BINLOG EVENTS FROM $first_binlog_position", Info, $commit_event_row_number);
|
||||
if (`SELECT SUBSTRING("$event_commit",1,6) != "COMMIT"`)
|
||||
{
|
||||
if (`SELECT $ok = "yes"`)
|
||||
{
|
||||
--echo it *does not* commit the current transaction.
|
||||
--echo $cmd
|
||||
--echo $event_commit
|
||||
SHOW BINLOG EVENTS;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
--echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
||||
let $binlog_start= $first_binlog_position;
|
||||
--echo -b-b-b-b-b-b-b-b-b-b-b- >> << -b-b-b-b-b-b-b-b-b-b-b-
|
||||
--source include/show_binlog_events.inc
|
||||
--echo -e-e-e-e-e-e-e-e-e-e-e- >> << -e-e-e-e-e-e-e-e-e-e-e-
|
||||
--echo
|
||||
dec $ddl_cases;
|
||||
}
|
||||
SET AUTOCOMMIT= 1;
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CHECK CONSISTENCY
|
||||
--echo ###################################################################################
|
||||
--sync_slave_with_master
|
||||
|
||||
--let $diff_table_1= master:test.tt_1
|
||||
--let $diff_table_2= slave:test.tt_1
|
||||
--source include/diff_tables.inc
|
||||
|
||||
--echo ###################################################################################
|
||||
--echo # CLEAN
|
||||
--echo ###################################################################################
|
||||
connection master;
|
||||
|
||||
DROP TABLE tt_1;
|
||||
DROP TABLE tt_2;
|
||||
DROP TABLE nt_1;
|
||||
|
||||
sync_slave_with_master;
|
188
mysql-test/extra/rpl_tests/rpl_innodb.test
Normal file
188
mysql-test/extra/rpl_tests/rpl_innodb.test
Normal file
@@ -0,0 +1,188 @@
|
||||
#
|
||||
# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
|
||||
#
|
||||
connection master;
|
||||
CREATE TABLE t4 (
|
||||
id INT(5) unsigned NOT NULL auto_increment,
|
||||
name varchar(15) NOT NULL default '',
|
||||
number varchar(35) NOT NULL default 'default',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY unique_rec (name,number)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--disable_warnings
|
||||
LOAD DATA
|
||||
INFILE '../../std_data/loaddata_pair.dat'
|
||||
REPLACE INTO TABLE t4
|
||||
(name,number);
|
||||
--enable_warnings
|
||||
SELECT * FROM t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t4;
|
||||
|
||||
connection master;
|
||||
--disable_warnings
|
||||
LOAD DATA
|
||||
INFILE '../../std_data/loaddata_pair.dat'
|
||||
REPLACE INTO TABLE t4
|
||||
(name,number);
|
||||
--enable_warnings
|
||||
SELECT * FROM t4;
|
||||
|
||||
sync_slave_with_master;
|
||||
SELECT * FROM t4;
|
||||
|
||||
connection master;
|
||||
--disable_query_log
|
||||
DROP TABLE t4;
|
||||
--enable_query_log
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #26418: Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK
|
||||
# on master
|
||||
#
|
||||
#Note Matthias: to be merged to rpl_ddl.test
|
||||
|
||||
--source include/not_ndb_default.inc
|
||||
|
||||
FLUSH LOGS;
|
||||
sync_slave_with_master;
|
||||
FLUSH LOGS;
|
||||
connection master;
|
||||
let $engine_type= "InnoDB";
|
||||
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS mysqltest1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE DATABASE mysqltest1;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp (f1 BIGINT);
|
||||
eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type;
|
||||
SET AUTOCOMMIT = 0;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
|
||||
# We want to verify that the following transactions are written to the
|
||||
# binlog, despite the transaction is rolled back. (They should be
|
||||
# written to the binlog since they contain non-transactional DROP
|
||||
# TEMPORARY TABLE). To see that, we use the auxiliary table t1, which
|
||||
# is transactional (InnoDB) on master and MyISAM on slave. t1 should
|
||||
# be transactional on master so that the insert into t1 does not cause
|
||||
# the transaction to be logged. Since t1 is non-transactional on
|
||||
# slave, the change will not be rolled back, so the inserted rows will
|
||||
# stay in t1 and we can verify that the transaction was replicated.
|
||||
#
|
||||
# Note, however, that the previous explanation is not true for ROW and
|
||||
# MIXED modes as rollback on a transactional table is not written to
|
||||
# the binary log.
|
||||
ALTER TABLE mysqltest1.t1 ENGINE = MyISAM;
|
||||
SHOW CREATE TABLE mysqltest1.t1;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
INSERT INTO mysqltest1.t1 SET f1= 1;
|
||||
DROP TEMPORARY TABLE mysqltest1.tmp;
|
||||
ROLLBACK;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
INSERT INTO mysqltest1.t1 SET f1= 2;
|
||||
CREATE TEMPORARY TABLE mysqltest1.tmp2(a INT);
|
||||
ROLLBACK;
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# Must return no rows here
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
|
||||
sync_slave_with_master;
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp;
|
||||
--error ER_NO_SUCH_TABLE
|
||||
SHOW CREATE TABLE mysqltest1.tmp2;
|
||||
# t1 has two rows here: the transaction not rolled back since t1 uses MyISAM
|
||||
SELECT COUNT(*) FROM mysqltest1.t1;
|
||||
FLUSH LOGS;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
FLUSH LOGS;
|
||||
|
||||
DROP DATABASE mysqltest1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#39675 rename tables on innodb tables with pending
|
||||
--echo # transactions causes slave data issue.
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id INT PRIMARY KEY auto_increment,
|
||||
b INT DEFAULT NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
id INT PRIMARY KEY auto_increment,
|
||||
b INT DEFAULT NULL
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO t1 (b) VALUES (1),(2),(3);
|
||||
|
||||
BEGIN;
|
||||
INSERT INTO t1(b) VALUES (4);
|
||||
|
||||
--echo -------- switch to master1 --------
|
||||
connection master1;
|
||||
--send RENAME TABLE t1 TO t3, t2 TO t1;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
# Need to wait until RENAME is received
|
||||
let $wait_condition=
|
||||
SELECT COUNT(*) = 1 FROM information_schema.processlist
|
||||
WHERE info = "RENAME TABLE t1 TO t3, t2 TO t1" and
|
||||
state = "Waiting for table";
|
||||
--source include/wait_condition.inc
|
||||
|
||||
COMMIT;
|
||||
|
||||
--echo -------- switch to master1 --------
|
||||
connection master1;
|
||||
--reap
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t3;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
--echo -------- switch to slave --------
|
||||
connection slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t3;
|
||||
|
||||
--echo -------- switch to master --------
|
||||
connection master;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t3;
|
||||
|
||||
--echo End of 6.0 tests
|
||||
|
||||
--source include/master-slave-end.inc
|
@@ -38,18 +38,19 @@ connection master;
|
||||
truncate table t1;
|
||||
# first scenario: duplicate on first row
|
||||
insert delayed into t1 values(10, "my name");
|
||||
if ($binlog_format_statement)
|
||||
flush table t1;
|
||||
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
# statement below will be converted to non-delayed INSERT and so
|
||||
# will stop at first error, guaranteeing replication.
|
||||
--error ER_DUP_ENTRY
|
||||
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
||||
}
|
||||
if (!$binlog_format_statement)
|
||||
if (`SELECT @@global.binlog_format != 'STATEMENT'`)
|
||||
{
|
||||
insert delayed into t1 values(10, "is Bond"), (20, "James Bond");
|
||||
}
|
||||
flush table t1; # to wait for INSERT DELAYED to be done
|
||||
flush table t1;
|
||||
select * from t1;
|
||||
sync_slave_with_master;
|
||||
# when bug existed in statement-based binlogging, t1 on slave had
|
||||
@@ -59,7 +60,7 @@ select * from t1;
|
||||
# second scenario: duplicate on second row
|
||||
connection master;
|
||||
delete from t1 where id!=10;
|
||||
if ($binlog_format_statement)
|
||||
if (`SELECT @@global.binlog_format = 'STATEMENT'`)
|
||||
{
|
||||
# statement below will be converted to non-delayed INSERT and so
|
||||
# will be binlogged with its ER_DUP_ENTRY error code, guaranteeing
|
||||
@@ -67,7 +68,7 @@ if ($binlog_format_statement)
|
||||
--error ER_DUP_ENTRY
|
||||
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
||||
}
|
||||
if (!$binlog_format_statement)
|
||||
if (`SELECT @@global.binlog_format != 'STATEMENT'`)
|
||||
{
|
||||
insert delayed into t1 values(20, "is Bond"), (10, "James Bond");
|
||||
}
|
||||
@@ -108,6 +109,7 @@ if (`SELECT @@global.binlog_format != 'ROW'`)
|
||||
{
|
||||
#must show two INSERT DELAYED
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x
|
||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'master-bin.000002' LIMIT 2,2;
|
||||
}
|
||||
select * from t1;
|
||||
@@ -118,6 +120,7 @@ if (`SELECT @@global.binlog_format != 'ROW'`)
|
||||
{
|
||||
#must show two INSERT DELAYED
|
||||
--replace_column 1 x 2 x 3 x 4 x 5 x
|
||||
--replace_regex /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'slave-bin.000002' LIMIT 2,2;
|
||||
}
|
||||
select * from t1;
|
||||
|
@@ -9,6 +9,8 @@
|
||||
# column and index but without primary key.
|
||||
##############################################################
|
||||
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
--echo #
|
||||
--echo # Setup
|
||||
--echo #
|
||||
@@ -117,6 +119,7 @@ sync_slave_with_master;
|
||||
--echo #
|
||||
|
||||
connection master;
|
||||
set @@session.sql_auto_is_null=1;
|
||||
eval create table t1(a int auto_increment, key(a)) engine=$engine_type;
|
||||
eval create table t2(a int) engine=$engine_type;
|
||||
insert into t1 (a) values (null);
|
||||
@@ -179,13 +182,17 @@ begin
|
||||
end|
|
||||
delimiter ;|
|
||||
|
||||
--disable_warnings
|
||||
insert into t1 (last_id) values (0);
|
||||
--enable_warnings
|
||||
|
||||
drop trigger t1_bi;
|
||||
|
||||
# Check that nested call doesn't affect outer context.
|
||||
select last_insert_id();
|
||||
--disable_warnings
|
||||
select bug15728_insert();
|
||||
--enable_warnings
|
||||
select last_insert_id();
|
||||
insert into t1 (last_id) values (bug15728());
|
||||
# This should be exactly one greater than in the previous call.
|
||||
@@ -438,7 +445,9 @@ delimiter ;|
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, -1);
|
||||
CALL p1();
|
||||
--disable_warnings
|
||||
SELECT f1();
|
||||
--enable_warnings
|
||||
INSERT INTO t1 VALUES (NULL, f2()), (NULL, LAST_INSERT_ID()),
|
||||
(NULL, LAST_INSERT_ID()), (NULL, f2()), (NULL, f2());
|
||||
INSERT INTO t1 VALUES (NULL, f2());
|
||||
@@ -507,12 +516,16 @@ insert into t2 (id) values(1),(2),(3);
|
||||
delete from t2;
|
||||
set sql_log_bin=1;
|
||||
#inside SELECT, then inside INSERT
|
||||
--disable_warnings
|
||||
select insid();
|
||||
--enable_warnings
|
||||
set sql_log_bin=0;
|
||||
insert into t2 (id) values(5),(6),(7);
|
||||
delete from t2 where id>=5;
|
||||
set sql_log_bin=1;
|
||||
--disable_warnings
|
||||
insert into t1 select insid();
|
||||
--enable_warnings
|
||||
select * from t1 order by id;
|
||||
select * from t2 order by id;
|
||||
|
||||
@@ -548,4 +561,5 @@ connection master;
|
||||
drop table t1, t2;
|
||||
drop procedure foo;
|
||||
SET @@global.concurrent_insert= @old_concurrent_insert;
|
||||
set @@session.sql_auto_is_null=default;
|
||||
sync_slave_with_master;
|
||||
|
@@ -55,7 +55,9 @@ INSERT INTO t1 VALUES (2, 2);
|
||||
INSERT INTO t1 VALUES (3, 3);
|
||||
INSERT INTO t1 VALUES (4, 4);
|
||||
|
||||
--disable_warnings
|
||||
INSERT IGNORE INTO t1 SELECT NULL, t2.b FROM t2 ORDER BY t2.a;
|
||||
--enable_warnings
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
|
||||
|
@@ -1,6 +1,3 @@
|
||||
# Requires statement logging
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
|
||||
# See if replication of a "LOAD DATA in an autoincrement column"
|
||||
# Honours autoincrement values
|
||||
# i.e. if the master and slave have the same sequence
|
||||
@@ -163,8 +160,11 @@ eval $lower_stmt_head infile '../../std_data/rpl_loaddata2.dat' into table t2 fi
|
||||
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
|
||||
'\n##\n' starting by '>' ignore 1 lines;
|
||||
connection slave;
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
drop table t1, t2;
|
||||
if (`SELECT @@global.binlog_format != 'ROW'`)
|
||||
{
|
||||
--source include/wait_for_slave_sql_to_stop.inc
|
||||
drop table t1, t2;
|
||||
}
|
||||
connection master;
|
||||
drop table t1, t2;
|
||||
|
||||
|
@@ -43,7 +43,7 @@ show binlog events from 107 limit 1;
|
||||
show binlog events from 107 limit 2;
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events from 107 limit 2,1;
|
||||
show binlog events from 107 limit 1,4;
|
||||
flush logs;
|
||||
|
||||
# We need an extra update before doing save_master_pos.
|
||||
@@ -104,7 +104,7 @@ show binlog events in 'slave-bin.000001' from 4;
|
||||
--replace_column 2 # 5 #
|
||||
--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/
|
||||
show binlog events in 'slave-bin.000002' from 4;
|
||||
source include/show_slave_status.inc;
|
||||
source include/show_slave_status2.inc;
|
||||
|
||||
# Need to recode the following
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -141,7 +141,9 @@ let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--disable_warnings
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
--enable_warnings
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
@@ -190,7 +192,9 @@ let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--disable_warnings
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
--enable_warnings
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
@@ -240,7 +244,9 @@ let $run= 5;
|
||||
while ($run)
|
||||
{
|
||||
START TRANSACTION;
|
||||
--disable_warnings
|
||||
--eval CALL tpcb.trans($rpl_format);
|
||||
--enable_warnings
|
||||
eval SET @my_errno= $mysql_errno;
|
||||
let $run_good= `SELECT @my_errno = 0`;
|
||||
let $run_bad= `SELECT @my_errno <> 0`;
|
||||
|
@@ -22,6 +22,7 @@ source include/show_slave_status2.inc;
|
||||
reset slave;
|
||||
source include/show_slave_status2.inc;
|
||||
|
||||
change master to master_user='root';
|
||||
start slave;
|
||||
sync_with_master;
|
||||
source include/show_slave_status2.inc;
|
||||
|
@@ -6,6 +6,7 @@
|
||||
# First we test tables with only an index.
|
||||
#
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (C1 CHAR(1), C2 CHAR(1), INDEX (C1)$extra_index_t1) ENGINE = $type ;
|
||||
SELECT * FROM t1;
|
||||
sync_slave_with_master;
|
||||
@@ -156,6 +157,12 @@ SELECT * FROM t5,t2,t3 WHERE t5.C2='Q' AND t2.c12='R' AND t3.C3 ='S' ORDER BY t5
|
||||
# Testing special column types
|
||||
#
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
|
||||
connection slave;
|
||||
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
|
||||
}
|
||||
|
||||
connection master;
|
||||
eval CREATE TABLE t4 (C1 CHAR(1) PRIMARY KEY, B1 BIT(1), B2 BIT(1) NOT NULL DEFAULT 0, C2 CHAR(1) NOT NULL DEFAULT 'A') ENGINE = $type ;
|
||||
|
||||
@@ -164,6 +171,10 @@ SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
sync_slave_with_master;
|
||||
SELECT C1,HEX(B1),HEX(B2) FROM t4 ORDER BY C1;
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
}
|
||||
|
||||
#
|
||||
# Testing conflicting operations
|
||||
#
|
||||
@@ -350,6 +361,10 @@ eval CREATE TABLE t7 (i INT NOT NULL,
|
||||
c CHAR(255) CHARACTER SET utf8 NOT NULL,
|
||||
j INT NOT NULL) ENGINE = $type ;
|
||||
|
||||
connection slave;
|
||||
SET @saved_slave_type_conversions = @@slave_type_conversions;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
|
||||
|
||||
--echo [expecting slave to replicate correctly]
|
||||
connection master;
|
||||
INSERT INTO t1 VALUES (1, "", 1);
|
||||
@@ -370,17 +385,9 @@ let $diff_table_1=master:test.t2;
|
||||
let $diff_table_2=slave:test.t2;
|
||||
source include/diff_tables.inc;
|
||||
|
||||
--echo [expecting slave to stop]
|
||||
connection master;
|
||||
INSERT INTO t3 VALUES (1, "", 1);
|
||||
INSERT INTO t3 VALUES (2, repeat(_utf8'a', 128), 2);
|
||||
|
||||
connection slave;
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
let $last_error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
disable_query_log;
|
||||
eval SELECT "$last_error" AS Last_SQL_Error;
|
||||
enable_query_log;
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
connection slave;
|
||||
@@ -600,7 +607,15 @@ sync_slave_with_master;
|
||||
|
||||
connection master;
|
||||
|
||||
# Since t1 contain a bit field, we have to do this trick to handle InnoDB
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET @saved_slave_type_conversions = @@SLAVE_TYPE_CONVERSIONS;
|
||||
connection slave;
|
||||
eval SET GLOBAL SLAVE_TYPE_CONVERSIONS = '$bit_field_special';
|
||||
}
|
||||
|
||||
--disable_warnings
|
||||
connection master;
|
||||
eval CREATE TABLE t1 (a bit) ENGINE=$type;
|
||||
INSERT IGNORE INTO t1 VALUES (NULL);
|
||||
INSERT INTO t1 ( a ) VALUES ( 0 );
|
||||
@@ -645,6 +660,10 @@ UPDATE t1 SET a = 9 WHERE a < 5 LIMIT 3;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
if (`select char_length('$bit_field_special') > 0`) {
|
||||
SET GLOBAL SLAVE_TYPE_CONVERSIONS = @saved_slave_type_conversions;
|
||||
}
|
||||
|
||||
let $diff_table_1=master:test.t1;
|
||||
let $diff_table_2=slave:test.t1;
|
||||
source include/diff_tables.inc;
|
||||
|
@@ -36,7 +36,7 @@ SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
--echo
|
||||
--echo **** Data Insert Validation Slave Section test.t1 ****
|
||||
--echo
|
||||
@@ -56,12 +56,10 @@ UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
|
||||
--echo
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
|
||||
SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
|
||||
# Sleep is needed for NDB to allow time for
|
||||
# Injector thread to populate the bin log.
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
--echo
|
||||
--echo **** Data Update Validation Slave Section test.t1 ****
|
||||
--echo
|
||||
@@ -132,7 +130,7 @@ FROM test.t2 WHERE c1=2;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
--echo
|
||||
--echo **** Data Insert Validation Slave Section test.t2 ****
|
||||
--echo
|
||||
@@ -155,12 +153,10 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=1;
|
||||
SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
|
||||
FROM test.t2 WHERE c1=2;
|
||||
# Sleep is needed for NDB to allow time for
|
||||
# Injector thread to populate the bin log.
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
sleep 5;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
--echo
|
||||
--echo **** Data Update Validation Slave Section test.t2 ****
|
||||
--echo
|
||||
|
@@ -3,10 +3,7 @@
|
||||
# Original Date: Aug/15/2005 #
|
||||
# Update: 08/29/2005 Comment out sleep. Only needed for debugging #
|
||||
#############################################################################
|
||||
# Note: Many lines are commented out in this test case. These were used for #
|
||||
# creating the test case and debugging and are being left for #
|
||||
# debugging, but they can not be used for the regular testing as the #
|
||||
# Time changes and is not deteministic, so instead we dump both the #
|
||||
# Note: Time changes and is not deteministic, so instead we dump both the #
|
||||
# master and slave and diff the dumps. If the dumps differ then the #
|
||||
# test case will fail. To run during diff failuers, comment out the #
|
||||
# diff. #
|
||||
@@ -28,7 +25,6 @@ DROP TABLE IF EXISTS test.t1;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
|
||||
eval CREATE TABLE test.t1 (a INT NOT NULL AUTO_INCREMENT, c CHAR(16),PRIMARY KEY(a))ENGINE=$engine_type;
|
||||
|
||||
delimiter |;
|
||||
@@ -47,17 +43,9 @@ delimiter ;|
|
||||
|
||||
--disable_warnings
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
INSERT INTO test.t1 VALUES (null,test.f1()),(null,test.f1()),(null,test.f1());
|
||||
sleep 6;
|
||||
--enable_warnings
|
||||
|
||||
#Select in this test are used for debugging
|
||||
#select * from test.t1;
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
|
||||
connection master;
|
||||
SET AUTOCOMMIT=0;
|
||||
START TRANSACTION;
|
||||
--disable_warnings
|
||||
@@ -65,18 +53,17 @@ INSERT INTO test.t1 VALUES (null,test.f1());
|
||||
--enable_warnings
|
||||
ROLLBACK;
|
||||
SET AUTOCOMMIT=1;
|
||||
#select * from test.t1;
|
||||
#sleep 6;
|
||||
|
||||
#connection slave;
|
||||
#select * from test.t1;
|
||||
# Sync master and slave for all engines except NDB
|
||||
if (`SELECT UPPER(LEFT('$engine_type', 3)) != 'NDB'`) {
|
||||
sync_slave_with_master;
|
||||
connection master;
|
||||
}
|
||||
# Sync master and slave for NDB engine
|
||||
let $wait_time= 6;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
|
||||
#connection master;
|
||||
|
||||
#used for debugging
|
||||
#show binlog events;
|
||||
|
||||
# time to dump the databases and so we can see if they match
|
||||
# Time to dump the databases and so we can see if they match
|
||||
|
||||
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_master.sql
|
||||
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/func003_slave.sql
|
||||
@@ -93,5 +80,8 @@ DROP TABLE test.t1;
|
||||
|
||||
diff_files $MYSQLTEST_VARDIR/tmp/func003_master.sql $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
|
||||
|
||||
# Clean up
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/func003_master.sql;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/func003_slave.sql;
|
||||
|
||||
# End of 5.0 test case
|
||||
|
@@ -41,10 +41,7 @@ CALL test.p2();
|
||||
SELECT release_lock("test");
|
||||
SELECT * FROM test.t1;
|
||||
#show binlog events;
|
||||
# Added sleep for use with NDB to ensure that
|
||||
# the injector thread will populate log before
|
||||
# we switch to the slave.
|
||||
sleep 5;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM test.t1;
|
||||
|
@@ -23,7 +23,7 @@ let $binary_log_limit_row= 3;
|
||||
|
||||
-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
|
||||
let $binary_log_file= ;
|
||||
let $binary_log_limit_row= 3;
|
||||
let $binary_log_limit_row= 4;
|
||||
let $binary_log_limit_offset= 1;
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
@@ -49,7 +49,7 @@ let $binary_log_limit_row= 3;
|
||||
|
||||
-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows *********
|
||||
let $binary_log_file= ;
|
||||
let $binary_log_limit_row= 3;
|
||||
let $binary_log_limit_row= 4;
|
||||
let $binary_log_limit_offset= 1;
|
||||
-- source include/show_binlog_events.inc
|
||||
|
||||
|
125
mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
Normal file
125
mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
Normal file
@@ -0,0 +1,125 @@
|
||||
#
|
||||
# Bug#6148 ()
|
||||
#
|
||||
# Let the master do lots of insertions
|
||||
|
||||
connection master;
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
connection slave;
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
sync_slave_with_master;
|
||||
stop slave;
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
connection master;
|
||||
let $1=5000;
|
||||
disable_query_log;
|
||||
while ($1)
|
||||
{
|
||||
eval insert into t1 values($1);
|
||||
dec $1;
|
||||
}
|
||||
enable_query_log;
|
||||
save_master_pos;
|
||||
|
||||
connection slave;
|
||||
start slave;
|
||||
let $wait_condition= SELECT COUNT(*) > 0 FROM t1;
|
||||
source include/wait_condition.inc;
|
||||
stop slave io_thread;
|
||||
start slave io_thread;
|
||||
source include/wait_for_slave_to_start.inc;
|
||||
sync_with_master;
|
||||
|
||||
connection master;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
|
||||
#
|
||||
# Bug#38205 Row-based Replication (RBR) causes inconsistencies...
|
||||
# Bug#319 if while a non-transactional slave is replicating a transaction...
|
||||
#
|
||||
# Verifying that STOP SLAVE does not interrupt excution of a group
|
||||
# execution of events if the group can not roll back.
|
||||
# Killing the sql thread continues to provide a "hard" stop (the
|
||||
# part II, moved to the bugs suite as it's hard to make it
|
||||
# deterministic with KILL).
|
||||
#
|
||||
|
||||
#
|
||||
# Part I. The being stopped sql thread finishes first the current group of
|
||||
# events if the group contains an event on a non-transaction table.
|
||||
|
||||
connection master;
|
||||
create table t1i(n int primary key) engine=innodb;
|
||||
create table t2m(n int primary key) engine=myisam;
|
||||
begin;
|
||||
insert into t1i values (1);
|
||||
insert into t1i values (2);
|
||||
insert into t1i values (3);
|
||||
commit;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
begin;
|
||||
insert into t1i values (5);
|
||||
|
||||
connection master;
|
||||
let $pos0_master= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
begin;
|
||||
insert into t1i values (4);
|
||||
insert into t2m values (1); # non-ta update to process
|
||||
insert into t1i values (5); # to block at. to be played with stopped
|
||||
commit;
|
||||
|
||||
connection slave;
|
||||
# slave sql thread must be locked out by the conn `slave' explicit lock
|
||||
let $pos0_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
--disable_query_log
|
||||
eval select $pos0_master - $pos0_slave as zero;
|
||||
--enable_query_log
|
||||
|
||||
connection slave1;
|
||||
let $count= 1;
|
||||
let $table= t2m;
|
||||
source include/wait_until_rows_count.inc;
|
||||
send stop slave;
|
||||
|
||||
connection slave;
|
||||
rollback; # release the sql thread
|
||||
|
||||
connection slave1;
|
||||
reap;
|
||||
source include/wait_for_slave_to_stop.inc;
|
||||
let $sql_status= query_get_value(SHOW SLAVE STATUS, Slave_SQL_Running, 1);
|
||||
--echo *** sql thread is *not* running: $sql_status ***
|
||||
|
||||
|
||||
connection master;
|
||||
let $pos1_master= query_get_value(SHOW MASTER STATUS, Position, 1);
|
||||
|
||||
connection slave;
|
||||
|
||||
let $pos1_slave= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
|
||||
|
||||
--echo *** the prove: the stopped slave has finished the current transaction ***
|
||||
|
||||
--disable_query_log
|
||||
select count(*) as five from t1i;
|
||||
eval select $pos1_master - $pos1_slave as zero;
|
||||
eval select $pos1_slave > $pos0_slave as one;
|
||||
--enable_query_log
|
||||
|
||||
source include/start_slave.inc;
|
||||
|
||||
# clean-up
|
||||
connection master;
|
||||
drop table t1i, t2m;
|
||||
|
||||
sync_slave_with_master;
|
||||
|
||||
# End of tests
|
@@ -3,7 +3,7 @@
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
CALL mtr.add_suppression("Statement may not be safe to log in statement format.");
|
||||
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
# Load some data into t1
|
||||
create table t1 (word char(20) not null);
|
||||
@@ -67,8 +67,8 @@ enable_query_log;
|
||||
connection slave;
|
||||
lock tables t1 read;
|
||||
start slave;
|
||||
#hope this is long enough for I/O thread to fetch over 16K relay log data
|
||||
sleep 3;
|
||||
connection master;
|
||||
--source include/sync_slave_io_with_master.inc
|
||||
unlock tables;
|
||||
|
||||
#test handling of aborted connection in the middle of update
|
||||
|
147
mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
Normal file
147
mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
Normal file
@@ -0,0 +1,147 @@
|
||||
# Proving that stopping in the middle of applying a group of events
|
||||
# does not have immediate effect if a non-transaction table has been changed.
|
||||
# The slave sql thread has to try to finish applying first.
|
||||
# The tests rely on simulation of the killed status.
|
||||
# The matter of testing correlates to some of `rpl_start_stop_slave' that does
|
||||
# not require `have_debug'.
|
||||
|
||||
connection master;
|
||||
|
||||
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
|
||||
|
||||
create table tm (a int auto_increment primary key) engine=myisam;
|
||||
create table ti (a int auto_increment primary key) engine=innodb;
|
||||
|
||||
sync_slave_with_master;
|
||||
set @@global.debug="+d,stop_slave_middle_group";
|
||||
|
||||
connection master;
|
||||
|
||||
begin;
|
||||
insert into ti set a=null;
|
||||
insert into tm set a=null; # to simulate killed status on the slave
|
||||
commit;
|
||||
|
||||
connection slave;
|
||||
|
||||
# slave will catch the killed status but won't shut down immediately
|
||||
# only after the whole group has done (commit)
|
||||
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
# checking: no error and the group is finished
|
||||
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
|
||||
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
|
||||
--disable_query_log
|
||||
eval SELECT $read = $exec into @check;
|
||||
--enable_query_log
|
||||
eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
|
||||
select count(*) as one from tm;
|
||||
select count(*) as one from ti;
|
||||
|
||||
set @@global.debug="-d";
|
||||
|
||||
#
|
||||
# bug#45940 issues around rli->last_event_start_time
|
||||
# Testing of slave stopped after it had waited (in vain) for
|
||||
# the group be finished.
|
||||
# It could not be finished because of simulation of failure to
|
||||
# receive the terminal part
|
||||
# The test relay on simulation of the incomplete group in the relay log
|
||||
|
||||
# Two cases are verified: a mixed transacton and a mixed multi-table update.
|
||||
#
|
||||
# The mixed transacton.
|
||||
#
|
||||
source include/start_slave.inc;
|
||||
|
||||
connection master;
|
||||
|
||||
truncate table tm; # cleanup of former tests
|
||||
truncate table ti;
|
||||
|
||||
#connection slave;
|
||||
sync_slave_with_master;
|
||||
|
||||
set @@global.debug="+d,stop_slave_middle_group";
|
||||
set @@global.debug="+d,incomplete_group_in_relay_log";
|
||||
|
||||
connection master;
|
||||
|
||||
begin;
|
||||
insert into ti set a=null;
|
||||
insert into tm set a=null;
|
||||
commit;
|
||||
|
||||
connection slave;
|
||||
|
||||
# slave will catch the killed status, won't shut down immediately
|
||||
# but does it eventually having the whole group unfinished (not committed)
|
||||
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
# checking: the error and group unfinished
|
||||
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
|
||||
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
|
||||
--disable_query_log
|
||||
eval SELECT $read - $exec > 0 into @check;
|
||||
--enable_query_log
|
||||
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
|
||||
select count(*) as one from tm;
|
||||
select count(*) as zero from ti;
|
||||
|
||||
set @@global.debug="-d";
|
||||
|
||||
#
|
||||
# The mixed multi-table update
|
||||
#
|
||||
stop slave;
|
||||
truncate table tm;
|
||||
source include/start_slave.inc;
|
||||
|
||||
connection master;
|
||||
|
||||
#connection slave;
|
||||
sync_slave_with_master;
|
||||
set @@global.debug="+d,stop_slave_middle_group";
|
||||
set @@global.debug="+d,incomplete_group_in_relay_log";
|
||||
|
||||
connection master;
|
||||
update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
|
||||
|
||||
connection slave;
|
||||
|
||||
# slave will catch the killed status, won't shut down immediately
|
||||
# but does it eventually having the whole group unfinished (not committed)
|
||||
#
|
||||
|
||||
source include/wait_for_slave_sql_to_stop.inc;
|
||||
|
||||
# checking: the error and group unfinished
|
||||
|
||||
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
|
||||
let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
|
||||
let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
|
||||
--disable_query_log
|
||||
eval SELECT $read - $exec > 0 into @check;
|
||||
--enable_query_log
|
||||
eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
|
||||
select max(a) as two from tm;
|
||||
select max(a) as one from ti;
|
||||
|
||||
set @@global.debug="-d";
|
||||
|
||||
#
|
||||
# clean-up
|
||||
#
|
||||
|
||||
connection master;
|
||||
drop table tm, ti;
|
||||
|
||||
connection slave; # slave SQL thread is stopped
|
||||
source include/stop_slave.inc;
|
||||
drop table tm, ti;
|
@@ -35,9 +35,8 @@ INSERT INTO test.t2 VALUES (1, 0.0);
|
||||
#show binlog events;
|
||||
select * from test.t1;
|
||||
select * from test.t2;
|
||||
# Have to sleep for a few seconds to allow
|
||||
# NDB injector thread to populate binlog
|
||||
sleep 10;
|
||||
let $wait_time= 10;
|
||||
--source include/wait_for_ndb_to_binlog.inc
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
select * from test.t1;
|
||||
|
882
mysql-test/extra/rpl_tests/type_conversions.test
Normal file
882
mysql-test/extra/rpl_tests/type_conversions.test
Normal file
@@ -0,0 +1,882 @@
|
||||
# File containing different lossy and non-lossy type conversions.
|
||||
|
||||
# Integral conversion testing, we do not reduce the test using
|
||||
# transitivity of conversions since the implementation is not using a
|
||||
# transitivity strategy. Instead we do an exhaustive testing.
|
||||
|
||||
disable_query_log;
|
||||
connection slave;
|
||||
--let $conv = `select @@slave_type_conversions`
|
||||
--echo **** Running tests with @@SLAVE_TYPE_CONVERSIONS = '$conv' ****
|
||||
|
||||
let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
|
||||
let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`;
|
||||
|
||||
# TINYBLOB
|
||||
|
||||
let $source_type = TINYBLOB;
|
||||
let $target_type = TINYBLOB;
|
||||
let $source_value = 'aaa';
|
||||
let $target_value = 'aaa';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYBLOB;
|
||||
let $target_type= BLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYBLOB;
|
||||
let $target_type= MEDIUMBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYBLOB;
|
||||
let $target_type= LONGBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
# BLOB
|
||||
|
||||
let $source_type = BLOB;
|
||||
let $target_type = TINYBLOB;
|
||||
let $source_value = 'aaa';
|
||||
let $target_value = 'aaa';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BLOB;
|
||||
let $target_type= BLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BLOB;
|
||||
let $target_type= MEDIUMBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BLOB;
|
||||
let $target_type= LONGBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
# MEDIUMBLOB
|
||||
|
||||
let $source_type = MEDIUMBLOB;
|
||||
let $target_type = TINYBLOB;
|
||||
let $source_value = 'aaa';
|
||||
let $target_value = 'aaa';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMBLOB;
|
||||
let $target_type= BLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMBLOB;
|
||||
let $target_type= MEDIUMBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMBLOB;
|
||||
let $target_type= LONGBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
# LONGBLOB
|
||||
|
||||
let $source_type = LONGBLOB;
|
||||
let $target_type = TINYBLOB;
|
||||
let $source_value = 'aaa';
|
||||
let $target_value = 'aaa';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGBLOB;
|
||||
let $target_type= BLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGBLOB;
|
||||
let $target_type= MEDIUMBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGBLOB;
|
||||
let $target_type= LONGBLOB;
|
||||
let $source_value= 'aaa';
|
||||
let $target_value= 'aaa';
|
||||
let $can_convert= 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
# BUG#49836 (additional tests - GEOMETRY TYPE)
|
||||
|
||||
let $source_type = GEOMETRY;
|
||||
let $target_type = BLOB;
|
||||
let $source_value = PointFromText('POINT(10 10)');
|
||||
let $target_value = PointFromText('POINT(10 10)');
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = BLOB;
|
||||
let $target_type = GEOMETRY;
|
||||
let $source_value = 'aaa';
|
||||
let $target_value = 'aaa';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = GEOMETRY;
|
||||
let $target_type = GEOMETRY;
|
||||
let $source_value = PointFromText('POINT(10 10)');
|
||||
let $target_value = PointFromText('POINT(10 10)');
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = BIT(1);
|
||||
let $target_type = BIT(1);
|
||||
let $source_value = b'1';
|
||||
let $target_value = b'1';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = DATE;
|
||||
let $target_type = DATE;
|
||||
let $source_value = '2009-11-21';
|
||||
let $target_value = '2009-11-21';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = ENUM('master','slave');
|
||||
let $target_type = ENUM('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = CHAR(10);
|
||||
let $target_type = ENUM('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = CHAR(10);
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = ENUM('master','slave');
|
||||
let $target_type = CHAR(10);
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = CHAR(10);
|
||||
let $source_value = 'master';
|
||||
let $target_value = 'master';
|
||||
let $can_convert = 0;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = '';
|
||||
let $target_value = '';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('master','slave');
|
||||
let $target_type = SET('master','slave');
|
||||
let $source_value = 'master,slave';
|
||||
let $target_value = 'master,slave';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('0','1','2','3','4','5','6');
|
||||
let $target_type = SET('0','1','2','3','4','5','6');
|
||||
let $source_value = '5';
|
||||
let $target_value = '5';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('0','1','2','3','4','5','6');
|
||||
let $target_type = SET('0','1','2','3','4','5','6','7','8','9','10');
|
||||
let $source_value = '5';
|
||||
let $target_value = '5';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
|
||||
let $target_type = SET('0','1','2','3','4','5','6');
|
||||
let $source_value = '5';
|
||||
let $target_value = '5';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = SET('0','1','2','3','4','5','6','7','8','9','10');
|
||||
let $target_type = SET('0','1','2','3','4','5','6');
|
||||
let $source_value = '7';
|
||||
let $target_value = '';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = TINYINT;
|
||||
let $target_type = TINYINT;
|
||||
let $source_value = 1;
|
||||
let $target_value = 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type = TINYINT;
|
||||
let $target_type = SMALLINT;
|
||||
let $source_value = 1;
|
||||
let $target_value = 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1 << 9;
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= 1 << 9;
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= SMALLINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1 << 20;
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= 1 << 20;
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= (1 << 30);
|
||||
let $target_value= (1 << 7) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= TINYINT UNSIGNED;
|
||||
let $source_value= (1 << 30);
|
||||
let $target_value= (1 << 8) - 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= INT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= TINYINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= SMALLINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= MEDIUMINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= INT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIGINT;
|
||||
let $target_type= BIGINT;
|
||||
let $source_value= 1;
|
||||
let $target_value= 1;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= CHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= VARCHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= CHAR(20);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(20);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= VARCHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= CHAR(30);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= CHAR(10);
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnood';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(20);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= 'Smoothnoodlemaps';
|
||||
let $target_value= 'Smoothnoodlemaps';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $blob = `select repeat('abcd', 125)`;
|
||||
let $truncated_blob = `select left('$blob', 255)`;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(510);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= VARCHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$truncated_blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$truncated_blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= TEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= MEDIUMTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= VARCHAR(500);
|
||||
let $target_type= LONGTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $tiny_blob = `select repeat('tiny blob ', 25)`;
|
||||
let $truncated_tiny_blob = `select left('$tiny_blob', 254)`;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGTEXT;
|
||||
let $target_type= VARCHAR(500);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= '$blob';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= CHAR(250);
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= left('$tiny_blob', 250);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= MEDIUMTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= LONGTEXT;
|
||||
let $target_type= CHAR(255);
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob', 255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TINYTEXT;
|
||||
let $target_type= TEXT;
|
||||
let $source_value= '$tiny_blob';
|
||||
let $target_value= '$tiny_blob';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= TEXT;
|
||||
let $target_type= TINYTEXT;
|
||||
let $source_value= '$blob';
|
||||
let $target_value= left('$blob',255);
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,6);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.141590;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(11,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(11,6);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.141590;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(10,4);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.1416;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(9,5);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.14159;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DECIMAL(9,4);
|
||||
let $source_value= 3.14159;
|
||||
let $target_value= 3.1416;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= DECIMAL(10,5);
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DECIMAL(10,5);
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= FLOAT;
|
||||
let $target_type= DOUBLE;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= DOUBLE;
|
||||
let $target_type= FLOAT;
|
||||
let $source_value= 3.15625;
|
||||
let $target_value= 3.15625;
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = 1;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(6);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(6);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'111001';
|
||||
let $target_value= b'11111';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(5);
|
||||
let $target_type= BIT(12);
|
||||
let $source_value= b'11001';
|
||||
let $target_value= b'11001';
|
||||
let $can_convert = $if_is_non_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
let $source_type= BIT(12);
|
||||
let $target_type= BIT(5);
|
||||
let $source_value= b'101100111000';
|
||||
let $target_value= b'11111';
|
||||
let $can_convert = $if_is_lossy;
|
||||
source extra/rpl_tests/check_type.inc;
|
||||
|
||||
|
||||
disable_warnings;
|
||||
source include/reset_master_and_slave.inc;
|
||||
enable_warnings;
|
||||
enable_query_log;
|
Reference in New Issue
Block a user