Auto-merge from mysql-next-mr.

This commit is contained in:
Alexander Nozdrin 2010-01-18 22:47:19 +03:00
commit 6060c8d3c1
352 changed files with 56804 additions and 12061 deletions

View file

@ -392,6 +392,7 @@ client/rpl_record_old.h
client/rpl_tblmap.h
client/rpl_tblmap.cc
client/rpl_utility.h
client/rpl_utility.cc
client/select_test
client/sql_string.cpp
client/ssl_test
@ -1143,6 +1144,7 @@ libmysqld/rpl_handler.cc
libmysqld/rpl_injector.cc
libmysqld/rpl_record.cc
libmysqld/rpl_record_old.cc
libmysqld/rpl_utility.cc
libmysqld/scheduler.cc
libmysqld/set_var.cc
libmysqld/simple-test

View file

@ -104,9 +104,10 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS \
-DMYSQL_DATADIR="\"$(localstatedir)\""
sql_src=log_event.h mysql_priv.h rpl_constants.h \
rpl_utility.h rpl_tblmap.h rpl_tblmap.cc \
rpl_tblmap.h rpl_tblmap.cc \
log_event.cc my_decimal.h my_decimal.cc \
log_event_old.h log_event_old.cc \
rpl_utility.h rpl_utility.cc \
rpl_record_old.h rpl_record_old.cc
strings_src=decimal.c dtoa.c

View file

@ -2140,4 +2140,4 @@ int main(int argc, char** argv)
#include "my_decimal.cc"
#include "log_event.cc"
#include "log_event_old.cc"
#include "rpl_utility.cc"

View file

@ -117,6 +117,12 @@ enum enum_server_command
thread */
#define REFRESH_MASTER 128 /* Remove all bin logs in the index
and truncate the index */
#define REFRESH_ERROR_LOG 256 /* Rotate only the erorr log */
#define REFRESH_ENGINE_LOG 512 /* Flush all storage engine logs */
#define REFRESH_BINARY_LOG 1024 /* Flush the binary log */
#define REFRESH_RELAY_LOG 2048 /* Flush the relay log */
#define REFRESH_GENERAL_LOG 4096 /* Flush the general log */
#define REFRESH_SLOW_LOG 8192 /* Flush the slow query log */
/* The following can't be set with mysql_refresh() */
#define REFRESH_READ_LOCK 16384 /* Lock tables for read */

View file

@ -56,7 +56,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
item_geofunc.cc item_subselect.cc item_row.cc\
item_xmlfunc.cc \
key.cc lock.cc log.cc sql_state.c \
log_event.cc rpl_record.cc \
log_event.cc rpl_record.cc rpl_utility.cc \
log_event_old.cc rpl_record_old.cc \
protocol.cc net_serv.cc opt_range.cc \
opt_sum.cc procedure.cc records.cc sql_acl.cc \

View file

@ -1,5 +1,5 @@
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1

View file

@ -1,5 +1,5 @@
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --ps-protocol --mysqld=--binlog-format=row --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-emebbed --embedded --suite=main,binlog,innodb,federated,rpl,sys_vars,perfschema
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog
perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1

View file

@ -1,300 +0,0 @@
################################################################################
# Let
# - B be begin, C commit and R rollback.
# - T a statement that accesses and changes only transactional tables, i.e.
# T-tables
# - N a statement that accesses and changes only non-transactional tables,
# i.e, N-tables.
# - M be a mixed statement, i.e. a statement that updates both T- and
# N-tables.
# - M* be a mixed statement that fails while updating either a T
# or N-table.
# - N* be a statement that fails while updating a N-table.
#
# In this test case, when changes are logged as rows either in the RBR or MIXED
# modes, we check if a M* statement that happens early in a transaction is
# written to the binary log outside the boundaries of the transaction and
# wrapped up in a BEGIN/ROLLBACK. This is done to keep the slave consistent with
# the master as the rollback will keep the changes on N-tables and undo them on
# T-tables. In particular, we expect the following behavior:
#
# 1. B M* T C would generate in the binlog B M* R B T C.
# 2. B M M* C would generate in the binlog B M M* C.
# 3. B M* M* T C would generate in the binlog B M* R B M* R B T C.
#
# SBR is not considered in this test because a failing statement is written to
# the binary along with the error code such that a slave executes and rolls it
# back, thus undoing the effects on T-tables.
#
# Note that, in the first case, we are not preserving history from the master as
# we are introducing a rollback that never happened. However, this seems to be
# more acceptable than making the slave diverge. In the second case, the slave
# will diverge as the changes on T-tables that originated from the M statement
# are rolled back on the master but not on the slave. Unfortunately, we cannot
# simply roll the transaction back as this would undo any uncommitted changes
# on T-tables.
#
# We check two more cases. First, INSERT...SELECT* which produces the following
# results:
#
# 1. B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
# the binlog the following entries: "Nothing".
# 2. B INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates in
# the binlog the following entries: B INSERT M...SELECT* R.
#
# Finally, we also check if any N statement that happens early in a transaction
# (i.e. before any T or M statement) is written to the binary log outside the
# boundaries of the transaction. In particular, we expect the following
# behavior:
#
# 1. B N N T C would generate in the binlog B N C B N C B T C.
# 2. B N N T R would generate in the binlog B N C B N C B T R.
# 3. B N* N* T C would generate in the binlog B N R B N R B T C.
# 4. B N* N* T R would generate in the binlog B N R B N R B T R.
# 5. B N N T N T C would generate in the binlog B N C B N C B T N T C.
# 6. B N N T N T R would generate in the binlog the B N C B N C B T N T R.
#
# Such issues do not happen in SBR. In RBR and MBR, a full-fledged fix will be
# pushed after the WL#2687.
#
# Please, remove this test case after pushing WL#2687.
################################################################################
--echo ###################################################################################
--echo # CONFIGURATION
--echo ###################################################################################
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
DELIMITER |;
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
BEGIN
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
END|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
BEGIN
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
END|
DELIMITER ;|
--echo ###################################################################################
--echo # CHECK HISTORY IN BINLOG
--echo ###################################################################################
--echo
--echo
--echo
--echo *** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO nt_1 VALUES ("new text 1", 1);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
INSERT INTO tt_2 VALUES ("new text 3", 3);
COMMIT;
--source include/show_binlog_events.inc
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO tt_2 VALUES ("new text 4", 4);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
INSERT INTO tt_2 VALUES ("new text 6", 6);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO nt_1 VALUES ("new text 10", 10);
BEGIN;
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
INSERT INTO tt_2 VALUES ("new text 11", 11);
COMMIT;
--source include/show_binlog_events.inc
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO tt_2 VALUES ("new text 15", 15);
BEGIN;
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
--error ER_DUP_ENTRY
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
INSERT INTO tt_2 VALUES ("new text 16", 16);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO nt_1 VALUES ("new text 18", 18);
INSERT INTO nt_1 VALUES ("new text 20", 20);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
--error ER_DUP_ENTRY
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
INSERT INTO tt_2 VALUES ("new text 21", 21);
COMMIT;
--source include/show_binlog_events.inc
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
INSERT INTO tt_2 VALUES ("new text 23", 23);
INSERT INTO tt_2 VALUES ("new text 25", 25);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
--error ER_DUP_ENTRY
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
INSERT INTO tt_2 VALUES ("new text 26", 26);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
--echo *** in the binlog the following entries: "Nothing".
--echo *** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
INSERT INTO tt_2 VALUES ("new text 27", 27);
--error ER_DUP_ENTRY
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
INSERT INTO tt_2 VALUES ("new text 28", 28);
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
--echo *** in the binlog the following entries: "B INSERT M..SELECT* R".
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
TRUNCATE TABLE nt_1;
TRUNCATE TABLE tt_2;
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 1);
INSERT INTO nt_1 VALUES (USER(), 2);
INSERT INTO tt_2 VALUES (USER(), 3);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 4);
INSERT INTO nt_1 VALUES (USER(), 5);
INSERT INTO tt_2 VALUES (USER(), 6);
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
INSERT INTO tt_2 VALUES (USER(), 9);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
BEGIN;
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
--error ER_DUP_ENTRY
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
INSERT INTO tt_2 VALUES (USER(), 12);
ROLLBACK;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 13);
INSERT INTO nt_1 VALUES (USER(), 14);
INSERT INTO tt_2 VALUES (USER(), 15);
INSERT INTO nt_1 VALUES (USER(), 16);
INSERT INTO tt_2 VALUES (USER(), 17);
COMMIT;
--source include/show_binlog_events.inc
--echo
--echo
--echo
--echo *** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
--echo
let $binlog_start= query_get_value("SHOW MASTER STATUS", Position, 1);
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 18);
INSERT INTO nt_1 VALUES (USER(), 19);
INSERT INTO tt_2 VALUES (USER(), 20);
INSERT INTO nt_1 VALUES (USER(), 21);
INSERT INTO tt_2 VALUES (USER(), 22);
ROLLBACK;
--source include/show_binlog_events.inc
--echo ###################################################################################
--echo # CLEAN
--echo ###################################################################################
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE nt_1;
DROP TABLE nt_2;

View file

@ -6,6 +6,8 @@
-- source include/have_blackhole.inc
-- source include/have_log_bin.inc
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
# The server need to be started in $MYSQLTEST_VARDIR since it
# uses ../../std_data/
-- source include/uses_vardir.inc

View file

@ -8,6 +8,7 @@
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
--disable_warnings
drop table if exists t1, t2;
@ -323,23 +324,24 @@ let $MYSQLD_DATADIR= `select @@datadir`;
# and does not make slave to stop)
if (`select @@binlog_format = 'ROW'`)
{
--exec $MYSQL_BINLOG --start-position=525 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
--echo This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
--echo were previously flushed upon committing/rolling back each statement.
}
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
--exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
}
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select
@a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
@a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval select
@a like "%#%error_code=0%ROLLBACK\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
@a like "%#%error_code=0%ROLLBACK\\r\\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
}
drop table t1, t2;
#

View 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;
}

View 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

View file

@ -22,13 +22,7 @@
#
########################################################################################
########################################################################################
# Configuring the environment
########################################################################################
--source include/have_innodb.inc
--source include/master-slave.inc
--source include/not_embedded.inc
--source include/not_windows.inc
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;
@ -50,30 +44,18 @@ eval INSERT INTO t1 (a, data) VALUES (1,
--enable_query_log
--echo *** Single statement on non-transactional table ***
--echo *** After WL#2687 the difference between STATEMENT/MIXED and ROW will not exist. ***
--disable_query_log
--disable_warnings
if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
eval INSERT INTO t2 (a, data) VALUES (2,
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
--echo Got one of the listed errors
}
if (`SELECT @@binlog_format = 'ROW'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
eval INSERT INTO t2 (a, data) VALUES (2,
CONCAT($data, $data, $data, $data, $data, $data));
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
}
--enable_warnings
--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
@ -86,7 +68,6 @@ eval INSERT INTO t2 (a, data) VALUES (5, $data);
--enable_query_log
--echo *** Single statement on both transactional and non-transactional tables. ***
--echo *** After WL#2687 we will be able to change the order of the 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),
@ -95,13 +76,25 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data),
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;
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;
#--echo ########################################################################################
#--echo # 2 - BEGIN - IMPLICIT COMMIT by DDL
#--echo ########################################################################################
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;
@ -149,14 +142,13 @@ BEGIN;
--eval INSERT INTO t1 (a, data) VALUES (21, 's');
--enable_query_log
if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
if (`SELECT @@binlog_format = 'STATEMENT'`)
{
--disable_query_log
CREATE TABLE t4 SELECT * FROM t1;
--enable_query_log
--echo Got one of the listed errors
}
if (`SELECT @@binlog_format = 'ROW'`)
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
{
--disable_query_log
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
@ -186,6 +178,17 @@ BEGIN;
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
@ -341,16 +344,30 @@ BEGIN;
--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);
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
if (`SELECT @@binlog_format = 'STATEMENT'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
--eval INSERT INTO t1 (a, data) VALUES (4, $data);
}
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
{
--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);
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
--eval UPDATE t2 SET data= CONCAT($data, $data);
if (`SELECT @@binlog_format = 'STATEMENT'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
--eval UPDATE t2 SET data= CONCAT($data, $data);
}
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
{
--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');
@ -363,19 +380,38 @@ BEGIN;
--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);
if (`SELECT @@binlog_format = 'STATEMENT'`)
{
--error ER_TRANS_CACHE_FULL, ER_ERROR_ON_WRITE
--eval INSERT INTO t1 (a, data) VALUES (18, $data);
}
if (`SELECT @@binlog_format = 'ROW' || @@binlog_format = 'MIXED'`)
{
--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 (18, $data);
--eval INSERT INTO t1 (a, data) VALUES (19, $data);
--enable_query_log
COMMIT;
connection slave;
--source include/wait_for_slave_sql_to_stop.inc
if (`SELECT @@binlog_format = 'STATEMENT'`)
{
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 # CLEAN
--echo ########################################################################################
--disable_warnings
connection master;
DROP TABLE t1;
DROP TABLE t2;
@ -384,12 +420,4 @@ DROP TABLE IF EXISTS t4;
DROP TABLE IF EXISTS t5;
DROP TABLE IF EXISTS t6;
DROP PROCEDURE p1;
connection slave;
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;
--enable_warnings
sync_slave_with_master;

View file

@ -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;

View file

@ -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.

View file

@ -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)

View file

@ -0,0 +1,656 @@
################################################################################
# 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: COMMIT
# 3: BEGIN
# 4: TABLE MAP EVENT
# 5: TABLE MAP EVENT (ndb_apply_status)
# 6: ROW EVENT
# 7: ROW EVENT
# 8: 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: INSERT
# 3: CREATE TEMPORARY
#
# 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
#
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
{
let $commit_event_row_number= 4;
}
#
# 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:
#
# 1: BEGIN
# 2: INSERT
# 3: DROP TEMPORARY
#
# 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
#
if (`select @@binlog_format = 'STATEMENT'`)
{
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
#
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;

View file

@ -1,9 +1,3 @@
# File for specialities regarding replication from or to InnoDB
# tables.
source include/master-slave.inc;
source include/have_innodb.inc;
#
# Bug#11401: Load data infile 'REPLACE INTO' fails on slave.
#
@ -76,7 +70,7 @@ sync_slave_with_master;
connection slave;
# We want to verify that the following transactions are written to the
# binlog, despite the transaction is rolled back. (The should be
# 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
@ -84,6 +78,10 @@ connection slave;
# 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;

View file

@ -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;

View file

@ -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 #
@ -188,7 +190,9 @@ 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.
@ -441,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());
@ -510,7 +516,9 @@ 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;

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -0,0 +1,554 @@
################################################################################
# This is an auxiliary file used by rpl_mixing_engines.test, and that it
# executes SQL statements according to a format string, as specified in
# rpl_mixing_engines.test. In addition, it accepts the special format
# strings 'configure' and 'clean', used before and after everything else.
################################################################################
if (`SELECT HEX(@commands) = HEX('configure')`)
{
connection master;
SET SQL_LOG_BIN=0;
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval SET SQL_LOG_BIN=1;
connection slave;
SET SQL_LOG_BIN=0;
eval CREATE TABLE nt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE nt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = MyISAM;
eval CREATE TABLE tt_1 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_2 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_3 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_4 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_5 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
eval CREATE TABLE tt_6 (trans_id INT, stmt_id INT, info VARCHAR(64), PRIMARY KEY(trans_id, stmt_id)) ENGINE = $engine_type;
SET SQL_LOG_BIN=1;
connection master;
INSERT INTO nt_1(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_2(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_3(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_4(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_5(trans_id, stmt_id) VALUES(1,1);
INSERT INTO nt_6(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_1(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_2(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_3(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_4(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_5(trans_id, stmt_id) VALUES(1,1);
INSERT INTO tt_6(trans_id, stmt_id) VALUES(1,1);
DELIMITER |;
CREATE PROCEDURE pc_i_tt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
END|
CREATE PROCEDURE pc_i_nt_5_suc (IN p_trans_id INTEGER, IN p_stmt_id INTEGER)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
END|
CREATE FUNCTION fc_i_tt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO tt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
RETURN "fc_i_tt_5_suc";
END|
CREATE FUNCTION fc_i_nt_5_suc (p_trans_id INTEGER, p_stmt_id INTEGER) RETURNS VARCHAR(64)
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_5 WHERE trans_id= p_trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, p_stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id);
INSERT INTO nt_5(trans_id, stmt_id) VALUES (p_trans_id, in_stmt_id + 1);
RETURN "fc_i_nt_5_suc";
END|
CREATE TRIGGER tr_i_tt_3_to_nt_3 AFTER INSERT ON tt_3 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_3 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO nt_3(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_nt_4_to_tt_4 AFTER INSERT ON nt_4 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_4 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO tt_4(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_tt_5_to_tt_6 AFTER INSERT ON tt_5 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM tt_6 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id, 1), 1) INTO in_stmt_id;
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO tt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
CREATE TRIGGER tr_i_nt_5_to_nt_6 AFTER INSERT ON nt_5 FOR EACH ROW
BEGIN
DECLARE in_stmt_id INTEGER;
SELECT max(stmt_id) INTO in_stmt_id FROM nt_6 WHERE trans_id= NEW.trans_id;
SELECT COALESCE(greatest(in_stmt_id + 1, NEW.stmt_id), 1) INTO in_stmt_id;
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id);
INSERT INTO nt_6(trans_id, stmt_id) VALUES (NEW.trans_id, in_stmt_id + 1);
END|
DELIMITER ;|
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
let $trans_id= 7;
let $tb_id= 1;
let $stmt_id= 1;
let $commands= '';
SET @commands= '';
}
if (`SELECT HEX(@commands) = HEX('clean')`)
{
connection master;
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE tt_3;
DROP TABLE tt_4;
DROP TABLE tt_5;
DROP TABLE tt_6;
DROP TABLE nt_1;
DROP TABLE nt_2;
DROP TABLE nt_3;
DROP TABLE nt_4;
DROP TABLE nt_5;
DROP TABLE nt_6;
DROP PROCEDURE pc_i_tt_5_suc;
DROP PROCEDURE pc_i_nt_5_suc;
DROP FUNCTION fc_i_tt_5_suc;
DROP FUNCTION fc_i_nt_5_suc;
sync_slave_with_master;
SET @commands= '';
}
while (`SELECT HEX(@commands) != HEX('')`)
{
--disable_query_log
SET @command= SUBSTRING_INDEX(@commands, ' ', 1);
let $command= `SELECT @command`;
--eval SET @check_commands= '$commands'
if (`SELECT HEX(@check_commands) = HEX('''')`)
{
let $commands= `SELECT @commands`;
}
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $command << -b-b-b-b-b-b-b-b-b-b-b-
let $pos_command= query_get_value("SHOW MASTER STATUS", Position, 1);
--enable_query_log
if (`SELECT HEX(@command) = HEX('B')`)
{
eval BEGIN;
}
if (`SELECT HEX(@command) = HEX('T')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval SELECT fc_i_tt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('T-proc')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval CALL pc_i_tt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('eT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Te-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval SELECT fc_i_nt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('N-proc')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval CALL pc_i_nt_5_suc ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('eN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_5(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('Ne-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('tN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('tNe')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM tt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM tt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('nT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('nTe')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_1`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_1 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_1(trans_id, stmt_id, info) SELECT $trans_id, $stmt_id, COUNT(*) FROM nt_1 UNION SELECT $old_trans_id, $old_stmt_id, COUNT(*) FROM nt_1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval UPDATE nt_3, tt_3 SET nt_3.info= "new text $trans_id --> $stmt_id", tt_3.info= "new text $trans_id --> $stmt_id" where nt_3.trans_id = tt_3.trans_id and tt_3.trans_id = 1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NT-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_tt_5_suc($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NeT-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_4`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_4 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_4(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('NeT-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from nt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from nt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO nt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_tt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval UPDATE tt_4, nt_4 SET tt_4.info= "new text $trans_id --> $stmt_id", nt_4.info= "new text $trans_id --> $stmt_id" where nt_4.trans_id = tt_4.trans_id and tt_4.trans_id = 1;
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TN-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, fc_i_nt_5_suc($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TeN-trig')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_3`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_3 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_3(trans_id, stmt_id) VALUES ($trans_id, $stmt_id), ($old_trans_id, $old_stmt_id);
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('TeN-func')`)
{
#--echo DEBUG-- (trans_id, stmt_id) --> ($trans_id, $stmt_id)
let $old_trans_id= `SELECT max(trans_id) from tt_5`;
let $old_stmt_id= `SELECT max(stmt_id) from tt_5 where trans_id= $old_trans_id`;
--error ER_DUP_ENTRY, ER_DUP_KEY
eval INSERT INTO tt_5(trans_id, stmt_id, info) VALUES ($trans_id, $stmt_id, ''), ($old_trans_id, $old_stmt_id, fc_i_nt_5_suc ($trans_id, $stmt_id));
inc $stmt_id;
}
if (`SELECT HEX(@command) = HEX('CS-T->T')`)
{
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CS-N->N')`)
{
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CS-T->N')`)
{
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=$engine_type SELECT * FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CS-N->T')`)
{
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY(trans_id, stmt_id)) engine=MyIsam SELECT * FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-T->T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-N->N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-T->N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE tt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=$engine_type SELECT stmt_id FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('CSe-N->T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval CREATE TABLE nt_xx_$tb_id (PRIMARY KEY (stmt_id)) engine=MyIsam SELECT stmt_id FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('CT')`)
{
--eval CREATE TEMPORARY TABLE tt_xx_$tb_id (a int) engine=$engine_type;
}
if (`SELECT HEX(@command) = HEX('IS-T<-N')`)
{
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-T<-N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('IS-N<-T')`)
{
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-N<-T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('IS-T<-T')`)
{
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-T<-T')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO tt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM tt_1;
}
if (`SELECT HEX(@command) = HEX('IS-N<-N')`)
{
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, stmt_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('ISe-N<-N')`)
{
--error ER_DUP_ENTRY, ER_DUP_KEY
--eval INSERT INTO nt_xx_$tb_id(trans_id, stmt_id, info) SELECT trans_id, trans_id, USER() FROM nt_1;
}
if (`SELECT HEX(@command) = HEX('trunc-CS-T')`)
{
eval TRUNCATE TABLE tt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('trunc-CS-N')`)
{
eval TRUNCATE TABLE nt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('trunc-CT')`)
{
eval TRUNCATE TABLE tt_xx_$tb_id;
}
if (`SELECT HEX(@command) = HEX('drop-CS')`)
{
--disable_warnings
eval DROP TABLE IF EXISTS tt_xx_$tb_id, nt_xx_$tb_id;
inc $tb_id;
--enable_warnings
}
if (`SELECT HEX(@command) = HEX('drop-CT')`)
{
--disable_warnings
eval DROP TEMPORARY TABLE IF EXISTS tt_xx_$tb_id;
inc $tb_id;
--enable_warnings
}
if (`SELECT HEX(@command) = HEX('C')`)
{
--error 0, ER_GET_ERRMSG
eval COMMIT;
}
if (`SELECT HEX(@command) = HEX('R')`)
{
--error 0, ER_GET_ERRMSG
eval ROLLBACK;
}
if (`SELECT HEX(@command) = HEX('S1')`)
{
eval SAVEPOINT s1;
}
if (`SELECT HEX(@command) = HEX('R1')`)
{
eval ROLLBACK TO s1;
}
--disable_query_log
SET @commands= LTRIM(SUBSTRING(@commands, LENGTH(@command) + 1));
inc $stmt_id;
let $binlog_start= $pos_command;
--source include/show_binlog_events.inc
--echo -e-e-e-e-e-e-e-e-e-e-e- >> $command << -e-e-e-e-e-e-e-e-e-e-e-
if (`SELECT HEX(@commands) = HEX('')`)
{
let $binlog_start= $pos_trans_command;
--echo -b-b-b-b-b-b-b-b-b-b-b- >> $commands << -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- >> $commands << -e-e-e-e-e-e-e-e-e-e-e-
--echo
let $pos_trans_command= query_get_value("SHOW MASTER STATUS", Position, 1);
let $stmt_id= 1;
inc $trans_id;
let $commands= '';
}
}

File diff suppressed because it is too large Load diff

View file

@ -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`;

View file

@ -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;

View file

@ -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

View file

@ -1,10 +1,14 @@
source include/master-slave.inc;
source include/have_innodb.inc;
#
# 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;

View file

@ -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);

View file

@ -1,7 +1,3 @@
-- source include/have_debug.inc
-- source include/master-slave.inc
-- source include/have_innodb.inc
# 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.
@ -11,6 +7,8 @@
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;

View 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;

View file

@ -547,9 +547,9 @@ call p_verify_status_increment(0, 0, 0, 0);
--echo # the binary log.
--echo #
select f1();
call p_verify_status_increment(0, 0, 1, 0);
call p_verify_status_increment(1, 0, 1, 0);
commit;
call p_verify_status_increment(0, 0, 1, 0);
call p_verify_status_increment(1, 0, 1, 0);
--echo # 17. Read-only statement, a function changes non-trans-table.
--echo #
@ -557,15 +557,19 @@ call p_verify_status_increment(0, 0, 1, 0);
--echo # non-transactional changes saved in the transaction cache to
--echo # the binary log.
--echo #
--disable_warnings
select f1() from t1;
call p_verify_status_increment(1, 0, 2, 0);
--enable_warnings
call p_verify_status_increment(2, 0, 2, 0);
commit;
call p_verify_status_increment(1, 0, 2, 0);
call p_verify_status_increment(2, 0, 2, 0);
--echo # 18. Read-write statement: UPDATE, change 0 (transactional) rows.
--echo #
select count(*) from t2;
--disable_warnings
update t1 set a=2 where a=f1()+10;
--enable_warnings
select count(*) from t2;
call p_verify_status_increment(2, 0, 2, 0);
commit;
@ -579,7 +583,7 @@ call p_verify_status_increment(2, 0, 2, 0);
drop table t2;
set sql_mode=no_engine_substitution;
create temporary table t2 (a int);
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
set sql_mode=default;
--echo # 19. A function changes temp-trans-table.
--echo #
@ -636,9 +640,9 @@ call p_verify_status_increment(2, 0, 1, 0);
--echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
--echo #
drop temporary table t2;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
commit;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
--echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit
--echo #
@ -719,17 +723,17 @@ call p_verify_status_increment(4, 4, 4, 4);
--echo # Sic: no table is created.
create table if not exists t2 (a int) select 6 union select 7;
--echo # Sic: first commits the statement, and then the transaction.
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 4, 4);
create table t3 select a from t2;
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 4, 4);
alter table t3 add column (b int);
call p_verify_status_increment(2, 0, 2, 0);
alter table t3 rename t4;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
rename table t4 to t3;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
truncate table t3;
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 2, 0);
create view v1 as select * from t2;
call p_verify_status_increment(1, 0, 1, 0);
check table t1;

View file

@ -1,7 +1,9 @@
#
# Whether server supports dynamic loading.
#
--require r/have_dynamic_loading.require
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip The test requires dynamic loading
}
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;

View file

@ -1,13 +1,21 @@
#
# Check if server has support for loading udf's
# i.e it will support dlopen
# Check if server has support for loading plugins
#
--source include/have_dynamic_loading.inc
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Example plugin requires dynamic loading
}
#
# Check if the variable EXAMPLE_PLUGIN is set
#
--require r/have_example_plugin.require
disable_query_log;
eval select LENGTH('$EXAMPLE_PLUGIN') > 0 as 'have_example_plugin';
if (`SELECT LENGTH('$EXAMPLE_PLUGIN') = 0`) {
--skip Example plugin requires the environment variable \$EXAMPLE_PLUGIN to be set (normally done by mtr)
}
#
# Check if --plugin-dir was setup for exampledb
#
if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$EXAMPLE_PLUGIN_OPT'`) {
--skip Example plugin requires that --plugin-dir is set to the example plugin dir (either the .opt file does not contain \$EXAMPLE_PLUGIN_OPT or another plugin is in use)
}
enable_query_log;

View file

@ -1,10 +1,9 @@
#
# Check if dynamic loading is supported
# Check if server has support for loading plugins
#
--require r/have_dynamic_loading.require
disable_query_log;
show variables like 'have_dynamic_loading';
enable_query_log;
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip Requires dynamic loading
}
#
# Check if the variable SEMISYNC_MASTER_PLUGIN is set

View file

@ -1,13 +1,20 @@
#
# Check if server has support for loading udf's
# i.e it will support dlopen
# Check if server has support for loading plugins
#
--source include/have_dynamic_loading.inc
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip simple parser requires dynamic loading
}
#
# Check if the variable SIMPLE_PARSER is set
#
--require r/have_simple_parser.require
disable_query_log;
eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser';
enable_query_log;
if (`SELECT LENGTH('$SIMPLE_PARSER') = 0`) {
--skip simple parser requires the environment variable \$SIMPLE_PARSER to be set (normally done by mtr)
}
#
# Check if --plugin-dir was setup for simple parser
#
if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$SIMPLE_PARSER_OPT'`) {
--skip simple parser requires that --plugin-dir is set to the udf plugin dir (either the .opt file does not contain \$UDF_EXAMPLE_LIB_OPT or another plugin is in use)
}

View file

@ -1,13 +1,20 @@
#
# Check if server has support for loading udf's
# i.e it will support dlopen
# Check if server has support for loading plugins
#
--source include/have_dynamic_loading.inc
if (`SELECT @@have_dynamic_loading != 'YES'`) {
--skip UDF requires dynamic loading
}
#
# Check if the variable UDF_EXAMPLE_LIB is set
#
--require r/have_udf_example.require
disable_query_log;
eval select LENGTH('$UDF_EXAMPLE_LIB') > 0 as 'have_udf_example_lib';
enable_query_log;
if (`SELECT LENGTH('$UDF_EXAMPLE_LIB') = 0`) {
--skip UDF requires the environment variable \$UDF_EXAMPLE_LIB to be set (normally done by mtr)
}
#
# Check if --plugin-dir was setup for udf
#
if (`SELECT CONCAT('--plugin-dir=', @@plugin_dir) != '$UDF_EXAMPLE_LIB_OPT'`) {
--skip UDF requires that --plugin-dir is set to the udf plugin dir (either the .opt file does not contain \$UDF_EXAMPLE_LIB_OPT or another plugin is in use)
}

View file

@ -55,11 +55,13 @@ connection master;
--echo "Running on the master"
--enable_info
eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type;
--disable_warnings
INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00));
INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00));
INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00));
INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00));
SELECT * FROM t1 ORDER BY sum;
--enable_warnings
--disable_info
sync_slave_with_master;

View file

@ -1,3 +1,4 @@
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
DROP TABLE if exists t1,t2,t3,t4,t5,t6;
SET storage_engine=ARCHIVE;
CREATE TABLE t1 (

View file

@ -1,3 +1,4 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
set sql_mode=no_engine_substitution;
set storage_engine = InnoDB;
set autocommit=1;
@ -578,11 +579,11 @@ SUCCESS
select f1();
f1()
2
call p_verify_status_increment(0, 0, 1, 0);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
commit;
call p_verify_status_increment(0, 0, 1, 0);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
# 17. Read-only statement, a function changes non-trans-table.
@ -595,11 +596,11 @@ select f1() from t1;
f1()
2
2
call p_verify_status_increment(1, 0, 2, 0);
call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
commit;
call p_verify_status_increment(1, 0, 2, 0);
call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
# 18. Read-write statement: UPDATE, change 0 (transactional) rows.
@ -627,7 +628,7 @@ SUCCESS
drop table t2;
set sql_mode=no_engine_substitution;
create temporary table t2 (a int);
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
SUCCESS
set sql_mode=default;
@ -708,11 +709,11 @@ SUCCESS
# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
#
drop temporary table t2;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
SUCCESS
commit;
call p_verify_status_increment(0, 0, 0, 0);
call p_verify_status_increment(1, 0, 0, 0);
SUCCESS
# 26. Verify that SET AUTOCOMMIT issues an implicit commit
@ -829,11 +830,11 @@ create table if not exists t2 (a int) select 6 union select 7;
Warnings:
Note 1050 Table 't2' already exists
# Sic: first commits the statement, and then the transaction.
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 4, 4);
SUCCESS
create table t3 select a from t2;
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 4, 4);
SUCCESS
alter table t3 add column (b int);
@ -841,15 +842,15 @@ call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
alter table t3 rename t4;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
rename table t4 to t3;
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(1, 0, 1, 0);
SUCCESS
truncate table t3;
call p_verify_status_increment(4, 4, 4, 4);
call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
create view v1 as select * from t2;

View file

@ -9,11 +9,14 @@ EXECUTE stmt1 USING @var1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(0x8300)
master-bin.000001 # Query # # COMMIT
SELECT HEX(f1) FROM t1;
HEX(f1)
8300
DROP table t1;
call mtr.add_suppression('Error in Log_event::read_log_event()');
CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))|
@ -29,22 +32,27 @@ HEX(s1) HEX(s2) d
466F6F2773206120426172 ED40ED41ED42 47.93
DROP PROCEDURE bug18293|
DROP TABLE t4|
SHOW BINLOG EVENTS FROM 371|
SHOW BINLOG EVENTS FROM 514|
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 371 Query 1 537 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
master-bin.000001 514 Query 1 581 BEGIN
master-bin.000001 581 Query 1 788 use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Error in Log_event::read_log_event()' COLLATE 'latin1_swedish_ci'))
master-bin.000001 788 Query 1 856 COMMIT
master-bin.000001 856 Query 1 1019 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1,
s2 CHAR(50) CHARACTER SET cp932,
d DECIMAL(10,2))
master-bin.000001 537 Query 1 786 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
master-bin.000001 1019 Query 1 1265 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50),
IN ins2 CHAR(50) CHARACTER SET cp932,
IN ind DECIMAL(10,2))
BEGIN
INSERT INTO t4 VALUES (ins1, ins2, ind);
END
master-bin.000001 786 Query 1 1050 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 1050 Query 1 1139 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1139 Query 1 1218 use `test`; DROP TABLE t4
master-bin.000001 1265 Query 1 1333 BEGIN
master-bin.000001 1333 Query 1 1597 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 1597 Query 1 1666 COMMIT
master-bin.000001 1666 Query 1 1752 use `test`; DROP PROCEDURE bug18293
master-bin.000001 1752 Query 1 1828 use `test`; DROP TABLE t4
End of 5.0 tests
SHOW BINLOG EVENTS FROM 366;
SHOW BINLOG EVENTS FROM 490;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment.
CREATE TABLE t1 (a varchar(16)) character set cp932;

View file

@ -1,2 +0,0 @@
Variable_name Value
have_dynamic_loading YES

View file

@ -1,2 +0,0 @@
have_example_plugin
1

View file

@ -1,2 +0,0 @@
have_simple_parser
1

View file

@ -1,2 +0,0 @@
have_udf_example_lib
1

View file

@ -604,7 +604,7 @@ a b
4 4
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 207
master-bin.000001 344
delete from t1;
delete from t2;
insert into t1 values (1,2),(3,4),(4,4);
@ -614,7 +614,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a;
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
show master status /* there must be the UPDATE query event */;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 222
master-bin.000001 359
drop table t1, t2;
set @@session.binlog_format= @sav_binlog_format;
drop table if exists t1, t2, t3;

View file

@ -37,24 +37,60 @@ SET TIMESTAMP=1000000000/*!*/;
create table t2 (id int auto_increment not null primary key)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("abirvalg")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t2 values ()
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -64,7 +100,6 @@ ROLLBACK /* added by mysqlbinlog */;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -74,8 +109,24 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -86,17 +137,6 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET INSERT_ID=1/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -106,8 +146,69 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -137,24 +238,60 @@ SET TIMESTAMP=1000000000/*!*/;
create table t2 (id int auto_increment not null primary key)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("abirvalg")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t2 values ()
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -164,7 +301,6 @@ ROLLBACK /* added by mysqlbinlog */;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -174,8 +310,24 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (word)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -186,17 +338,6 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET INSERT_ID=1/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -206,8 +347,69 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET INSERT_ID=1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
--- --position --
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
use test/*!*/;
SET TIMESTAMP=1000000000/*!*/;
insert into t1 values ("Alas")
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
@ -359,31 +561,73 @@ SET @@session.collation_database=DEFAULT/*!*/;
create table t1 (a varchar(64) character set utf8)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-#-#' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO TABLE `t1` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO TABLE `t1` CHARACTER SET koi8r FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a)
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
drop table t1
/*!*/;
DELIMITER ;
@ -399,9 +643,9 @@ We expect this value to be 1
The bug being tested was that 'Query' lines were not preceded by '#'
If the line is in the table, it had to have been preceded by a '#'
SELECT COUNT(*) AS `BUG#28293_expect_1` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_1
1
SELECT COUNT(*) AS `BUG#28293_expect_3` FROM patch WHERE a LIKE '%Query%';
BUG#28293_expect_3
3
DROP TABLE patch;
FLUSH LOGS;
CREATE TABLE t1(a INT);
@ -426,7 +670,7 @@ CREATE TABLE t1 (a INT, b CHAR(64));
flush logs;
INSERT INTO t1 VALUES (1,USER());
flush logs;
mysqlbinlog var/log/master-bin.000017 > var/tmp/bug31611.sql
mysqlbinlog var/log/master-bin.000018 > var/tmp/bug31611.sql
mysql mysqltest1 -uuntrusted < var/tmp/bug31611.sql
INSERT INTO t1 VALUES (1,USER());
ERROR 42000: INSERT command denied to user 'untrusted'@'localhost' for table 't1'
@ -452,7 +696,7 @@ an_int 1000
a_decimal 907.79
a_string Just a test
DROP TABLE t1;
>> mysqlbinlog var/log/master-bin.000019 > var/tmp/bug32580.sql
>> mysqlbinlog var/log/master-bin.000020 > var/tmp/bug32580.sql
>> mysql test < var/tmp/bug32580.sql
SELECT * FROM t1;
a_real 158.883

File diff suppressed because it is too large Load diff

View file

@ -2365,7 +2365,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2458,7 +2458,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2553,7 +2553,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@ -2580,7 +2580,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -2634,7 +2634,7 @@ BEGIN
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2727,7 +2727,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2807,7 +2807,7 @@ BEGIN
### @78=b'00000000' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=1 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2900,7 +2900,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@ -2980,7 +2980,7 @@ BEGIN
### @78=b'00000111' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=2 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3073,7 +3073,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@ -3100,7 +3100,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -3153,7 +3153,7 @@ BEGIN
### @78=NULL /* TIMESTAMP meta=63489 nullable=1 is_null=1 */
### @79=3 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3246,7 +3246,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3326,7 +3326,7 @@ BEGIN
### @78=b'00000110' /* SET(1 bytes) meta=63489 nullable=1 is_null=0 */
### @79=4 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@ -3353,7 +3353,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -3419,7 +3419,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=-1 (255) /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3512,7 +3512,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
### @1=b'00000000' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'0' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'0000000000000000000000000000000000000000000000000000000000000000' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=-128 (128) /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3605,7 +3605,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
### @1=b'00000001' /* BIT(8) meta=256 nullable=1 is_null=0 */
### @1=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @2=b'1111111111111111111111111111111111111111111111111111111111111111' /* BIT(64) meta=2048 nullable=1 is_null=0 */
### @3=127 /* TINYINT meta=0 nullable=1 is_null=0 */
### @4=0 /* TINYINT meta=0 nullable=1 is_null=0 */
@ -3698,7 +3698,7 @@ BEGIN
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
### @1=NULL /* type=16 meta=256 nullable=1 is_null=1 */
### @1=NULL /* type=16 meta=1 nullable=1 is_null=1 */
### @2=NULL /* type=16 meta=2048 nullable=1 is_null=1 */
### @3=NULL /* type=1 meta=0 nullable=1 is_null=1 */
### @4=NULL /* type=1 meta=0 nullable=1 is_null=1 */
@ -3725,7 +3725,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */

View file

@ -2584,7 +2584,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -3110,7 +3110,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -3365,7 +3365,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */
@ -3745,7 +3745,7 @@ BEGIN
### @25=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @26=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @27=NULL /* type=246 meta=2560 nullable=1 is_null=1 */
### @28=NULL /* type=10 meta=0 nullable=1 is_null=1 */
### @28=NULL /* type=14 meta=0 nullable=1 is_null=1 */
### @29=NULL /* type=12 meta=0 nullable=1 is_null=1 */
### @30=1000000000 /* TIMESTAMP meta=0 nullable=0 is_null=0 */
### @31=NULL /* TIMESTAMP meta=0 nullable=1 is_null=1 */

View file

@ -215,7 +215,7 @@ COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@ -223,21 +223,84 @@ SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t2
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t2
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t2
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t2
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t2
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
@ -293,71 +356,14 @@ BEGIN
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t2
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t2
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t2
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t2
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t2
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t2
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t2
@ -369,55 +375,6 @@ BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t1
### SET
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### INSERT INTO test.t1
### SET
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
### UPDATE test.t1
### WHERE
### @1=1 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=11 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-1' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t1
### WHERE
### @1=2 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### UPDATE test.t1
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
### SET
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
### DELETE FROM test.t1
### WHERE
### @1=12 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-2' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F
### INSERT INTO test.t2
@ -433,6 +390,16 @@ BEGIN
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Update_rows: table id # flags: STMT_END_F
@ -458,6 +425,16 @@ BEGIN
### @1=13 /* INT meta=0 nullable=1 is_null=0 */
### @2='varchar-3' /* VARSTRING(20) meta=20 nullable=1 is_null=0 */
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
/*!*/;
# at #
# at #
#010909 4:46:40 server id 1 end_log_pos # Table_map: `test`.`t2` mapped to number #
#010909 4:46:40 server id 1 end_log_pos # Delete_rows: table id # flags: STMT_END_F
@ -468,12 +445,7 @@ BEGIN
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
ROLLBACK
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
BEGIN
COMMIT
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@ -481,9 +453,6 @@ SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t1
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Xid = #
COMMIT/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
TRUNCATE TABLE t2

View file

@ -653,6 +653,12 @@ The following options may be given as the first argument:
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
lock wait timeout, before giving up and stopping
--slave-type-conversions=name
Set of slave type conversions that are enabled. Legal
values are: ALL_LOSSY to enable lossy conversions and
ALL_NON_LOSSY to enable non-lossy conversions. If the
variable is assigned the empty set, no conversions are
allowed and it is expected that the types match exactly.
--slow-launch-time=#
If creating the thread takes longer than this value (in
seconds), the Slow_launch_threads counter will be
@ -948,6 +954,7 @@ slave-exec-mode STRICT
slave-net-timeout 3600
slave-skip-errors (No default value)
slave-transaction-retries 10
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
socket /tmp/mysql.sock

View file

@ -656,6 +656,12 @@ The following options may be given as the first argument:
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
lock wait timeout, before giving up and stopping
--slave-type-conversions=name
Set of slave type conversions that are enabled. Legal
values are: ALL_LOSSY to enable lossy conversions and
ALL_NON_LOSSY to enable non-lossy conversions. If the
variable is assigned the empty set, no conversions are
allowed and it is expected that the types match exactly.
--slow-launch-time=#
If creating the thread takes longer than this value (in
seconds), the Slow_launch_threads counter will be
@ -954,6 +960,7 @@ slave-exec-mode STRICT
slave-net-timeout 3600
slave-skip-errors (No default value)
slave-transaction-retries 10
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
socket MySQL

View file

@ -42,7 +42,7 @@ id
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t1 VALUES(9);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
COMMIT;
DROP TABLE t1;

View file

@ -8,18 +8,20 @@ SET @var2=char(ascii('a'));
insert into t1 values (@var1),(@var2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@`a b`)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
master-bin.000001 # User var # # @`var2`=_binary 0x61 COLLATE binary
master-bin.000001 # Query # # use `test`; insert into t1 values (@var1),(@var2)
master-bin.000001 # Query # # COMMIT
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -29,13 +31,27 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET @`a b`:=_latin1 0x68656C6C6F COLLATE `latin1_swedish_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
INSERT INTO t1 VALUES(@`a b`)
/*!*/;
SET TIMESTAMP=10000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=10000/*!*/;
BEGIN
/*!*/;
SET @`var1`:=_latin1 0x273B616161 COLLATE `latin1_swedish_ci`/*!*/;
SET @`var2`:=_binary 0x61 COLLATE `binary`/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t1 values (@var1),(@var2)
/*!*/;
SET TIMESTAMP=10000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;

View file

@ -29,9 +29,13 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table tt1, t1
FLUSH STATUS;
set binlog_format=mixed;
@ -65,9 +69,13 @@ show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # drop database if exists mysqltest1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table tt1, t1
FLUSH STATUS;
set binlog_format=row;

View file

@ -0,0 +1,90 @@
set @save_binlog_format= @@global.binlog_format;
create table t1 (a int) engine= myisam;
create table t2 (a int) engine= innodb;
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
SET AUTOCOMMIT=1;
# Test that the session variable 'binlog_format'
# is writable outside a transaction.
set @@session.binlog_format= statement;
SELECT @@session.binlog_format;
@@session.binlog_format
STATEMENT
begin;
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with no preceding updates.
set @@session.binlog_format= mixed;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
insert into t2 values (1);
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with preceding transactional updates.
set @@session.binlog_format= row;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
commit;
begin;
insert into t1 values (2);
# Test that the session variable 'binlog_format' is read-only
# inside a transaction with preceding non-transactional updates.
set @@session.binlog_format= statement;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
commit;
# Test that the session variable 'binlog_format' is writable
# when AUTOCOMMIT=0, before a transaction has started.
set AUTOCOMMIT=0;
set @@session.binlog_format= row;
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
insert into t1 values (4);
# Test that the session variable 'binlog_format' is read-only inside an
# AUTOCOMMIT=0 transaction with preceding non-transactional updates.
set @@session.binlog_format= statement;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
commit;
insert into t2 values (5);
# Test that the session variable 'binlog_format' is read-only inside an
# AUTOCOMMIT=0 transaction with preceding transactional updates.
set @@session.binlog_format= row;
ERROR HY000: Cannot modify @@session.binlog_format inside a transaction
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
commit;
begin;
insert into t2 values (6);
# Test that the global variable 'binlog_format' is writable
# inside a transaction.
SELECT @@global.binlog_format;
@@global.binlog_format
ROW
set @@global.binlog_format= statement;
SELECT @@global.binlog_format;
@@global.binlog_format
STATEMENT
commit;
set @@global.binlog_format= @save_binlog_format;
create table t3(a int, b int) engine= innodb;
create table t4(a int) engine= innodb;
create table t5(a int) engine= innodb;
create trigger tr2 after insert on t3 for each row begin
insert into t4(a) values(1);
set @@session.binlog_format= statement;
insert into t4(a) values(2);
insert into t5(a) values(3);
end |
# Test that the session variable 'binlog_format' is read-only
# in sub-statements.
insert into t3(a,b) values(1,1);
ERROR HY000: Cannot change the binary logging format inside a stored function or trigger
SELECT @@session.binlog_format;
@@session.binlog_format
ROW
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;

View file

@ -14,12 +14,12 @@ SET BINLOG_FORMAT=STATEMENT;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
UPDATE t1 SET b = 1*a WHERE a > 1;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-UNCOMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
UPDATE t1 SET b = 2*a WHERE a > 2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
@ -123,7 +123,7 @@ Binlog_cache_disk_use 0
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@ -132,7 +132,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
Binlog_cache_use 4
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1

View file

@ -1,3 +1,4 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
@ -87,8 +88,10 @@ select @b /* must be 1 at the end of a stmt calling bug27563() */;
must have the update query event more to FD
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`b`=0
master-bin.000001 # Query # # use `test`; update t4 set b=b + bug27563(b)
master-bin.000001 # Query # # COMMIT
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;
@ -123,8 +126,10 @@ select @b /* must be 1 at the end of a stmt calling bug27563() */;
must have the delete query event more to FD
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`b`=0
master-bin.000001 # Query # # use `test`; delete from t4 where b=bug27563(1) or b=bug27563(2)
master-bin.000001 # Query # # COMMIT
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;

View file

@ -18,8 +18,10 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
ERROR 70100: Query execution was interrupted
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t2` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, b) ;file_id=#
master-bin.000001 # Query # # COMMIT
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null;

View file

@ -9,7 +9,7 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@ -18,7 +18,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
Binlog_cache_use 4
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1

View file

@ -1,406 +0,0 @@
###################################################################################
# CONFIGURATION
###################################################################################
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
BEGIN
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
END|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
BEGIN
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
END|
###################################################################################
# CHECK HISTORY IN BINLOG
###################################################################################
*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
INSERT INTO nt_1 VALUES ("new text 1", 1);
BEGIN;
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 3", 3);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 1", 1)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 3", 3)
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 4", 4);
BEGIN;
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 6", 6);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 4", 4)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 6", 6)
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
INSERT INTO nt_1 VALUES ("new text 10", 10);
BEGIN;
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 11", 11);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 10", 10)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8)
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 11", 11)
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 15", 15);
BEGIN;
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 16", 16);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 15", 15)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13)
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 16", 16)
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
INSERT INTO nt_1 VALUES ("new text 18", 18);
INSERT INTO nt_1 VALUES ("new text 20", 20);
BEGIN;
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 21", 21);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 18", 18)
master-bin.000001 # Query # # use `test`; INSERT INTO nt_1 VALUES ("new text 20", 20)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 21", 21)
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 23", 23);
INSERT INTO tt_2 VALUES ("new text 25", 25);
BEGIN;
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 26", 26);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 23", 23)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 25", 25)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 26", 26)
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
*** in the binlog the following entries: "Nothing".
*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
INSERT INTO tt_2 VALUES ("new text 27", 27);
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 28", 28);
ROLLBACK;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
*** in the binlog the following entries: "B INSERT M..SELECT* R".
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO tt_2 VALUES ("new text 7", 7)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
TRUNCATE TABLE nt_1;
TRUNCATE TABLE tt_2;
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 1);
INSERT INTO nt_1 VALUES (USER(), 2);
INSERT INTO tt_2 VALUES (USER(), 3);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 4);
INSERT INTO nt_1 VALUES (USER(), 5);
INSERT INTO tt_2 VALUES (USER(), 6);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES (USER(), 9);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES (USER(), 12);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 13);
INSERT INTO nt_1 VALUES (USER(), 14);
INSERT INTO tt_2 VALUES (USER(), 15);
INSERT INTO nt_1 VALUES (USER(), 16);
INSERT INTO tt_2 VALUES (USER(), 17);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 18);
INSERT INTO nt_1 VALUES (USER(), 19);
INSERT INTO tt_2 VALUES (USER(), 20);
INSERT INTO nt_1 VALUES (USER(), 21);
INSERT INTO tt_2 VALUES (USER(), 22);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
###################################################################################
# CLEAN
###################################################################################
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE nt_1;
DROP TABLE nt_2;

View file

@ -1,3 +1,4 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
@ -6,10 +7,15 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
The last event before the COMMIT is use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
*** Please look in binlog_multi_engine.test if you have a diff here ****
START TRANSACTION;
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
COMMIT;
TRUNCATE t1m;
@ -20,8 +26,12 @@ Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f
@ -39,10 +49,11 @@ RESET MASTER;
SET SESSION BINLOG_FORMAT=MIXED;
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
The last event before the COMMIT is use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
TRUNCATE t1m;
TRUNCATE t1b;
TRUNCATE t1n;
@ -51,14 +62,15 @@ Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Table_map # # table_id: # (test.t1n)
mysqld-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status)
mysqld-bin.000001 # Write_rows # # table_id: #
mysqld-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # use `test`; UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1m
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1b
mysqld-bin.000001 # Query # # use `test`; TRUNCATE t1n
@ -68,9 +80,9 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
ERROR HY000: Binary logging not possible. Message: Statement cannot be written atomically since more than one engine involved and at least one engine is self-logging
ERROR HY000: Cannot execute statement: binlogging impossible since more than one engine is involved and at least one engine is self-logging.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 # Query # # BEGIN

View file

@ -1,440 +0,0 @@
###################################################################################
# CONFIGURATION
###################################################################################
CREATE TABLE nt_1 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE nt_2 (a text, b int PRIMARY KEY) ENGINE = MyISAM;
CREATE TABLE tt_1 (a text, b int PRIMARY KEY) ENGINE = Innodb;
CREATE TABLE tt_2 (a text, b int PRIMARY KEY) ENGINE = Innodb;
CREATE TRIGGER tr_i_tt_1_to_nt_1 BEFORE INSERT ON tt_1 FOR EACH ROW
BEGIN
INSERT INTO nt_1 VALUES (NEW.a, NEW.b);
END|
CREATE TRIGGER tr_i_nt_2_to_tt_2 BEFORE INSERT ON nt_2 FOR EACH ROW
BEGIN
INSERT INTO tt_2 VALUES (NEW.a, NEW.b);
END|
###################################################################################
# CHECK HISTORY IN BINLOG
###################################################################################
*** "B M* T C" with error in M* generates in the binlog the "B M* R B T C" entries
INSERT INTO nt_1 VALUES ("new text 1", 1);
BEGIN;
INSERT INTO tt_1 VALUES (USER(), 2), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 3", 3);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 4", 4);
BEGIN;
INSERT INTO nt_2 VALUES (USER(), 5), (USER(), 4);
ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 6", 6);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B M M* T C" with error in M* generates in the binlog the "B M M* T C" entries
INSERT INTO nt_1 VALUES ("new text 10", 10);
BEGIN;
INSERT INTO tt_1 VALUES ("new text 7", 7), ("new text 8", 8);
INSERT INTO tt_1 VALUES (USER(), 9), (USER(), 10);
ERROR 23000: Duplicate entry '10' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 11", 11);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 15", 15);
BEGIN;
INSERT INTO nt_2 VALUES ("new text 12", 12), ("new text 13", 13);
INSERT INTO nt_2 VALUES (USER(), 14), (USER(), 15);
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 16", 16);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B M* M* T C" with error in M* generates in the binlog the "B M* R B M* R B T C" entries
INSERT INTO nt_1 VALUES ("new text 18", 18);
INSERT INTO nt_1 VALUES ("new text 20", 20);
BEGIN;
INSERT INTO tt_1 VALUES (USER(), 17), (USER(), 18);
ERROR 23000: Duplicate entry '18' for key 'PRIMARY'
INSERT INTO tt_1 VALUES (USER(), 19), (USER(), 20);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 21", 21);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_1)
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
INSERT INTO tt_2 VALUES ("new text 23", 23);
INSERT INTO tt_2 VALUES ("new text 25", 25);
BEGIN;
INSERT INTO nt_2 VALUES (USER(), 22), (USER(), 23);
ERROR 23000: Duplicate entry '23' for key 'PRIMARY'
INSERT INTO nt_2 VALUES (USER(), 24), (USER(), 25);
ERROR 23000: Duplicate entry '25' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 26", 26);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B T INSERT M...SELECT* C" with an error in INSERT M...SELECT* generates
*** in the binlog the following entries: "Nothing".
*** There is a bug in that will be fixed after WL#2687. Please, check BUG#47175 for further details.
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
INSERT INTO tt_2 VALUES ("new text 27", 27);
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
INSERT INTO tt_2 VALUES ("new text 28", 28);
ROLLBACK;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B INSERT M..SELECT* C" with an error in INSERT M...SELECT* generates
*** in the binlog the following entries: "B INSERT M..SELECT* R".
TRUNCATE TABLE nt_2;
TRUNCATE TABLE tt_2;
INSERT INTO tt_2 VALUES ("new text 7", 7);
BEGIN;
INSERT INTO nt_2(a, b) SELECT USER(), b FROM nt_1;
ERROR 23000: Duplicate entry '7' for key 'PRIMARY'
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_2)
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N N T C" generates in the binlog the "B N C B N C B T C" entries
TRUNCATE TABLE nt_1;
TRUNCATE TABLE tt_2;
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 1);
INSERT INTO nt_1 VALUES (USER(), 2);
INSERT INTO tt_2 VALUES (USER(), 3);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE nt_1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE TABLE tt_2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N N T R" generates in the binlog the "B N C B N C B T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 4);
INSERT INTO nt_1 VALUES (USER(), 5);
INSERT INTO tt_2 VALUES (USER(), 6);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N* N* T C" with error in N* generates in the binlog the "B N R B N R B T C" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 7), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO nt_1 VALUES (USER(), 8), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES (USER(), 9);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N* N* T R" with error in N* generates in the binlog the "B N R B N R B T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 10), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO nt_1 VALUES (USER(), 11), (USER(), 1);
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
INSERT INTO tt_2 VALUES (USER(), 12);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
*** "B N N T N T C" generates in the binlog the "B N C B N C B T N T C" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 13);
INSERT INTO nt_1 VALUES (USER(), 14);
INSERT INTO tt_2 VALUES (USER(), 15);
INSERT INTO nt_1 VALUES (USER(), 16);
INSERT INTO tt_2 VALUES (USER(), 17);
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
*** "B N N T N T R" generates in the binlog the "B N C B N C B T N T R" entries
BEGIN;
INSERT INTO nt_1 VALUES (USER(), 18);
INSERT INTO nt_1 VALUES (USER(), 19);
INSERT INTO tt_2 VALUES (USER(), 20);
INSERT INTO nt_1 VALUES (USER(), 21);
INSERT INTO tt_2 VALUES (USER(), 22);
ROLLBACK;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.nt_1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.tt_2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
###################################################################################
# CLEAN
###################################################################################
DROP TABLE tt_1;
DROP TABLE tt_2;
DROP TABLE nt_1;
DROP TABLE nt_2;

View file

@ -9,7 +9,7 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@ -18,7 +18,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
Binlog_cache_use 4
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1

View file

@ -11,7 +11,7 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
select * from t1;
a
1

View file

@ -1,3 +1,4 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
@ -9,10 +10,12 @@ commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
delete from t2;
@ -26,11 +29,9 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
delete from t1;
delete from t2;
reset master;
@ -46,13 +47,15 @@ commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
master-bin.000001 # Xid # # COMMIT /* XID */
delete from t1;
@ -75,13 +78,15 @@ a
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; savepoint my_savepoint
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
@ -101,11 +106,9 @@ get_lock("a",10)
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
delete from t1;
delete from t2;
reset master;
@ -389,9 +392,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
@ -432,19 +433,8 @@ select get_lock("a",10);
get_lock("a",10)
1
flush logs;
select
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null;
(@a:=load_file("MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output"))
is not null
1
select
@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%",
@a not like "%#%error_code=%error_code=%";
@a like "%#%error_code=0%ROLLBACK\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" OR
@a like "%#%error_code=0%ROLLBACK\r\n/*!*/;%ROLLBACK /* added by mysqlbinlog */;%" @a not like "%#%error_code=%error_code=%"
1 1
This does not matter in ROW mode as the rolled back changes do not contain transactional changes as these
were previously flushed upon committing/rolling back each statement.
drop table t1, t2;
create temporary table tt (a int unique);
create table ti (a int) engine=innodb;
@ -461,12 +451,6 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ti)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.ti)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
select count(*) from ti /* zero */;
count(*)
0
@ -484,6 +468,8 @@ insert into ti values (2) /* to make the dup error in the following */;
insert into tt select * from ti /* one affected and error */;
ERROR 23000: Duplicate entry '2' for key 'a'
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
select count(*) from ti /* zero */;
@ -517,7 +503,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* only (!) with fixes for #23333 will show there is the query */;
select count(*) from t1 /* must be 3 */;
count(*)
@ -559,10 +545,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 1 */;
count(*)
@ -576,11 +561,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 2 */;
count(*)
@ -598,7 +581,7 @@ master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Update_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 2 */;
count(*)
@ -613,10 +596,9 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t4)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 4 */;
count(*)
@ -646,11 +628,10 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t3)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 1 */;
count(*)
@ -669,12 +650,9 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t2)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Delete_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 1 */;
count(*)
@ -694,12 +672,9 @@ count(*)
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t4)
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: #
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
@ -720,12 +695,6 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.ti)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Table_map # # table_id: # (test.ti)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # ROLLBACK
select count(*) from ti /* zero */;
count(*)
0
@ -743,6 +712,8 @@ insert into ti values (2) /* to make the dup error in the following */;
insert into tt select * from ti /* one affected and error */;
ERROR 23000: Duplicate entry '2' for key 'a'
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
select count(*) from ti /* zero */;
@ -772,8 +743,10 @@ insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=3
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 3 */;
count(*)
3
@ -787,8 +760,10 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 5 */;
count(*)
5
@ -809,10 +784,6 @@ insert into t2 values (bug27417(1));
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=1
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(1))
master-bin.000001 # Query # # ROLLBACK
select count(*) from t1 /* must be 1 */;
count(*)
1
@ -824,10 +795,6 @@ insert into t2 select bug27417(1) union select bug27417(2);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=2
master-bin.000001 # Query # # use `test`; insert into t2 select bug27417(1) union select bug27417(2)
master-bin.000001 # Query # # ROLLBACK
select count(*) from t1 /* must be 2 */;
count(*)
2
@ -838,8 +805,10 @@ update t3 set b=b+bug27417(1);
ERROR 23000: Duplicate entry '4' for key 'b'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 2 */;
count(*)
2
@ -852,10 +821,6 @@ UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */;
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=6
master-bin.000001 # Query # # use `test`; UPDATE t4,t3 SET t4.a=t3.a + bug27417(1) /* top level non-ta table */
master-bin.000001 # Query # # ROLLBACK
select count(*) from t1 /* must be 4 */;
count(*)
4
@ -883,10 +848,6 @@ delete from t2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=9
master-bin.000001 # Query # # use `test`; delete from t2
master-bin.000001 # Query # # ROLLBACK
select count(*) from t1 /* must be 1 */;
count(*)
1
@ -903,9 +864,6 @@ delete t2.* from t2,t5 where t2.a=t5.a + 1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; delete t2.* from t2,t5 where t2.a=t5.a + 1
master-bin.000001 # Query # # ROLLBACK
select count(*) from t1 /* must be 1 */;
count(*)
1
@ -923,14 +881,6 @@ count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=#
master-bin.000001 # Intvar # # INSERT_ID=10
master-bin.000001 # User var # # @`b`=_latin1 0x3135 COLLATE latin1_swedish_ci
master-bin.000001 # Execute_load_query # # use `test`; LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE `t4` FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n' (a, @b) SET b=((@b) + `bug27417`(2)) ;file_id=#
master-bin.000001 # Query # # ROLLBACK
drop trigger trg_del_t2;
drop table t1,t2,t3,t4,t5;
drop function bug27417;

View file

@ -5,14 +5,27 @@ insert delayed into t1 values (300);
FLUSH TABLES;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_latin1'Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT' COLLATE 'latin1_swedish_ci'))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (207)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=208
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (null)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert delayed into t1 values (300)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; FLUSH TABLES
insert delayed into t1 values (null),(null),(null),(null);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
insert delayed into t1 values (null),(null),(400),(null);
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses INSERT DELAYED. This is unsafe because the time when rows are inserted cannot be predicted.
select * from t1;
a
207

View file

@ -592,8 +592,10 @@ show binlog events from 0;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4
master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned)
master-bin.000001 228 Query 1 352 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
master-bin.000001 352 Query 1 428 use `test`; drop table t1
master-bin.000001 228 Query 1 296 BEGIN
master-bin.000001 296 Query 1 420 use `test`; insert into t1 values (9999999999999999,14632475938453979136)
master-bin.000001 420 Query 1 489 COMMIT
master-bin.000001 489 Query 1 565 use `test`; drop table t1
reset master;
CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
USE bug39182;
@ -699,16 +701,24 @@ use test;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=127
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
drop table t1,t2,t3,tt1;
create table t1 (a int not null auto_increment, primary key (a)) engine=myisam;
insert delayed into t1 values (207);
@ -718,16 +728,24 @@ FLUSH TABLES;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=127
master-bin.000001 # Query # # use `test`; insert into t1 values(null)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # use `test`; create table if not exists t2 select * from t1
master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int)
master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test')
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@'
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2,t3,tt1
master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam
master-bin.000001 # Query # # BEGIN
@ -799,7 +817,9 @@ SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # Server ver: #, Binlog ver: #
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
# # Query 1 # BEGIN
# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
# # Query 1 # COMMIT
# # Query 1 # BEGIN
# # Table_map 1 # table_id: # (test.t1)
# # Write_rows 1 # table_id: # flags: STMT_END_F

View file

@ -1,3 +1,4 @@
CALL mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
drop table if exists t1,t2;
CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,

View file

@ -5,15 +5,15 @@ reset master;
insert into t2 values (@v);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
master-bin.000001 # Query # # use `test`; insert into t2 values (@v)
master-bin.000001 # Query # # COMMIT
flush logs;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
ROLLBACK/*!*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
@ -23,8 +23,16 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
BEGIN
/*!*/;
SET @`v`:=_ucs2 0x006100620063 COLLATE `ucs2_general_ci`/*!*/;
use test/*!*/;
SET TIMESTAMP=10000/*!*/;
insert into t2 values (@v)
/*!*/;
SET TIMESTAMP=10000/*!*/;
COMMIT
/*!*/;
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;

View file

@ -25,11 +25,11 @@ use b42829;
### binlog-do-db is not filtering used database
BEGIN;
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
INSERT INTO t1 SELECT * FROM t2;
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
ERROR HY000: Cannot execute statement: binlogging impossible since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
COMMIT;
### assertion: filtered events did not make into the binlog
show binlog events from <binlog_start>;

View file

@ -9,7 +9,7 @@ drop table if exists t1;
create table t1 (a int) engine=innodb;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 1
Binlog_cache_use 2
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1
@ -18,7 +18,7 @@ delete from t1;
commit;
show status like "binlog_cache_use";
Variable_name Value
Binlog_cache_use 2
Binlog_cache_use 4
show status like "binlog_cache_disk_use";
Variable_name Value
Binlog_cache_disk_use 1

View file

@ -8,7 +8,9 @@ insert into t1 select * from t2;
ERROR 23000: Duplicate entry '2' for key 'a'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 select * from t2
master-bin.000001 # Query # # COMMIT
select * from t1;
a
1

View file

@ -1,4 +1,5 @@
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");
drop table if exists t1, t2;
create table t1 (a int) engine=innodb;
create table t2 (a int) engine=myisam;
@ -6,6 +7,8 @@ reset master;
begin;
insert into t1 values(1);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
commit;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
@ -19,6 +22,8 @@ reset master;
begin;
insert into t1 values(2);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@ -36,6 +41,8 @@ insert into t1 values(3);
savepoint my_savepoint;
insert into t1 values(4);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@ -57,6 +64,8 @@ insert into t1 values(5);
savepoint my_savepoint;
insert into t1 values(6);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
rollback to savepoint my_savepoint;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@ -85,6 +94,8 @@ get_lock("a",10)
begin;
insert into t1 values(8);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select get_lock("a",10);
get_lock("a",10)
1
@ -99,24 +110,32 @@ delete from t2;
reset master;
insert into t1 values(9);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(9)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
master-bin.000001 # Query # # COMMIT
delete from t1;
delete from t2;
reset master;
insert into t1 values(10);
begin;
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(10)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
master-bin.000001 # Query # # COMMIT
insert into t1 values(11);
commit;
show binlog events from <binlog_start>;
@ -124,7 +143,9 @@ Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(10)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 select * from t1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values(11)
master-bin.000001 # Xid # # COMMIT /* XID */
@ -226,7 +247,7 @@ insert t0 select * from t1;
set autocommit=1;
insert into t0 select GET_LOCK("lock1",null);
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
set autocommit=0;
create table t2 (n int) engine=innodb;
insert into t2 values (3);
@ -249,17 +270,29 @@ master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (1)
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t2 values (20)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; drop table t1,t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into ti values(1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert t1 values (1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t0 (n int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert t0 select * from t1
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb
master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti`
do release_lock("lock1");
@ -343,24 +376,42 @@ a b
DROP TABLE t1,t2;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (1,1),(1,2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4,4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Xid # # COMMIT /* XID */
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP TABLE t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (7,7)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; TRUNCATE table t2
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100)
master-bin.000001 # Query # # COMMIT
@ -374,6 +425,8 @@ get_lock("a",10)
begin;
insert into t1 values(8);
insert into t2 select * from t1;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select get_lock("a",10);
get_lock("a",10)
1
@ -399,6 +452,8 @@ begin;
insert into ti values (1);
insert into ti values (2) ;
insert into tt select * from ti;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@ -416,6 +471,8 @@ select count(*) from ti /* zero */;
count(*)
0
insert into ti select * from tt;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select * from ti /* that is what slave would miss - a bug */;
a
1
@ -442,6 +499,8 @@ select count(*) from ti /* zero */;
count(*)
0
insert into ti select * from tt;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select * from tt /* that is what otherwise slave missed - the bug */;
a
1
@ -460,17 +519,19 @@ end|
reset master;
insert into t2 values (bug27417(1));
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
insert into t2 select bug27417(2);
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
reset master;
insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=3
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
master-bin.000001 # Query # # COMMIT
/* only (!) with fixes for #23333 will show there is the query */;
select count(*) from t1 /* must be 3 */;
count(*)
@ -481,14 +542,16 @@ count(*)
2
delete from t2 where a=bug27417(3);
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t2 /* nothing got deleted */;
count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
master-bin.000001 # Query # # COMMIT
/* the query must be in regardless of #23333 */;
select count(*) from t1 /* must be 5 */;
count(*)
@ -496,7 +559,7 @@ count(*)
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
affected rows: 0
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t1 /* must be 7 */;
count(*)
7
@ -543,8 +606,10 @@ update t3 set b=b+bug27417(1);
ERROR 23000: Duplicate entry '4' for key 'b'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
master-bin.000001 # Query # # COMMIT
/* the output must denote there is the query */;
select count(*) from t1 /* must be 2 */;
count(*)
@ -651,6 +716,8 @@ begin;
insert into ti values (1);
insert into ti values (2) ;
insert into tt select * from ti;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
rollback;
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
@ -668,6 +735,8 @@ select count(*) from ti /* zero */;
count(*)
0
insert into ti select * from tt;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select * from ti /* that is what slave would miss - bug#28960 */;
a
1
@ -694,6 +763,8 @@ select count(*) from ti /* zero */;
count(*)
0
insert into ti select * from tt;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
select * from tt /* that is what otherwise slave missed - the bug */;
a
1
@ -712,17 +783,19 @@ end|
reset master;
insert into t2 values (bug27417(1));
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
insert into t2 select bug27417(2);
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
reset master;
insert into t2 values (bug27417(2));
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=3
master-bin.000001 # Query # # use `test`; insert into t2 values (bug27417(2))
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 3 */;
count(*)
3
@ -732,21 +805,23 @@ count(*)
2
delete from t2 where a=bug27417(3);
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t2 /* nothing got deleted */;
count(*)
2
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; delete from t2 where a=bug27417(3)
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 5 */;
count(*)
5
delete t2 from t2 where t2.a=bug27417(100) /* must not affect t2 */;
affected rows: 0
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement updates two AUTO_INCREMENT columns. This is unsafe because the generated value cannot be predicted by slave.
select count(*) from t1 /* must be 7 */;
count(*)
7
@ -791,8 +866,10 @@ update t3 set b=b+bug27417(1);
ERROR 23000: Duplicate entry '4' for key 'b'
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Intvar # # INSERT_ID=4
master-bin.000001 # Query # # use `test`; update t3 set b=b+bug27417(1)
master-bin.000001 # Query # # COMMIT
select count(*) from t1 /* must be 2 */;
count(*)
2

View file

@ -11,12 +11,18 @@ prepare s from "insert into t1 select 100 limit ?";
set @a=100;
execute s using @a;
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Query # # use `test`; create table t1 (a int)
master-bin.000001 # Query # # BEGIN
master-bin.000001 # User var # # @`a`=98
master-bin.000001 # Query # # use `test`; insert into t1 values (@a),(98)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 values (99)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; insert into t1 select 100 limit 100
master-bin.000001 # Query # # COMMIT
drop table t1;

View file

@ -1,4 +1,4 @@
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");
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
set @saved_global_binlog_format = @@global.binlog_format;
@ -31,7 +31,7 @@ RELEASE_LOCK('Bug#34306')
1
# con2
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
SELECT RELEASE_LOCK('Bug#34306');
RELEASE_LOCK('Bug#34306')
1
@ -63,11 +63,21 @@ master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t2
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT)
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 LIKE t1
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(1)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES(2)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t1 SELECT * FROM t2 WHERE GET_LOCK('Bug#34306', 120)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (3)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (4)
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # BEGIN
master-bin.000001 # Table_map # # table_id: # (test.t1)
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F

View file

@ -1,13 +1,15 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*");
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*");
### NOT filtered database => assertion: warnings ARE shown
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int, b int, primary key (a));
INSERT INTO t1 VALUES (1,2), (2,3);
UPDATE t1 SET b='4' WHERE a=1 LIMIT 1;
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
UPDATE t1 SET b='5' WHERE a=2 ORDER BY a LIMIT 1;
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted.
DROP TABLE t1;
### NOT filtered database => assertion: binlog disabled and warnings ARE NOT shown
SET SQL_LOG_BIN= 0;
@ -38,11 +40,11 @@ CREATE TABLE t1 (a VARCHAR(36), b VARCHAR(10));
SET GLOBAL LOG_WARNINGS = 0;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
SET GLOBAL LOG_WARNINGS = 1;
INSERT INTO t1 VALUES(UUID(), 'Bug#46265');
Warnings:
Note 1592 Statement may not be safe to log in statement format.
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave.
DROP TABLE t1;
SET GLOBAL log_warnings = @old_log_warnings;
# Count the number of times the "Unsafe" message was printed

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,98 @@
#
# BUG#47863
# This test verifies if the session variable 'binlog_format'
# is read-only inside a transaction and in sub-statements.
#
source include/have_innodb.inc;
source include/have_binlog_format_row.inc;
set @save_binlog_format= @@global.binlog_format;
create table t1 (a int) engine= myisam;
create table t2 (a int) engine= innodb;
SELECT @@session.binlog_format;
SET AUTOCOMMIT=1;
--echo # Test that the session variable 'binlog_format'
--echo # is writable outside a transaction.
set @@session.binlog_format= statement;
SELECT @@session.binlog_format;
begin;
--echo # Test that the session variable 'binlog_format' is read-only
--echo # inside a transaction with no preceding updates.
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set @@session.binlog_format= mixed;
insert into t2 values (1);
--echo # Test that the session variable 'binlog_format' is read-only
--echo # inside a transaction with preceding transactional updates.
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set @@session.binlog_format= row;
commit;
begin;
insert into t1 values (2);
--echo # Test that the session variable 'binlog_format' is read-only
--echo # inside a transaction with preceding non-transactional updates.
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set @@session.binlog_format= statement;
commit;
--echo # Test that the session variable 'binlog_format' is writable
--echo # when AUTOCOMMIT=0, before a transaction has started.
set AUTOCOMMIT=0;
set @@session.binlog_format= row;
SELECT @@session.binlog_format;
insert into t1 values (4);
--echo # Test that the session variable 'binlog_format' is read-only inside an
--echo # AUTOCOMMIT=0 transaction with preceding non-transactional updates.
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set @@session.binlog_format= statement;
SELECT @@session.binlog_format;
commit;
insert into t2 values (5);
--echo # Test that the session variable 'binlog_format' is read-only inside an
--echo # AUTOCOMMIT=0 transaction with preceding transactional updates.
--error ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT
set @@session.binlog_format= row;
SELECT @@session.binlog_format;
commit;
begin;
insert into t2 values (6);
--echo # Test that the global variable 'binlog_format' is writable
--echo # inside a transaction.
SELECT @@global.binlog_format;
set @@global.binlog_format= statement;
SELECT @@global.binlog_format;
commit;
set @@global.binlog_format= @save_binlog_format;
create table t3(a int, b int) engine= innodb;
create table t4(a int) engine= innodb;
create table t5(a int) engine= innodb;
delimiter |;
eval create trigger tr2 after insert on t3 for each row begin
insert into t4(a) values(1);
set @@session.binlog_format= statement;
insert into t4(a) values(2);
insert into t5(a) values(3);
end |
delimiter ;|
--echo # Test that the session variable 'binlog_format' is read-only
--echo # in sub-statements.
--error ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT
insert into t3(a,b) values(1,1);
SELECT @@session.binlog_format;
drop table t1;
drop table t2;
drop table t3;
drop table t4;
drop table t5;

View file

@ -27,13 +27,13 @@ SET BINLOG_FORMAT=STATEMENT;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
error ER_BINLOG_LOGGING_IMPOSSIBLE;
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
UPDATE t1 SET b = 1*a WHERE a > 1;
COMMIT;
BEGIN;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
error ER_BINLOG_LOGGING_IMPOSSIBLE;
error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE;
UPDATE t1 SET b = 2*a WHERE a > 2;
COMMIT;

View file

@ -1,6 +1,8 @@
-- source include/have_innodb.inc
-- source include/have_binlog_format_statement.inc
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
# You cannot use `KILL' with the Embedded MySQL Server library,
# because the embedded server merely runs inside the threads of the host
# application. -- the docs
@ -51,7 +53,7 @@ reap;
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
let $MYSQLD_DATADIR= `select @@datadir`;
--exec $MYSQL_BINLOG --force-if-open --start-position=135 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--exec $MYSQL_BINLOG --force-if-open --start-position=175 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))

View file

@ -52,7 +52,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
source include/show_binlog_events.inc;
--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--exec $MYSQL_BINLOG --force-if-open --start-position=210 --stop-position=387 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))

View file

@ -1,4 +0,0 @@
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
--source extra/binlog_tests/binlog_failure_mixing_engines.test

View file

@ -7,6 +7,8 @@ source include/have_blackhole.inc;
source include/have_ndb.inc;
source include/have_log_bin.inc;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
CREATE TABLE t1m (m INT, n INT) ENGINE=MYISAM;
CREATE TABLE t1b (b INT, c INT) ENGINE=BLACKHOLE;
CREATE TABLE t1n (e INT, f INT) ENGINE=NDB;
@ -22,8 +24,10 @@ UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
# Here and below we need to wait when some event appears in binlog
# to avoid unsrted mixing local events and from NDB
let $wait_binlog_event= t1m, t1b;
let $wait_binlog_event= COMMIT;
source include/wait_for_binlog_event.inc;
let $event= query_get_value(SHOW BINLOG EVENTS, Info, 9);
--echo The last event before the COMMIT is $event
echo *** Please look in binlog_multi_engine.test if you have a diff here ****;
START TRANSACTION;
@ -51,8 +55,10 @@ SET SESSION BINLOG_FORMAT=MIXED;
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
let $wait_binlog_event= t1m;
let $wait_binlog_event= COMMIT;
source include/wait_for_binlog_event.inc;
let $event= query_get_value(SHOW BINLOG EVENTS, Info, 6);
--echo The last event before the COMMIT is $event
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
@ -60,7 +66,7 @@ let $wait_binlog_event= COMMIT;
source include/wait_for_binlog_event.inc;
UPDATE t1m, t1b SET m = 2, b = 3 WHERE n = c;
error ER_BINLOG_LOGGING_IMPOSSIBLE;
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
# Not possible to test this since NDB writes its own binlog, which
@ -84,7 +90,7 @@ INSERT INTO t1m VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1b VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t1n VALUES (1,1), (1,2), (2,1), (2,2);
error ER_BINLOG_LOGGING_IMPOSSIBLE;
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
# Not possible to test this since NDB writes its own binlog, which
@ -93,7 +99,7 @@ UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
#UPDATE t1m, t1n SET m = 2, e = 3 WHERE n = f;
error ER_BINLOG_LOGGING_IMPOSSIBLE;
error ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE;
UPDATE t1n, t1b SET e = 2, b = 3 WHERE f = c;
source include/show_binlog_events.inc;

View file

@ -1,4 +0,0 @@
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--source extra/binlog_tests/binlog_failure_mixing_engines.test

View file

@ -6,4 +6,7 @@
-- disable_query_log
reset master; # get rid of previous tests binlog
-- enable_query_log
disable_query_log;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
-- source extra/binlog_tests/binlog_insert_delayed.test

View file

@ -74,11 +74,11 @@ INSERT INTO t1 SELECT * FROM t2;
-- echo ### assertion: the statements *will* raise log error because
-- echo ### binlog-do-db is not filtering used database
BEGIN;
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
-- error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
INSERT INTO t1 SELECT * FROM t2;
COMMIT;

View file

@ -3,6 +3,10 @@
-- source include/not_embedded.inc
-- source include/have_binlog_format_statement.inc
disable_query_log;
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log;
-- disable_query_log
reset master; # get rid of previous tests binlog
-- enable_query_log

View file

@ -2,7 +2,7 @@
# Test sets its own binlog_format, so we restrict it to run only once
--source include/have_binlog_format_row.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");
# Get rid of previous tests binlog
--disable_query_log

View file

@ -25,6 +25,8 @@
-- source include/have_log_bin.inc
-- source include/have_binlog_format_statement.inc
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a LIMIT clause. This is unsafe because the set of rows included cannot be predicted. .*");
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Statement uses a system function whose value may differ on slave. .*");
-- echo ### NOT filtered database => assertion: warnings ARE shown

View file

@ -0,0 +1 @@
$UDF_EXAMPLE_LIB_OPT --log-output=file,table

View file

@ -1,34 +1,61 @@
# ==== Background ====
#
# Some statements may execute differently on master and slave when
# logged in statement format. Such statements are called unsafe.
# Unsafe statements include:
#
# - statements using @@variables (with a small number of exceptions;
# see below);
# - statements using certain functions, e.g., UUID();
# - statements using LIMIT;
# - INSERT DELAYED;
# - insert into two autoinc columns;
# - statements using UDF's.
# - statements reading from log tables in the mysql database.
#
# Note that statements that use stored functions, stored procedures,
# triggers, views, or prepared statements that invoke unsafe
# statements shall also be unsafe.
#
# Unsafeness of a statement shall have the following consequences:
#
# 1. If the binlogging is on and the unsafe statement is logged:
# - If binlog_format=STATEMENT, the statement shall give a warning.
# - If binlog_format=MIXED or binlog_format=ROW, the statement shall
# be logged in row format.
#
# 2. If binlogging is off or the statement is not logged (e.g. SELECT
# UUID()), no warning shall be issued and the statement shall not
# be logged.
#
# Moreover, when a sub-statement of a recursive construct (i.e.,
# stored function, stored procedure, trigger, view, or prepared
# statement) is unsafe and binlog_format=STATEMENT, then a warning
# shall be issued for every recursive construct. In effect, this
# creates a stack trace from the top-level statement to the unsafe
# statement.
#
#
# ==== Purpose ====
#
# Some statements can not be written to the binlog in a safe manner
# with statement-based replication, either because they rely on
# features that are local to the server they are replicated from
# (e.g., @@variables), or because they include nondeterministic
# queries (e.g., LIMIT), or because the time at which the query is
# executed cannot be determined (e.g., INSERT DELAYED). Such
# statements should be marked unsafe. All unsafe statements should
# give a warning.
# Yet the warning/error message isn't issued when SQL_LOG_BIN is turned off.
# This test verifies that a warning is generated when it should,
# according to the rules above.
#
# This test verifies that a warning is generated for statements that
# should be unsafe, when they are executed under statement mode
# logging.
#
# All variables should be unsafe, with some exceptions. Therefore,
# this test also verifies that the exceptions do *not* generare a
# All @@variables should be unsafe, with some exceptions. Therefore,
# this test also verifies that the exceptions do *not* generate a
# warning.
#
#
# ==== Method ====
#
# We try an INSERT DELAYED statement and verify that a warning is
# issued.
# 1. Each type of statements listed above is executed.
#
# We try to insert unsafe variables into a table in several ways:
# directly with an INSERT statement, from a stored procedure, from a
# stored function, from a trigger, from a prepared statement, and from
# a complicated nesting of triggers, functions, procedures, and
# prepared statements. In all cases, a warning should be issued.
# 2. Each unsafe statement is wrapped in each type of recursive
# construct (stored function, stored procedure, trigger, view, or
# prepared statement).
#
# 3. Each unsafe statement is wrapped in two levels of recursive
# constructs (function invoking trigger invoking UUID(), etc).
#
# We try to insert the variables that should not be unsafe into a
# table, and verify that *no* warning is issued.
@ -38,7 +65,8 @@
# Execute a unsafe statement calling a trigger or stored function
# or neither when @@SQL_LOG_BIN is turned OFF,
# no warning/error is issued
#
#
# ==== Related bugs and worklogs ====
#
# WL#3339: Issue warnings when statement-based replication may fail
@ -47,6 +75,9 @@
# BUG#34768: nondeterministic INSERT using LIMIT logged in stmt mode if binlog_format=mixed
# BUG#41980, SBL, INSERT .. SELECT .. LIMIT = ERROR, even when @@SQL_LOG_BIN is 0
# BUG#42640: mysqld crashes when unsafe statements are executed (STRICT_TRANS_TABLES mode)
# BUG#45825: INSERT DELAYED is not unsafe: logged in statement format
# BUG#45785: LIMIT in SP does not cause RBL if binlog_format=MIXED
#
#
# ==== Related test cases ====
#
@ -57,192 +88,313 @@
# rpl.rpl_variables_stm tests the small subset of variables that
# actually can be replicated safely in statement mode.
#
#
# ==== Todo ====
#
# There are several other ways to create unsafe statements: see, e.g.,
# WL#3339, BUG#34768.
# rpl_ndb.rpl_ndb_binlog_format_errors tests all errors and warnings
# related to logging format (not just 'Unsafe statement binlogged in
# statement mode since BINLOG_FORMAT = STATEMENT').
source include/have_log_bin.inc;
source include/have_binlog_format_statement.inc;
--source include/have_udf.inc
--source include/have_log_bin.inc
--source include/have_binlog_format_statement.inc
--echo ==== Setup tables ====
--disable_query_log
call mtr.add_suppression("Unsafe statement binlogged in statement format");
--enable_query_log
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a CHAR(40));
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE trigger_table (a CHAR(7));
CREATE TABLE trigger_table2 (a INT);
--echo #### Setup tables ####
CREATE TABLE t0 (a CHAR(100));
CREATE TABLE t1 (a CHAR(100));
CREATE TABLE t2 (a CHAR(100));
CREATE TABLE t3 (a CHAR(100));
CREATE TABLE ta0 (a CHAR(100));
CREATE TABLE ta1 (a CHAR(100));
CREATE TABLE ta2 (a CHAR(100));
CREATE TABLE ta3 (a CHAR(100));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
CREATE TABLE data_table (a CHAR(100));
INSERT INTO data_table VALUES ('foo');
CREATE TABLE trigger_table_1 (a INT);
CREATE TABLE trigger_table_2 (a INT);
CREATE TABLE trigger_table_3 (a INT);
CREATE TABLE double_autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
--echo ==== Non-deterministic statements ====
INSERT DELAYED INTO t1 VALUES (5);
--echo ==== Some variables that *should* be unsafe ====
--echo ---- Insert directly ----
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
--echo ---- Insert from stored procedure ----
DELIMITER |;
CREATE PROCEDURE proc()
--DELIMITER |
CREATE TRIGGER double_autoinc_trig
BEFORE INSERT ON double_autoinc_table FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
DELIMITER ;|
CALL proc();
--echo ---- Insert from stored function ----
DELIMITER |;
CREATE FUNCTION func()
RETURNS INT
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
RETURN 0;
END|
DELIMITER ;|
SELECT func();
--echo ---- Insert from trigger ----
DELIMITER |;
CREATE TRIGGER trig
BEFORE INSERT ON trigger_table
FOR EACH ROW
BEGIN
INSERT INTO t1 VALUES (@@global.sync_binlog);
INSERT INTO t1 VALUES (@@session.insert_id);
INSERT INTO t1 VALUES (@@global.auto_increment_increment);
INSERT INTO t2 SELECT UUID();
INSERT INTO t2 VALUES (@@session.sql_mode);
INSERT INTO t2 VALUES (@@global.init_slave);
INSERT INTO t2 VALUES (@@hostname);
END|
DELIMITER ;|
INSERT INTO trigger_table VALUES ('bye.');
--echo ---- Insert from prepared statement ----
PREPARE p1 FROM 'INSERT INTO t1 VALUES (@@global.sync_binlog)';
PREPARE p2 FROM 'INSERT INTO t1 VALUES (@@session.insert_id)';
PREPARE p3 FROM 'INSERT INTO t1 VALUES (@@global.auto_increment_increment)';
PREPARE p4 FROM 'INSERT INTO t2 SELECT UUID()';
PREPARE p5 FROM 'INSERT INTO t2 VALUES (@@session.sql_mode)';
PREPARE p6 FROM 'INSERT INTO t2 VALUES (@@global.init_slave)';
PREPARE p7 FROM 'INSERT INTO t2 VALUES (@@hostname)';
EXECUTE p1; EXECUTE p2; EXECUTE p3; EXECUTE p4; EXECUTE p5;
EXECUTE p6; EXECUTE p7;
--echo ---- Insert from nested call of triggers / functions / procedures ----
DELIMITER |;
# proc1: cause trigger 'trig' above to be triggered.
CREATE PROCEDURE proc1()
INSERT INTO trigger_table VALUES ('ha!')|
# func2: call proc1 above.
CREATE FUNCTION func2()
RETURNS INT
BEGIN
CALL proc1();
RETURN 0;
INSERT INTO autoinc_table VALUES (NULL);
END|
# trig3: call func2 above
CREATE TRIGGER trig3
BEFORE INSERT ON trigger_table2
FOR EACH ROW
CREATE FUNCTION multi_unsafe_func() RETURNS INT
BEGIN
DECLARE tmp INT;
SELECT func2() INTO tmp;
INSERT INTO t0 VALUES(CONCAT(@@hostname, @@hostname));
INSERT INTO t0 VALUES(0);
INSERT INTO t0 VALUES(CONCAT(UUID(), @@hostname));
RETURN 1;
END|
--DELIMITER ;
# proc4: cause trig3 above to be triggered.
CREATE PROCEDURE proc4()
INSERT INTO trigger_table2 VALUES (1)|
--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
--eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"
# func5: call proc4 above.
CREATE FUNCTION func5()
RETURNS INT
BEGIN
CALL proc4;
RETURN 0;
END|
# In each iteration of this loop, we select one method to make the
# statement unsafe.
--let $unsafe_type= 0
while (`SELECT $unsafe_type < 9`) {
# prep6: call func5() above.
PREPARE prep6 FROM 'SELECT func5()'|
--echo
DELIMITER ;|
if (`SELECT $unsafe_type = 0`) {
--echo ==== Testing UUID() unsafeness ====
--let $desc_0= unsafe UUID() function
--let $stmt_sidef_0= INSERT INTO t0 VALUES (UUID())
--let $value_0= UUID()
--let $sel_sidef_0=
--let $sel_retval_0= SELECT UUID()
--let $CRC_ARG_expected_number_of_warnings= 1
}
# try a complicated call path to trigger 'trig'.
EXECUTE prep6;
if (`SELECT $unsafe_type = 1`) {
--echo ==== Testing @@hostname unsafeness ====
--let $desc_0= unsafe @@hostname variable
--let $stmt_sidef_0= INSERT INTO t0 VALUES (@@hostname)
--let $value_0= @@hostname
--let $sel_sidef_0=
# $sel_retval is going to be used in views. Views cannot execute
# statements that refer to @@variables. Hence, we set $set_retval
# to empty instead of SELECT @@hostname.
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 2`) {
--echo ==== Testing SELECT...LIMIT unsafeness ====
--let $desc_0= unsafe SELECT...LIMIT statement
--let $stmt_sidef_0= INSERT INTO t0 SELECT * FROM data_table LIMIT 1
--let $value_0=
--let $sel_sidef_0=
--let $sel_retval_0= SELECT * FROM data_table LIMIT 1
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 3`) {
--echo ==== Testing INSERT DELAYED unsafeness ====
--let $desc_0= unsafe INSERT DELAYED statement
--let $stmt_sidef_0= INSERT DELAYED INTO t0 VALUES (1), (2)
--let $value_0=
--let $sel_sidef_0=
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 4`) {
--echo ==== Testing unsafeness of insert of two autoinc values ====
--let $desc_0= unsafe update of two autoinc columns
--let $stmt_sidef_0= INSERT INTO double_autoinc_table VALUES (NULL)
--let $value_0=
--let $sel_sidef_0=
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 5`) {
--echo ==== Testing unsafeness of UDF's ====
--let $desc_0= unsafe UDF
--let $stmt_sidef_0= INSERT INTO t0 VALUES (myfunc_int(10))
--let $value_0= myfunc_int(10)
--let $sel_sidef_0= SELECT myfunc_int(10)
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 6`) {
--echo ==== Testing unsafeness of access to mysql.general_log ====
--let $desc_0= unsafe use of mysql.general_log
--let $stmt_sidef_0= INSERT INTO t0 SELECT COUNT(*) FROM mysql.general_log
--let $value_0=
--let $sel_sidef_0=
--let $sel_retval_0= SELECT COUNT(*) FROM mysql.general_log
--let $CRC_ARG_expected_number_of_warnings= 1
}
if (`SELECT $unsafe_type = 7`) {
--echo ==== Testing a statement that is unsafe in many ways ====
--let $desc_0= statement that is unsafe in many ways
# Concatenate three unsafe values, and then concatenate NULL to
# that so that the result is NULL and we instead use autoinc.
--let $stmt_sidef_0= INSERT DELAYED INTO double_autoinc_table SELECT CONCAT(UUID(), @@hostname, myfunc_int(), NULL) FROM mysql.general_log LIMIT 1
--let $value_0=
--let $sel_sidef_0=
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 7
}
if (`SELECT $unsafe_type = 8`) {
--echo ==== Testing a statement that is unsafe several times ====
--let $desc_0= statement that is unsafe several times
--let $stmt_sidef_0= INSERT INTO ta0 VALUES (multi_unsafe_func())
--let $value_0=
--let $sel_sidef_0= SELECT multi_unsafe_func()
--let $sel_retval_0=
--let $CRC_ARG_expected_number_of_warnings= 2
}
# In each iteration of the following loop, we select one way to
# enclose the unsafe statement as a sub-statement of a recursive
# construct (i.e., a function, procedure, trigger, view, or prepared
# statement).
#
# In the last iteration, $call_type_1=7, we don't create a recursive
# construct. Instead, we just invoke the unsafe statement directly.
--let $call_type_1= 0
while (`SELECT $call_type_1 < 8`) {
#--echo debug: level 1, types $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 1
--let $CRC_ARG_type= $call_type_1
--let $CRC_ARG_stmt_sidef= $stmt_sidef_0
--let $CRC_ARG_value= $value_0
--let $CRC_ARG_sel_sidef= $sel_sidef_0
--let $CRC_ARG_sel_retval= $sel_retval_0
--let $CRC_ARG_desc= $desc_0
--source extra/rpl_tests/create_recursive_construct.inc
--let $stmt_sidef_1= $CRC_RET_stmt_sidef
--let $value_1= $CRC_RET_value
--let $sel_sidef_1= $CRC_RET_sel_sidef
--let $sel_retval_1= $CRC_RET_sel_retval
--let $is_toplevel_1= $CRC_RET_is_toplevel
--let $drop_1= $CRC_RET_drop
--let $desc_1= $CRC_RET_desc
# Some statements must be top-level statements, i.e., cannot be
# called as a sub-statement of any recursive construct. (One
# example is 'EXECUTE prepared_stmt'). When
# create_recursive_construct.inc creates a top-level statement, it
# sets $CRC_RET_is_toplevel=1.
if (!$is_toplevel_1) {
# In each iteration of this loop, we select one way to enclose
# the previous recursive construct in another recursive
# construct.
--let $call_type_2= 0
while (`SELECT $call_type_2 < 7`) {
#--echo debug: level 2, types $call_type_2 -> $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 2
--let $CRC_ARG_type= $call_type_2
--let $CRC_ARG_stmt_sidef= $stmt_sidef_1
--let $CRC_ARG_value= $value_1
--let $CRC_ARG_sel_sidef= $sel_sidef_1
--let $CRC_ARG_sel_retval= $sel_retval_1
--let $CRC_ARG_desc= $desc_1
--source extra/rpl_tests/create_recursive_construct.inc
--let $stmt_sidef_2= $CRC_RET_stmt_sidef
--let $value_2= $CRC_RET_value
--let $sel_sidef_2= $CRC_RET_sel_sidef
--let $sel_retval_2= $CRC_RET_sel_retval
--let $is_toplevel_2= $CRC_RET_is_toplevel
--let $drop_2= $CRC_RET_drop
--let $desc_2= $CRC_RET_desc
if (!$is_toplevel_2) {
# Conditioned out since it makes result file really big.
if (0) {
# In each iteration of this loop, we select one way to enclose
# the previous recursive construct in another recursive
# construct.
--let $call_type_3= 0
while (`SELECT $call_type_3 < 7`) {
#--echo debug: level 3, types $call_type_2 -> $call_type_2 -> $call_type_1 -> $unsafe_type
--let $CRC_ARG_level= 3
--let $CRC_ARG_type= $call_type_3
--let $CRC_ARG_stmt_sidef= $stmt_sidef_2
--let $CRC_ARG_value= $value_2
--let $CRC_ARG_sel_sidef= $sel_sidef_2
--let $CRC_ARG_sel_retval= $sel_retval_2
--let $CRC_ARG_desc= $desc_2
--source extra/rpl_tests/create_recursive_construct.inc
# Drop created object.
if (`SELECT '$drop_3' != ''`) {
--eval $drop_3
}
--inc $call_type_3
} # while (call_type_3)
} # if (0)
} # if (!is_toplevel_2)
# Drop created object.
if (`SELECT '$drop_2' != ''`) {
--eval $drop_2
}
--inc $call_type_2
} # while (call_type_2)
} # if (!is_toplevel_1)
# Drop created object.
if (`SELECT '$drop_1' != ''`) {
--eval $drop_1
}
--inc $call_type_1
} # while (call_type_1)
--inc $unsafe_type
} # while (unsafe_type)
DROP TRIGGER double_autoinc_trig;
DROP TABLE t0, t1, t2, t3, ta0, ta1, ta2, ta3,
autoinc_table, double_autoinc_table,
data_table,
trigger_table_1, trigger_table_2, trigger_table_3;
DROP FUNCTION myfunc_int;
DROP FUNCTION multi_unsafe_func;
--echo ==== Variables that should *not* be unsafe ====
--echo ==== Special system variables that should *not* be unsafe ====
CREATE TABLE t1 (a VARCHAR(1000));
CREATE TABLE autoinc_table (a INT PRIMARY KEY AUTO_INCREMENT);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.unique_checks);
INSERT INTO t1 VALUES (@@session.auto_increment_increment);
INSERT INTO t1 VALUES (@@session.auto_increment_offset);
INSERT INTO t2 VALUES (@@session.character_set_client);
INSERT INTO t2 VALUES (@@session.collation_connection);
INSERT INTO t2 VALUES (@@session.collation_server);
INSERT INTO t2 VALUES (@@session.time_zone);
INSERT INTO t2 VALUES (@@session.lc_time_names);
INSERT INTO t2 VALUES (@@session.collation_database);
INSERT INTO t2 VALUES (@@session.timestamp);
INSERT INTO t2 VALUES (@@session.last_insert_id);
INSERT INTO t1 VALUES (@@session.character_set_client);
INSERT INTO t1 VALUES (@@session.character_set_connection);
INSERT INTO t1 VALUES (@@session.character_set_database);
INSERT INTO t1 VALUES (@@session.character_set_server);
INSERT INTO t1 VALUES (@@session.collation_connection);
INSERT INTO t1 VALUES (@@session.collation_database);
INSERT INTO t1 VALUES (@@session.collation_server);
INSERT INTO t1 VALUES (@@session.foreign_key_checks);
INSERT INTO t1 VALUES (@@session.identity);
INSERT INTO t1 VALUES (@@session.last_insert_id);
INSERT INTO t1 VALUES (@@session.lc_time_names);
INSERT INTO t1 VALUES (@@session.pseudo_thread_id);
INSERT INTO t1 VALUES (@@session.sql_auto_is_null);
INSERT INTO t1 VALUES (@@session.timestamp);
INSERT INTO t1 VALUES (@@session.time_zone);
INSERT INTO t1 VALUES (@@session.unique_checks);
SET @my_var= 4711;
INSERT INTO t1 VALUES (@my_var);
# using insert_id implicitly should be ok.
SET insert_id=12;
INSERT INTO t3 VALUES (NULL);
SET insert_id= 12;
INSERT INTO autoinc_table VALUES (NULL);
# See set_var.cc for explanation.
--echo The following variables *should* give a warning, despite they are replicated.
INSERT INTO t1 VALUES (@@session.sql_mode);
INSERT INTO t1 VALUES (@@session.insert_id);
--echo ==== Clean up ====
DROP TABLE t1, autoinc_table;
DROP PROCEDURE proc;
DROP FUNCTION func;
DROP TRIGGER trig;
DROP PROCEDURE proc1;
DROP FUNCTION func2;
DROP TRIGGER trig3;
DROP PROCEDURE proc4;
DROP FUNCTION func5;
DROP PREPARE prep6;
DROP TABLE t1, t2, t3, trigger_table, trigger_table2;
#
# BUG#34768 - nondeterministic INSERT using LIMIT logged in stmt mode if
# binlog_format=mixed
@ -389,6 +541,41 @@ DELETE FROM t1 LIMIT 1;
DROP TABLE t1, t2;
SET @@SESSION.SQL_MODE = @save_sql_mode;
#
# BUG#45825: INSERT DELAYED is not unsafe: logged in statement format
# BUG#45785: LIMIT in SP does not cause RBL if binlog_format=MIXED
#
SET @old_binlog_format = @@session.binlog_format;
SET binlog_format = MIXED;
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
INSERT INTO t2 VALUES (1), (2);
--DELIMITER |
CREATE PROCEDURE proc_insert_delayed ()
BEGIN
INSERT DELAYED INTO t1 VALUES (1), (2);
END|
CREATE FUNCTION func_limit ()
RETURNS INT
BEGIN
INSERT INTO t1 SELECT * FROM t2 LIMIT 1;
RETURN 1;
END|
--DELIMITER ;
RESET MASTER;
CALL proc_insert_delayed();
SELECT func_limit();
source include/show_binlog_events.inc;
SET @@session.binlog_format = @old_binlog_format;
DROP TABLE t1, t2;
DROP PROCEDURE proc_insert_delayed;
DROP FUNCTION func_limit;
#
# BUG#45827
# The test verifies if stmt that have more than one
@ -426,7 +613,7 @@ eval SHOW BINLOG EVENTS FROM $pos0_master;
# clean up
DROP TABLE t1,t2;
DROP FUNCTION func_modify_t1;
#
# Test case2: stmt that have more than one different tables
# to update with autoinc columns should produce
# unsafe warning when invoking a trigger

View file

@ -15,6 +15,7 @@
source include/have_log_bin.inc;
source include/have_debug.inc;
source include/have_binlog_format_mixed_or_statement.inc;
--echo #
--echo # Initialization

View file

@ -10,4 +10,5 @@
#
##############################################################################
binlog_truncate_innodb : BUG#42643 2009-02-06 mats Changes to InnoDB requires to complete fix for BUG#36763
binlog_unsafe : BUG#50312 2010-01-13 lsoares Warnings for unsafe sub-statement not returned to client

View file

@ -1,3 +1,4 @@
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
drop table if exists t1, t2, t3;
CREATE TABLE t1 (m INT, n INT) ENGINE=MYISAM;
CREATE TABLE t2 (b INT, c INT) ENGINE=BLACKHOLE;
@ -7,18 +8,26 @@ SET SESSION BINLOG_FORMAT=STATEMENT;
INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2);
INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
START TRANSACTION;
INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2);
UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f;
Warnings:
Note 1592 Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT. Reason for unsafeness: Non-transactional reads or writes are unsafe if they occur after transactional reads or writes inside a transaction.
UPDATE t3, t2 SET e = 2, b = 3 WHERE f = c;
COMMIT;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t2 VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t2 SET m = 2, b = 3 WHERE n = c
mysqld-bin.000001 # Query # # COMMIT
mysqld-bin.000001 # Query # # BEGIN
mysqld-bin.000001 # Query # # use `test`; INSERT INTO t3 VALUES (1,1), (1,2), (2,1), (2,2)
mysqld-bin.000001 # Query # # use `test`; UPDATE t1, t3 SET m = 2, e = 3 WHERE n = f

View file

@ -308,7 +308,7 @@ ENGINE = NDB;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
DROP DATABASE mysqltest2;
DROP DATABASE IF EXISTS mysqltest2;
# -----------------------------------------------------------------
# End 6.0 test

View file

@ -6,6 +6,8 @@
-- source include/have_ndb.inc
-- source include/have_log_bin.inc
call mtr.add_suppression("Unsafe statement binlogged in statement format since BINLOG_FORMAT = STATEMENT");
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings

View file

@ -462,7 +462,7 @@ ENGINE = NDB;
DROP USER mysqltest_u1@localhost;
DROP USER mysqltest_u2@localhost;
DROP DATABASE mysqltest2;
DROP DATABASE IF EXISTS mysqltest2;
--echo
--echo # -----------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show more