diff --git a/BUILD/compile-pentium-debug-max b/BUILD/compile-pentium-debug-max index adb9b7899a5..b2c8b4d9331 100755 --- a/BUILD/compile-pentium-debug-max +++ b/BUILD/compile-pentium-debug-max @@ -4,6 +4,6 @@ path=`dirname $0` . "$path/SETUP.sh" "$@" --with-debug=full extra_flags="$pentium_cflags $debug_cflags" -extra_configs="$pentium_configs $debug_configs $max_configs $error_inject" +extra_configs="$pentium_configs $debug_configs $max_configs $error_inject --with-experimental-collations" . "$path/FINISH.sh" diff --git a/client/Makefile.am b/client/Makefile.am index bdd5ff5fb0b..e22080e3dd8 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -95,7 +95,8 @@ DEFS = -DUNDEF_THREADS_HACK \ -DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \ -DDATADIR="\"$(localstatedir)\"" -sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc +sql_src=log_event.h mysql_priv.h rpl_constants.h \ + log_event.cc my_decimal.h my_decimal.cc strings_src=decimal.c link_sources: diff --git a/client/mysql.cc b/client/mysql.cc index 48172d97f56..d2c7bd8812c 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -2517,7 +2517,8 @@ print_table_data_xml(MYSQL_RES *result) tee_fputs("\n\n", PAGER); + tee_fputs("\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">", + PAGER); fields = mysql_fetch_fields(result); while ((cur = mysql_fetch_row(result))) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 0835e59d547..dec750d7313 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -481,19 +481,17 @@ static int write_event_header_and_base64(Log_event *ev, FILE *result_file, PRINT_EVENT_INFO *print_event_info) { + IO_CACHE *head= &print_event_info->head_cache; + IO_CACHE *body= &print_event_info->body_cache; DBUG_ENTER("write_event_header_and_base64"); - /* Write header and base64 output to cache */ - IO_CACHE result_cache; - if (open_cached_file(&result_cache, NULL, NULL, 0, MYF(MY_WME | MY_NABP))) - return 1; - ev->print_header(&result_cache, print_event_info, FALSE); - ev->print_base64(&result_cache, print_event_info, FALSE); + /* Write header and base64 output to cache */ + ev->print_header(head, print_event_info, FALSE); + ev->print_base64(body, print_event_info, FALSE); /* Read data from cache and write to result file */ - my_b_copy_to_file(&result_cache, result_file); - close_cached_file(&result_cache); - DBUG_RETURN(0); + DBUG_RETURN(copy_event_cache_to_file_and_reinit(head, result_file) || + copy_event_cache_to_file_and_reinit(body, result_file)); } diff --git a/config/ac-macros/character_sets.m4 b/config/ac-macros/character_sets.m4 index 1ab6e7dd780..8c3e8ca73b7 100644 --- a/config/ac-macros/character_sets.m4 +++ b/config/ac-macros/character_sets.m4 @@ -429,3 +429,16 @@ then else AC_MSG_RESULT(no) fi + + +# Shall we build experimental collations +AC_ARG_WITH(experimental-collations, + [], + [with_exp_coll=$withval], + [with_exp_coll=no] +) + +if test "$with_exp_coll" = "yes" +then + AC_DEFINE([HAVE_UTF8_GENERAL_CS], [1], [certain Japanese customer]) +fi diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 22746ccf89c..c59685a0e65 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -20,9 +20,7 @@ begin; insert t2 values (5); commit; # first COMMIT must be Query_log_event, second - Xid_log_event ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; drop table t1,t2; # @@ -44,10 +42,10 @@ commit; drop table t1; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000001' from 102; +show binlog events in 'master-bin.000001' from 106; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000002' from 102; +show binlog events in 'master-bin.000002' from 106; # Test of a too big SET INSERT_ID: see if the truncated value goes # into binlog (right), or the too big value (wrong); we look at the @@ -80,9 +78,7 @@ DELETE FROM user WHERE host='localhost' AND user='@#@'; --enable_warnings use test; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; drop table t1,t2,t3,tt1; -- source extra/binlog_tests/binlog_insert_delayed.test diff --git a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test index 4da883b9e60..d073c8ef227 100644 --- a/mysql-test/extra/binlog_tests/binlog_insert_delayed.test +++ b/mysql-test/extra/binlog_tests/binlog_insert_delayed.test @@ -23,9 +23,7 @@ inc $count; # moving binlog check affront of multi-rows queries which work is indeterministic (extra table_maps) # todo: better check is to substitute SHOW BINLOG with reading from binlog, probably bug#19459 is in # the way ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; insert delayed into t1 values (null),(null),(null),(null); inc $count; inc $count; inc $count; inc $count; diff --git a/mysql-test/extra/binlog_tests/blackhole.test b/mysql-test/extra/binlog_tests/blackhole.test index 05e59838168..80f998359ba 100644 --- a/mysql-test/extra/binlog_tests/blackhole.test +++ b/mysql-test/extra/binlog_tests/blackhole.test @@ -121,11 +121,7 @@ select * from t2; select * from t3; let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; - +source include/show_binlog_events.inc; drop table t1,t2,t3; # @@ -157,10 +153,7 @@ start transaction; insert into t1 values(2); rollback; set autocommit=1; ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; drop table if exists t1; # End of 5.0 tests diff --git a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test index 5e93d6e126e..30585ece71c 100644 --- a/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_cp932_binlog.test @@ -26,9 +26,7 @@ SET @var1= x'8300'; # code (and I have used it to test the fix) until there is some way to # exercise this code from mysql-test-run. EXECUTE stmt1 USING @var1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 102; +source include/show_binlog_events.inc; SELECT HEX(f1) FROM t1; DROP table t1; # end test for bug#11338 diff --git a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test index fcf39e38163..e1a9dba7775 100644 --- a/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test +++ b/mysql-test/extra/binlog_tests/ctype_ucs_binlog.test @@ -9,8 +9,7 @@ create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); reset master; insert into t2 values (@v); ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be # escaped). diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test index 9c8647395bf..87f94eff987 100644 --- a/mysql-test/extra/binlog_tests/drop_temp_table.test +++ b/mysql-test/extra/binlog_tests/drop_temp_table.test @@ -23,10 +23,7 @@ connection con2; # To be sure that logging has been done, we use a user lock. select get_lock("a",10); let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; drop database `drop-temp+table-test`; # End of 4.1 tests diff --git a/mysql-test/extra/binlog_tests/insert_select-binlog.test b/mysql-test/extra/binlog_tests/insert_select-binlog.test index 07da4a1907f..b09eebcb996 100644 --- a/mysql-test/extra/binlog_tests/insert_select-binlog.test +++ b/mysql-test/extra/binlog_tests/insert_select-binlog.test @@ -18,9 +18,7 @@ insert into t1 select * from t2; # The above should produce an error, but still be in the binlog; # verify the binlog : let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; select * from t1; drop table t1, t2; @@ -33,9 +31,7 @@ reset master; create table t2(unique(a)) select a from t1; # The above should produce an error, *and* not appear in the binlog let $VERSION=`select version()`; ---replace_result $VERSION VERSION ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; drop table t1; # End of 4.1 tests diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index bb4194bc7a7..d6ccc403ce9 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -29,9 +29,7 @@ insert into t1 values(1); insert into t2 select * from t1; commit; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -43,9 +41,7 @@ insert into t2 select * from t1; # should say some changes to non-transact1onal tables couldn't be rolled back rollback; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -59,9 +55,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -77,9 +71,7 @@ insert into t1 values(7); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; # and when ROLLBACK is not explicit? delete from t1; @@ -99,9 +91,7 @@ connection con2; # so SHOW BINLOG EVENTS may come before con1 does the loggin. To be sure that # logging has been done, we use a user lock. select get_lock("a",10); ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; # and when not in a transact1on? delete from t1; @@ -111,9 +101,7 @@ reset master; insert into t1 values(9); insert into t2 select * from t1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; # Check that when the query updat1ng the MyISAM table is the first in the # transaction, we log it immediately. @@ -124,16 +112,11 @@ reset master; insert into t1 values(10); # first make t1 non-empty begin; insert into t2 select * from t1; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; insert into t1 values(11); commit; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; - +source include/show_binlog_events.inc; # Check that things work like before this BEGIN/ROLLBACK code was added, # when t2 is INNODB @@ -149,9 +132,7 @@ insert into t1 values(12); insert into t2 select * from t1; commit; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -162,9 +143,7 @@ insert into t1 values(13); insert into t2 select * from t1; rollback; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -178,9 +157,7 @@ insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; delete from t1; delete from t2; @@ -196,9 +173,7 @@ insert into t1 values(18); commit; select a from t1 order by a; # check that savepoints work :) ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; # Test for BUG#5714, where a MyISAM update in the transaction used to # release row-level locks in InnoDB @@ -257,9 +232,7 @@ insert into t2 values (3); disconnect con2; connection con3; select get_lock("lock1",60); ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; do release_lock("lock1"); drop table t0,t2; @@ -324,9 +297,7 @@ CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) engine=innodb select * ROLLBACK; SELECT * from t2; DROP TABLE t1,t2; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events from 102; +source include/show_binlog_events.inc; # Test for BUG#16559 (ROLLBACK should always have a zero error code in # binlog). Has to be here and not earlier, as the SELECTs influence diff --git a/mysql-test/extra/rpl_tests/rpl_ddl.test b/mysql-test/extra/rpl_tests/rpl_ddl.test index 15794e5e035..e40532f005f 100644 --- a/mysql-test/extra/rpl_tests/rpl_ddl.test +++ b/mysql-test/extra/rpl_tests/rpl_ddl.test @@ -1,31 +1,128 @@ -######################## rpl_ddl.test ######################## -# # -# DDL statements (sometimes with implicit COMMIT) executed # -# by the master and it's propagation into the slave # -# # -############################################################## +################# extra/rpl_tests/rpl_ddl.test ######################## +# # +# DDL statements (sometimes with implicit COMMIT) and other stuff # +# executed on the master and it's propagation into the slave. # +# # +# The variables # +# $engine_type -- storage engine to be tested/used for the # +# permanent tables within the master # +# $temp_engine_type -- storage engine which supports TEMPORARY # +# tables <> $engine_type # +# $temp_engine_type must point to an all # +# time available storage engine # +# 2007-02 MySQL 5.1 MyISAM and MEMORY only # +# $show_binlog -- print binlog entries # +# 0 - no (default) + fits to the file with # +# results # +# 1 - yes (important for debugging) # +# This variable is used within # +# include/rpl_stmt_seq.inc. # +# $manipulate -- Manipulation of the binary logs # +# 0 - do nothing # +# 1 - so that the output of SHOW BINLOG # +# EVENTS IN contains only # +# commands of the current test sequence # +# This is especially useful, if the # +# $show_binlog is set to 1 and many # +# subtest are executed. # +# This variable is used within # +# include/rpl_stmt_seq.inc. # +# have to be set before sourcing this script. # +# # +# General assumption about the ideal replication behaviour: # +# Whatever on the master is executed the content of the slave must # +# be in sync with it. # +# # +# Tests of special interest: # +# a) Which DDL commands cause an implicit COMMIT ? # +# This is also of interest outside of replication. # +# b) Transactions modifying table content ending with # +# - explicit COMMIT or ROLLBACK # +# - implicit COMMIT because the connection to the master # +# executed a corresponding DDL statement or runs in # +# AUTOCOMMIT mode # +# - something similar to "implicit COMMIT" if the storage # +# engine (master) is not transactional # +# c) Command which change no data like SELECT or SHOW # +# They do not change anything within the master but # +# this must be also valid for the slave. # +# # +####################################################################### +# Last update: +# 2007-02-12 ML: - slave needs AUTOCOMMIT = 1, because we want to check only +# the propagation of actions of the master connection. +# - replace comments via SQL by "--echo ..." +# - remove some bugs within the testscripts +# - remove the use of include/rpl_stmt_seq2.inc +# # -# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !! +# NOTES: +# 2006-11-15 Lars: Matthias (ML) is the "owner" of this test case. +# So, please get him to review it whenever you want to +# do changes to it. # -# 1. !All! objects to be dropped, renamed, altered ... must be created -# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test -# sequences start. +# PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !! # -# 2. Never use a test object, which was direct or indirect affected by a -# preceeding test sequence again. -# Except table d1.t1 where ONLY DML is allowed. +# Typical test architecture (--> include/rpl_stmt_seq.inc) +# -------------------------------------------------------- +# 1. Master (no AUTOCOMMIT!): INSERT INTO mysqltest1.t1 without commit +# 2. Master and slave: Check the content of mysqltest1.t1 +# 3. Master (no AUTOCOMMIT!): EXECUTE the statement to be tested +# 4. Master and slave: Check the content of mysqltest1.t1 +# 5. Master (no AUTOCOMMIT!): ROLLBACK +# 6. Master and slave: Check the content of mysqltest1.t1 +# If the previous into mysqltest1.t1 inserted row is visible, +# than the statement to be tested caused an explicit COMMIT +# (statement = COMMIT) or an implicit COMMIT (example CREATE TABLE). +# If the previous into mysqltest1.t1 inserted row is not visible, +# than the statement to be tested caused either an explicit ROLLBACK +# (statement = ROLLBACK), an implicit ROLLBACK (deadlock etc. but +# not tested here) or it does not cause any transaction end. +# 7. Flush the logs +# +# Some rules: +# ----------- +# 1. Any use of mysqltest1.t1 within the statement to be tested must be +# avoided if possible. The only known exception is around LOCK TABLE. +# +# 2. The test logics needs for +# master connection: AUTOCOMMIT = 0 +# slave connection: AUTOCOMMIT = 1 +# The master connection is the actor and the slave connection is +# only an observer. I.e. the slave connection must not influence +# the activities of master connection. # -# If one preceeding test sequence hits a (sometimes not good visible, -# because the sql error code of the statement might be 0) bug -# and these rules are ignored, a following test sequence might earn ugly -# effects like failing 'sync_slave_with_master', crashes of the slave or -# abort of the test case etc.. +# 3. !All! objects to be dropped, renamed, altered ... must be created +# before the tests start. +# --> less switching of AUTOCOMMIT mode on master side. # -# 3. The assignment of the DDL command to be tested to $my_stmt can -# be a bit difficult. "'" must be avoided, because the test -# routine "include/rpl_stmt_seq.inc" performs a -# eval SELECT CONCAT('######## ','$my_stmt',' ########') as ""; +# 4. Never use a test object, which was direct or indirect affected by a +# preceeding test sequence again. +# If one preceeding test sequence hits a (sometimes not visible, +# because the sql error code of the statement might be 0) bug +# and these rules are ignored, a following test sequence might earn ugly +# effects like failing 'sync_slave_with_master', crashes of the slave or +# abort of the test case etc.. This means during analysis the first look +# points into a totally wrong area. +# Except table mysqltest1.t1 where ONLY DML is allowed. +# +# 5. This file is used in several tests (t/rpl_ddl_.test). +# Please be aware that every change of the current file affects +# the results of these tests. +# +# ML: Some maybe banal hints: +# 1. The fact that we have here a master - slave replication does +# not cause that many general MySQL properties do not apply. +# Example: +# The connection to the slave is just a simple session and not a however +# magic working "copy" of the master session or something similar. +# - TEMPORARY TABLES and @variables are session specific +# - the slave session cannot see these things of the master. +# 2. The slave connection must not call sync_slave_with_master. +# 3. SHOW STATUS SLAVE must be run within the slave connection. +# 4. Testcase analysis becomes much more comfortable if +# $show_binlog within include/rpl_stmt_seq.inc is set to 1. # ############################################################### @@ -33,8 +130,10 @@ ############################################################### # The sync_slave_with_master is needed to make the xids deterministic. sync_slave_with_master; -connection master; +--echo +--echo -------- switch to master ------- +connection master; SET AUTOCOMMIT = 1; # # 1. DROP all objects, which probably already exist, but must be created here @@ -47,7 +146,7 @@ DROP DATABASE IF EXISTS mysqltest3; # # 2. CREATE all objects needed # working database is mysqltest1 -# working (transactional!) is mysqltest1.t1 +# working table (transactional!) is mysqltest1.t1 # CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; @@ -73,25 +172,23 @@ eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type; eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type; eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type; eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type; -CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT); +eval CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=$temp_engine_type; # # 3. master sessions: never do AUTOCOMMIT -# slave sessions: never do AUTOCOMMIT +# slave sessions: do AUTOCOMMIT # SET AUTOCOMMIT = 0; use mysqltest1; sync_slave_with_master; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SET AUTOCOMMIT = 0; +SET AUTOCOMMIT = 1; use mysqltest1; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log # We don't want to abort the whole test if one statement sent @@ -99,6 +196,21 @@ SELECT '-------- switch to master -------' as ""; # sequences are nearly independend of the previous statements. --disable_abort_on_error +############################################################### +# Banal case: commands which should never commit +# Just for checking if the test sequence is usable +############################################################### + +let $my_stmt= SELECT 1; +let $my_master_commit= false; +let $my_slave_commit= false; +--source include/rpl_stmt_seq.inc + +let $my_stmt= SELECT COUNT(*) FROM t1; +let $my_master_commit= false; +let $my_slave_commit= false; +--source include/rpl_stmt_seq.inc + ############################################################### # Banal case: (explicit) COMMIT and ROLLBACK # Just for checking if the test sequence is usable @@ -143,84 +255,64 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW TABLES LIKE 't2'; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW TABLES LIKE 't2'; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -# Note: Since this test is executed with a skip-innodb slave, the -# slave incorrectly commits the insert. One can *not* have InnoDB on -# master and MyISAM on slave and expect that a transactional rollback -# after a CREATE TEMPORARY TABLE should work correctly on the slave. -# For this to work properly the handler on the slave must be able to -# handle transactions (e.g. InnoDB or NDB). let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23; let $my_master_commit= false; -let $my_slave_commit= true; +let $my_slave_commit= false; --source include/rpl_stmt_seq.inc SHOW TABLES LIKE 't23'; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW TABLES LIKE 't23'; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20; let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW TABLES LIKE 't20'; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW TABLES LIKE 't20'; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT; let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc describe mysqltest1.t4; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log describe mysqltest1.t4; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=; +let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= $engine_type; let $my_master_commit= true; let $my_slave_commit= true; ---source include/rpl_stmt_seq2.inc +--source include/rpl_stmt_seq.inc -# Note: Since this test is executed with a skip-innodb slave, the -# slave incorrectly commits the insert. One can *not* have InnoDB on -# master and MyISAM on slave and expect that a transactional rollback -# after a CREATE TEMPORARY TABLE should work correctly on the slave. -# For this to work properly the handler on the slave must be able to -# handle transactions (e.g. InnoDB or NDB). let $engine=''; let $eng_type=''; -let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT); +let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=$temp_engine_type; let $my_master_commit= false; -let $my_slave_commit= true; +let $my_slave_commit= false; --source include/rpl_stmt_seq.inc let $my_stmt= TRUNCATE TABLE mysqltest1.t7; @@ -228,9 +320,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SELECT * FROM mysqltest1.t7; ---echo -------- switch to slave -------- sync_slave_with_master; +--echo +--echo -------- switch to slave -------- +connection slave; SELECT * FROM mysqltest1.t7; +--echo --echo -------- switch to master ------- connection master; @@ -238,8 +333,13 @@ connection master; # Cases with LOCK/UNLOCK ############################################################### -# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an -# INSERT into this table. +# Attention: +# We have to LOCK mysqltest1.t1 here, though it violates the testing +# philosophy. +# Mysql response in case without previous LOCK TABLES mysqltest1.t1 +# is: +# SELECT MAX(...) FROM mysqltest1.t1 is +# ERROR HY000: Table 't1' was not locked with LOCK TABLES let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; let $my_master_commit= true; let $my_slave_commit= true; @@ -253,8 +353,9 @@ let $my_slave_commit= false; --source include/rpl_stmt_seq.inc # With prior read locking -# Note that this test generate an error since the rpl_stmt_seq.inc -# tries to insert into t1. +# Attention: +# This subtest generates an error since the rpl_stmt_seq.inc +# tries to insert into t1. LOCK TABLES mysqltest1.t1 READ; let $my_stmt= UNLOCK TABLES; let $my_master_commit= false; @@ -277,30 +378,26 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW INDEX FROM mysqltest1.t6; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW INDEX FROM mysqltest1.t6; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1); let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW INDEX FROM mysqltest1.t5; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW INDEX FROM mysqltest1.t5; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log ############################################################### # Cases with DATABASE @@ -311,35 +408,31 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW DATABASES LIKE "mysqltest2"; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW DATABASES LIKE "mysqltest2"; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log let $my_stmt= CREATE DATABASE mysqltest3; let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW DATABASES LIKE "mysqltest3"; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log SHOW DATABASES LIKE "mysqltest3"; +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log # End of 4.1 tests ############################################################### -# Cases with stored procedures +# Cases with STORED PROCEDUREs ############################################################### let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1"; let $my_master_commit= true; @@ -348,12 +441,13 @@ let $my_slave_commit= true; --vertical_results --replace_column 5 # 6 # SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; --replace_column 5 # 6 # SHOW PROCEDURE STATUS LIKE 'p1'; +--echo +--echo -------- switch to master ------- connection master; --horizontal_results @@ -364,12 +458,13 @@ let $my_slave_commit= true; --vertical_results --replace_column 5 # 6 # SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; --replace_column 5 # 6 # SHOW PROCEDURE STATUS LIKE 'p1'; +--echo +--echo -------- switch to master ------- connection master; --horizontal_results @@ -379,11 +474,12 @@ let $my_slave_commit= true; --source include/rpl_stmt_seq.inc --vertical_results SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SHOW PROCEDURE STATUS LIKE 'p1'; +--echo +--echo -------- switch to master ------- connection master; --horizontal_results @@ -395,11 +491,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SHOW CREATE VIEW v1; +--echo +--echo -------- switch to master ------- connection master; let $my_stmt= ALTER VIEW v1 AS select f1 from t1; @@ -407,11 +504,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SHOW CREATE VIEW v1; +--echo +--echo -------- switch to master ------- connection master; let $my_stmt= DROP VIEW IF EXISTS v1; @@ -420,12 +518,13 @@ let $my_slave_commit= true; --source include/rpl_stmt_seq.inc --error 1146 SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; --error 1146 SHOW CREATE VIEW v1; +--echo +--echo -------- switch to master ------- connection master; ############################################################### @@ -436,11 +535,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW TRIGGERS; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SHOW TRIGGERS; +--echo +--echo -------- switch to master ------- connection master; let $my_stmt= DROP TRIGGER trg1; @@ -448,11 +548,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SHOW TRIGGERS; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SHOW TRIGGERS; +--echo +--echo -------- switch to master ------- connection master; ############################################################### @@ -463,11 +564,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SELECT user FROM mysql.user WHERE user = 'user1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SELECT user FROM mysql.user WHERE user = 'user1'; +--echo +--echo -------- switch to master ------- connection master; let $my_stmt= RENAME USER user1@localhost TO rename1@localhost; @@ -475,11 +577,12 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SELECT user FROM mysql.user WHERE user = 'rename1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SELECT user FROM mysql.user WHERE user = 'rename1'; +--echo +--echo -------- switch to master ------- connection master; let $my_stmt= DROP USER rename1@localhost; @@ -487,21 +590,21 @@ let $my_master_commit= true; let $my_slave_commit= true; --source include/rpl_stmt_seq.inc SELECT user FROM mysql.user WHERE user = 'rename1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log +--echo +--echo -------- switch to slave -------- connection slave; SELECT user FROM mysql.user WHERE user = 'rename1'; -connection master; ############################################################### # Cleanup ############################################################### ---disable_warnings -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; +use test; +--echo +--echo -------- switch to master ------- +connection master; +DROP DATABASE mysqltest1; +# mysqltest2 was alreday DROPPED some tests before. +DROP DATABASE mysqltest3; --enable_warnings -- source include/master-slave-end.inc - diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test index 236a5f801b0..f6e02546a0b 100644 --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test @@ -82,7 +82,7 @@ show slave status; stop slave; delete from t3; -change master to master_log_pos=544; # the BEGIN log event +change master to master_log_pos=548; # the BEGIN log event begin; select * from t2 for update; # hold lock start slave; @@ -107,7 +107,7 @@ set global max_relay_log_size=0; # This is really copy-paste of 2) of above stop slave; delete from t3; -change master to master_log_pos=544; +change master to master_log_pos=548; begin; select * from t2 for update; start slave; diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index 9f6f4bf7e57..932fcdf670b 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -42,13 +42,13 @@ select count(*) from t1; show binlog events; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 102 limit 1; +show binlog events from 106 limit 1; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 102 limit 2; +show binlog events from 106 limit 2; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 102 limit 2,1; +show binlog events from 106 limit 2,1; flush logs; # We need an extra update before doing save_master_pos. @@ -88,10 +88,7 @@ connection master; eval create table t2 (n int)ENGINE=$engine_type; insert into t2 values (1); ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; --replace_result $VERSION VERSION --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ @@ -142,10 +139,7 @@ insert into t1 values (NULL, 1); reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); ---replace_result $VERSION VERSION ---replace_column 2 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; select * from t1; drop table t1; diff --git a/mysql-test/extra/rpl_tests/rpl_multi_query.test b/mysql-test/extra/rpl_tests/rpl_multi_query.test index 30a83886a86..2438556450d 100644 --- a/mysql-test/extra/rpl_tests/rpl_multi_query.test +++ b/mysql-test/extra/rpl_tests/rpl_multi_query.test @@ -23,8 +23,6 @@ delimiter ;/ sync_slave_with_master; select * from mysqltest.t1; connection master; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; drop database mysqltest; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test b/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test deleted file mode 100644 index 26c368589ba..00000000000 --- a/mysql-test/extra/rpl_tests/rpl_ndb_ddl.test +++ /dev/null @@ -1,507 +0,0 @@ -######################## rpl_ddl.test ######################## -# # -# DDL statements (sometimes with implicit COMMIT) executed # -# by the master and it's propagation into the slave # -# # -############################################################## - -# -# NOTE, PLEASE BE CAREFUL, WHEN MODIFYING THE TESTS !! -# -# 1. !All! objects to be dropped, renamed, altered ... must be created -# in AUTOCOMMIT= 1 mode before AUTOCOMMIT is set to 0 and the test -# sequences start. -# -# 2. Never use a test object, which was direct or indirect affected by a -# preceeding test sequence again. -# Except table d1.t1 where ONLY DML is allowed. -# -# If one preceeding test sequence hits a (sometimes not good visible, -# because the sql error code of the statement might be 0) bug -# and these rules are ignored, a following test sequence might earn ugly -# effects like failing 'sync_slave_with_master', crashes of the slave or -# abort of the test case etc.. -# -# 3. The assignment of the DDL command to be tested to $my_stmt can -# be a bit difficult. "'" must be avoided, because the test -# routine "include/rpl_stmt_seq.inc" performs a -# eval SELECT CONCAT('######## ','$my_stmt',' ########') as ""; -# - -############################################################### -# Some preparations -############################################################### -# The sync_slave_with_master is needed to make the xids deterministic. -sync_slave_with_master; -connection master; - -SET AUTOCOMMIT = 1; -# -# 1. DROP all objects, which probably already exist, but must be created here -# ---disable_warnings -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; ---enable_warnings -# -# 2. CREATE all objects needed -# working database is mysqltest1 -# working (transactional!) is mysqltest1.t1 -# -CREATE DATABASE mysqltest1; -CREATE DATABASE mysqltest2; -eval CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=$engine_type; -INSERT INTO mysqltest1.t1 SET f1= 0; -eval CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=$engine_type; -CREATE INDEX my_idx6 ON mysqltest1.t6(f1); -eval CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=$engine_type; -INSERT INTO mysqltest1.t7 SET f1= 0; -eval CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=$engine_type; -eval CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=$engine_type; -CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT); - -# -# 3. master sessions: never do AUTOCOMMIT -# slave sessions: never do AUTOCOMMIT -# -SET AUTOCOMMIT = 0; -use mysqltest1; -sync_slave_with_master; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SET AUTOCOMMIT = 0; -use mysqltest1; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - - -# We don't want to abort the whole test if one statement sent -# to the server gets an error, because the following test -# sequences are nearly independend of the previous statements. ---disable_abort_on_error - -############################################################### -# Banal case: (explicit) COMMIT and ROLLBACK -# Just for checking if the test sequence is usable -############################################################### - -let $my_stmt= COMMIT; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc - -let $my_stmt= ROLLBACK; -let $my_master_commit= false; -let $my_slave_commit= false; ---source include/rpl_stmt_seq.inc - -############################################################### -# Cases with commands very similar to COMMIT -############################################################### - -let $my_stmt= SET AUTOCOMMIT=1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SET AUTOCOMMIT=0; - -let $my_stmt= START TRANSACTION; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc - -let $my_stmt= BEGIN; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc - -############################################################### -# Cases with (BASE) TABLES and (UPDATABLE) VIEWs -############################################################### - -let $my_stmt= DROP TABLE mysqltest1.t2; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW TABLES LIKE 't2'; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW TABLES LIKE 't2'; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -# Note: Since this test is executed with a skip-innodb slave, the -# slave incorrectly commits the insert. One can *not* have InnoDB on -# master and MyISAM on slave and expect that a transactional rollback -# after a CREATE TEMPORARY TABLE should work correctly on the slave. -# For this to work properly the handler on the slave must be able to -# handle transactions (e.g. InnoDB or NDB). -let $my_stmt= DROP TEMPORARY TABLE mysqltest1.t23; -let $my_master_commit= false; -let $my_slave_commit= false; ---source include/rpl_stmt_seq.inc -SHOW TABLES LIKE 't23'; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW TABLES LIKE 't23'; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -let $my_stmt= RENAME TABLE mysqltest1.t3 to mysqltest1.t20; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW TABLES LIKE 't20'; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW TABLES LIKE 't20'; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -let $my_stmt= ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -describe mysqltest1.t4; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -describe mysqltest1.t4; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -let $my_stmt= CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE=; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq2.inc - -# Note: Since this test is executed with a skip-innodb slave, the -# slave incorrectly commits the insert. One can *not* have InnoDB on -# master and MyISAM on slave and expect that a transactional rollback -# after a CREATE TEMPORARY TABLE should work correctly on the slave. -# For this to work properly the handler on the slave must be able to -# handle transactions (e.g. InnoDB or NDB). -let $engine=''; -let $eng_type=''; - -let $my_stmt= CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT); -let $my_master_commit= false; -let $my_slave_commit= false; ---source include/rpl_stmt_seq.inc - -let $my_stmt= TRUNCATE TABLE mysqltest1.t7; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SELECT * FROM mysqltest1.t7; ---echo -------- switch to slave -------- -sync_slave_with_master; -SELECT * FROM mysqltest1.t7; ---echo -------- switch to master ------- -connection master; - -############################################################### -# Cases with LOCK/UNLOCK -############################################################### - -# MySQL insists in locking mysqltest1.t1, because rpl_stmt_seq performs an -# INSERT into this table. -let $my_stmt= LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -UNLOCK TABLES; - -# No prior locking -let $my_stmt= UNLOCK TABLES; -let $my_master_commit= false; -let $my_slave_commit= false; ---source include/rpl_stmt_seq.inc - -# With prior read locking -# Note that this test generate an error since the rpl_stmt_seq.inc -# tries to insert into t1. -LOCK TABLES mysqltest1.t1 READ; -let $my_stmt= UNLOCK TABLES; -let $my_master_commit= false; -let $my_slave_commit= false; ---source include/rpl_stmt_seq.inc - -# With prior write locking -LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; -let $my_stmt= UNLOCK TABLES; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc - -############################################################### -# Cases with INDEXES -############################################################### - -let $my_stmt= DROP INDEX my_idx6 ON mysqltest1.t6; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW INDEX FROM mysqltest1.t6; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW INDEX FROM mysqltest1.t6; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -let $my_stmt= CREATE INDEX my_idx5 ON mysqltest1.t5(f1); -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW INDEX FROM mysqltest1.t5; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW INDEX FROM mysqltest1.t5; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -############################################################### -# Cases with DATABASE -############################################################### - -let $my_stmt= DROP DATABASE mysqltest2; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW DATABASES LIKE "mysqltest2"; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW DATABASES LIKE "mysqltest2"; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -let $my_stmt= CREATE DATABASE mysqltest3; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW DATABASES LIKE "mysqltest3"; -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -SHOW DATABASES LIKE "mysqltest3"; -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log - -# End of 4.1 tests - -############################################################### -# Cases with stored procedures -############################################################### -let $my_stmt= CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1"; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc ---vertical_results ---replace_column 5 # 6 # -SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; ---replace_column 5 # 6 # -SHOW PROCEDURE STATUS LIKE 'p1'; -connection master; ---horizontal_results - -let $my_stmt= ALTER PROCEDURE p1 COMMENT "I have been altered"; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc ---vertical_results ---replace_column 5 # 6 # -SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; ---replace_column 5 # 6 # -SHOW PROCEDURE STATUS LIKE 'p1'; -connection master; ---horizontal_results - -let $my_stmt= DROP PROCEDURE p1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc ---vertical_results -SHOW PROCEDURE STATUS LIKE 'p1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SHOW PROCEDURE STATUS LIKE 'p1'; -connection master; ---horizontal_results - -############################################################### -# Cases with VIEWs -############################################################### -let $my_stmt= CREATE OR REPLACE VIEW v1 as select * from t1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SHOW CREATE VIEW v1; -connection master; - -let $my_stmt= ALTER VIEW v1 AS select f1 from t1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SHOW CREATE VIEW v1; -connection master; - -let $my_stmt= DROP VIEW IF EXISTS v1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc ---error 1146 -SHOW CREATE VIEW v1; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; ---error 1146 -SHOW CREATE VIEW v1; -connection master; - -############################################################### -# Cases with TRIGGERs -############################################################### -let $my_stmt= CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW TRIGGERS; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SHOW TRIGGERS; -connection master; - -let $my_stmt= DROP TRIGGER trg1; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SHOW TRIGGERS; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SHOW TRIGGERS; -connection master; - -############################################################### -# Cases with USERs -############################################################### -let $my_stmt= CREATE USER user1@localhost; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SELECT user FROM mysql.user WHERE user = 'user1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SELECT user FROM mysql.user WHERE user = 'user1'; -connection master; - -let $my_stmt= RENAME USER user1@localhost TO rename1@localhost; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SELECT user FROM mysql.user WHERE user = 'rename1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SELECT user FROM mysql.user WHERE user = 'rename1'; -connection master; - -let $my_stmt= DROP USER rename1@localhost; -let $my_master_commit= true; -let $my_slave_commit= true; ---source include/rpl_stmt_seq.inc -SELECT user FROM mysql.user WHERE user = 'rename1'; ---disable_query_log -SELECT '-------- switch to slave -------' as ""; ---enable_query_log -connection slave; -SELECT user FROM mysql.user WHERE user = 'rename1'; -connection master; - -############################################################### -# Cleanup -############################################################### ---disable_warnings -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; ---enable_warnings - --- source include/master-slave-end.inc - diff --git a/mysql-test/extra/rpl_tests/rpl_row_charset.test b/mysql-test/extra/rpl_tests/rpl_row_charset.test index 336a038db10..4ce5245a79a 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_row_charset.test @@ -113,9 +113,7 @@ select * from mysqltest2.t1 order by a; connection master; drop database mysqltest2; drop database mysqltest3; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; sync_slave_with_master; # Check that we can change global.collation_server (since 5.0.3) diff --git a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test index 0e235f8838f..c4e6dbc84c2 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test +++ b/mysql-test/extra/rpl_tests/rpl_row_delayed_ins.test @@ -15,9 +15,7 @@ SELECT * FROM t1 ORDER BY a; sync_slave_with_master; connection master; ---replace_result $VERSION VERSION ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events; +source include/show_binlog_events.inc; sync_slave_with_master; SELECT * FROM t1 ORDER BY a; connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp002.test b/mysql-test/extra/rpl_tests/rpl_row_sp002.test index 9d056626cf2..47afcce875b 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp002.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp002.test @@ -222,7 +222,7 @@ sync_with_master; select * from test.t3; connection master; -#show binlog events from 1626; +#show binlog events from 1627; # First lets cleanup diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test index 0934e2d6f98..df318ee0c0b 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -65,7 +65,7 @@ sync_slave_with_master; connection slave; SELECT * FROM test.t1; connection master; -#show binlog events from 719; +#show binlog events from 720; DROP PROCEDURE IF EXISTS test.p1; DROP PROCEDURE IF EXISTS test.p2; diff --git a/mysql-test/extra/rpl_tests/rpl_stm_charset.test b/mysql-test/extra/rpl_tests/rpl_stm_charset.test index 5657b06e88f..629ccdf69f7 100644 --- a/mysql-test/extra/rpl_tests/rpl_stm_charset.test +++ b/mysql-test/extra/rpl_tests/rpl_stm_charset.test @@ -109,9 +109,7 @@ select * from mysqltest2.t1 order by a; connection master; drop database mysqltest2; drop database mysqltest3; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; sync_slave_with_master; # Check that we can change global.collation_server (since 5.0.3) diff --git a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test index 7f1506c4010..64a8de7c6a0 100644 --- a/mysql-test/extra/rpl_tests/rpl_truncate_helper.test +++ b/mysql-test/extra/rpl_tests/rpl_truncate_helper.test @@ -37,6 +37,4 @@ SELECT * FROM t1; connection master; DROP TABLE t1; let $SERVER_VERSION=`select version()`; ---replace_result $SERVER_VERSION SERVER_VERSION ---replace_regex /\/\* xid=[0-9]+ \*\//\/* xid= *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS; +source include/show_binlog_events.inc; diff --git a/mysql-test/include/rpl_events.inc b/mysql-test/include/rpl_events.inc new file mode 100644 index 00000000000..04885f31997 --- /dev/null +++ b/mysql-test/include/rpl_events.inc @@ -0,0 +1,119 @@ +################################################################## +# Author: Giuseppe, Chuck Bell # +# Date: 17-January-2007 # +# Purpose: To test that event effects are replicated # +# in both row based and statement based format # +################################################################## + +--disable_warnings +DROP EVENT IF EXISTS test.justonce; +drop table if exists t1,t2; +--enable_warnings + +# first, we need a table to record something from an event + +eval CREATE TABLE `t1` ( + `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `c` VARCHAR(50) NOT NULL, + `ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=$engine_type DEFAULT CHARSET=utf8; + +INSERT INTO t1 (c) VALUES ('manually'); + +# then, we create the event +CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 +(c) VALUES ('from justonce'); + +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; + +# wait 3 seconds, so the event can trigger +--real_sleep 3 + +# check that table t1 contains something +--echo "in the master" +--enable_info +--replace_column 3 TIMESTAMP +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +--disable_info + +sync_slave_with_master; + +--echo "in the slave" +--enable_info +--replace_column 3 TIMESTAMP +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +--disable_info + +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; + +# Create an event on the slave and check to see what the originator is. +--disable_warnings +DROP EVENT IF EXISTS test.slave_once; +--enable_warnings + +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +INSERT INTO t1(c) VALUES ('from slave_once'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; + +--disable_warnings +DROP EVENT IF EXISTS test.slave_once; +--enable_warnings + +connection master; + +# BUG#20384 - disable events on slave +--disable_warnings +DROP EVENT IF EXISTS test.justonce; +--enable_warnings + +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +INSERT INTO t1(c) VALUES ('from er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; + +sync_slave_with_master; + +--echo "in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; + +connection master; +--echo "in the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; + +sync_slave_with_master; + +--echo "in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; + +connection master; +--echo "in the master" +DROP EVENT test.er; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; + +--disable_info + +sync_slave_with_master; + +--echo "in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; + +# test the DISABLE ON SLAVE for setting event SLAVESIDE_DISABLED as status +# on CREATE EVENT + +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; + +DROP EVENT test.slave_terminate; + +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; + +DROP EVENT test.slave_terminate; + +--echo "in the master" +connection master; +DROP TABLE t1; + diff --git a/mysql-test/include/rpl_stmt_seq.inc b/mysql-test/include/rpl_stmt_seq.inc index 3c91505d0d6..6c944dc4729 100644 --- a/mysql-test/include/rpl_stmt_seq.inc +++ b/mysql-test/include/rpl_stmt_seq.inc @@ -1,30 +1,51 @@ -# include/rpl_stmt_seq.inc -# -# Please be very careful when editing this routine, because the handling of -# the $variables is extreme sensitive. -# +################### include/rpl_stmt_seq.inc ########################### +# # +# Check if a given SQL statement (->$my_stmt) / AUTOCOMMIT mode / # +# storage engine somehow involved causes COMMIT or ROLLBACK. # +# # +# # +# The typical test sequence # +# ------------------------- # +# 1. master connection: INSERT without commit # +# check table content of master and slave # +# 2. master connection: EXECUTE the statement # +# check table content of master and slave # +# 3. master connection: ROLLBACK # +# check table content of master and slave # +# 4. flush the logs # +# # +# The variables # +# $show_binlog -- print binlog entries # +# 0 - default + fits to the file with # +# results # +# 1 - useful for debugging # +# This variable is used within # +# include/rpl_stmt_seq.inc. # +# $manipulate -- Manipulation of the binary logs # +# 0 - do nothing # +# 1 - so that the output of SHOW BINLOG # +# EVENTS IN contains only # +# commands of the current test sequence # +# This is especially useful, if the # +# $show_binlog is set to 1 and many # +# subtest are executed. # +# This variable is used within # +# include/rpl_stmt_seq.inc. # +# have to be set before sourcing this script. # +# # +# Please be very careful when editing this routine, because the # +# handling of the $variables is extreme sensitive. # +# # +######################################################################## -############################################################### -# Debug options : To debug this test script -############################################################### -let $show_binlog= 0; -let $manipulate= 1; - -######## The typical test sequence -# 1. INSERT without commit -# check table content of master and slave -# 2. EXECUTE the statement -# check table content of master and slave -# 3. ROLLBACK -# check table content of master and slave -# 4. flush the logs +# Last update: +# 2007-02-12 ML Replace comments via SQL by "--echo ..." +# let $VERSION=`select version()`; ---disable_query_log -# SELECT '######## new test sequence ########' as ""; -eval SELECT CONCAT('######## ','$my_stmt',' ########') as ""; ---enable_query_log +--echo +--echo ######## $my_stmt ######## ############################################################### @@ -49,11 +70,10 @@ let $_log_num_s= `select @aux`; ############################################################### # INSERT ############################################################### +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -# Maybe it would be smarter to use a table with autoincrement column. +# Maybe it would be smarter to use a table with an autoincrement column. let $MAX= `SELECT MAX(f1) FROM t1` ; eval INSERT INTO t1 SET f1= $MAX + 1; # results before DDL(to be tested) @@ -66,10 +86,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; } sync_slave_with_master; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log # results before DDL(to be tested) SELECT MAX(f1) FROM t1; if ($show_binlog) @@ -82,10 +101,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; ############################################################### # command to be tested ############################################################### +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log eval $my_stmt; # Devaluate $my_stmt, to detect script bugs let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT; @@ -99,10 +117,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; } sync_slave_with_master; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log # results after DDL(to be tested) SELECT MAX(f1) FROM t1; if ($show_binlog) @@ -115,10 +132,9 @@ eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; ############################################################### # ROLLBACK ############################################################### +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log ROLLBACK; # results after final ROLLBACK SELECT MAX(f1) FROM t1; @@ -140,10 +156,9 @@ eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; } sync_slave_with_master; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log # results after final ROLLBACK SELECT MAX(f1) FROM t1; --disable_query_log @@ -172,19 +187,17 @@ if ($manipulate) # - flush the master and the slave log # ---> both start to write into new logs with incremented number # - increment $_log_num_n +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log flush logs; # sleep 1; # eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; sync_slave_with_master; +--echo +--echo -------- switch to slave -------- connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log # the final content of the binary log flush logs; # The next sleep is urgent needed. @@ -195,7 +208,6 @@ flush logs; inc $_log_num_n; } +--echo +--echo -------- switch to master ------- connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log diff --git a/mysql-test/include/rpl_stmt_seq2.inc b/mysql-test/include/rpl_stmt_seq2.inc deleted file mode 100644 index 7671a6a857c..00000000000 --- a/mysql-test/include/rpl_stmt_seq2.inc +++ /dev/null @@ -1,201 +0,0 @@ -# include/rpl_stmt_seq.inc -# -# Please be very careful when editing this routine, because the handling of -# the $variables is extreme sensitive. -# - -############################################################### -# Debug options : To debug this test script -############################################################### -let $show_binlog= 0; -let $manipulate= 1; - -######## The typical test sequence -# 1. INSERT without commit -# check table content of master and slave -# 2. EXECUTE the statement -# check table content of master and slave -# 3. ROLLBACK -# check table content of master and slave -# 4. flush the logs - -let $VERSION=`select version()`; - ---disable_query_log -# SELECT '######## new test sequence ########' as ""; -eval SELECT CONCAT('######## ','$my_stmt',' $engine_type',' ########') as ""; ---enable_query_log - - -############################################################### -# Predict the number of the current log -############################################################### -# Disable the logging of the log number computation. ---disable_query_log -# $_log_num_n should contain the number of the current binlog in numeric style. -# If this routine is called for the first time, $_log_num will not initialized -# and contain the value '' instead of '1'. So we will correct it here. -# -eval set @aux= IF('$_log_num_n' = '', '1', '$_log_num_n'); -let $_log_num_n= `SELECT @aux`; -eval set @aux= LPAD('$_log_num_n',6,'0'); -# SELECT @aux AS "@aux is"; -# -# $_log_num_s should contain the number of the current binlog in string style. -let $_log_num_s= `select @aux`; -# eval SELECT '$log_num' ; ---enable_query_log - -############################################################### -# INSERT -############################################################### -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -# Maybe it would be smarter to use a table with autoincrement column. -let $MAX= `SELECT MAX(f1) FROM t1` ; -eval INSERT INTO t1 SET f1= $MAX + 1; -# results before DDL(to be tested) -SELECT MAX(f1) FROM t1; -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; -} -sync_slave_with_master; - -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -# results before DDL(to be tested) -SELECT MAX(f1) FROM t1; -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; -} - -############################################################### -# command to be tested -############################################################### -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -eval $my_stmt $engine_type; -# Devaluate $my_stmt, to detect script bugs -let $my_stmt= ERROR: YOU FORGOT TO FILL IN THE STATEMENT; -# results after DDL(to be tested) -SELECT MAX(f1) FROM t1; -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; -} -sync_slave_with_master; - -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -# results after DDL(to be tested) -SELECT MAX(f1) FROM t1; -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; -} - -############################################################### -# ROLLBACK -############################################################### -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -ROLLBACK; -# results after final ROLLBACK -SELECT MAX(f1) FROM t1; -# Try to detect if the DDL command caused that the INSERT is committed -# $MAX holds the highest/last value just before the insert of MAX + 1 ---disable_query_log -eval SELECT CONCAT(CONCAT('TEST-INFO: MASTER: The INSERT is ', - IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')), - IF((MAX(f1) = $MAX + 1) XOR NOT $my_master_commit, - ' (Succeeded)', - ' (Failed)')) AS "" - FROM mysqltest1.t1; ---enable_query_log -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; -} -sync_slave_with_master; - -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -# results after final ROLLBACK -SELECT MAX(f1) FROM t1; ---disable_query_log -eval SELECT CONCAT(CONCAT('TEST-INFO: SLAVE: The INSERT is ', - IF(MAX(f1) = $MAX + 1, 'committed', 'not committed')), - IF((MAX(f1) = $MAX + 1) XOR NOT $my_slave_commit, - ' (Succeeded)', - ' (Failed)')) AS "" - FROM mysqltest1.t1; ---enable_query_log -if ($show_binlog) -{ ---replace_result $VERSION VERSION ---replace_column 2 # 5 # -eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; -} - -############################################################### -# Manipulate binlog -############################################################### -if ($manipulate) -{ -#### Manipulate the binary logs, -# so that the output of SHOW BINLOG EVENTS IN -# contains only commands of the current test sequence. -# - flush the master and the slave log -# ---> both start to write into new logs with incremented number -# - increment $_log_num_n -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log -flush logs; -# sleep 1; -# eval SHOW BINLOG EVENTS IN 'master-bin.$_log_num_s'; -sync_slave_with_master; - -connection slave; ---disable_query_log -SELECT '-------- switch to slave --------' as ""; ---enable_query_log -# the final content of the binary log -flush logs; -# The next sleep is urgent needed. -# Without this sleep the slaves crashes often, when the SHOW BINLOG -# is executed. :-( -# sleep 1; -# eval SHOW BINLOG EVENTS IN 'slave-bin.$_log_num_s'; -inc $_log_num_n; -} - -connection master; ---disable_query_log -SELECT '-------- switch to master -------' as ""; ---enable_query_log diff --git a/mysql-test/include/rpl_udf.inc b/mysql-test/include/rpl_udf.inc new file mode 100644 index 00000000000..d9e19cda484 --- /dev/null +++ b/mysql-test/include/rpl_udf.inc @@ -0,0 +1,189 @@ +##################################################################### +# Author: Chuck Bell # +# Date: 2006-12-21 # +# Purpose: To test that UDFs are replicated in both row based and # +# statement based format. This tests work completed in WL#3629. # +# # +# This test is designed to exercise two of the three types of UDFs: # +# 1) UDFs via loadable libraries, and 2) UDFs with a SQL body. # +##################################################################### + +--source include/have_udf.inc + +# +# To run this tests the "sql/udf_example.c" need to be compiled into +# udf_example.so and LD_LIBRARY_PATH should be setup to point out where +# the library are. +# + +connection master; +--disable_warnings +drop table if exists t1; +--enable_warnings + +# +# Test 1) Test UDFs via loadable libraries +# +--echo "*** Test 1) Test UDFs via loadable libraries *** +--echo "Running on the master" +--enable_info +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB +--error ER_CANT_FIND_DL_ENTRY +eval CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "$UDF_EXAMPLE_LIB"; +--replace_column 3 UDF_LIB +SELECT * FROM mysql.func; +--disable_info + +save_master_pos; +connection slave; +sync_with_master; + +# Check to see that UDF CREATE statements were replicated +--echo "Running on the slave" +--enable_info +--replace_column 3 UDF_LIB +SELECT * FROM mysql.func; +--disable_info + +connection master; + +# Use the UDFs to do something +--echo "Running on the master" +--enable_info +eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type; +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; +--disable_info + +sync_slave_with_master; + +# Check to see if data was replicated +--echo "Running on the slave" +--enable_info +SELECT * FROM t1 ORDER BY sum; + +# Check to see that the functions are available for execution on the slave +SELECT myfunc_int(25); +SELECT myfunc_double(75.00); +--disable_info + +connection master; + +# Drop the functions +--echo "Running on the master" +--enable_info +DROP FUNCTION myfunc_double; +DROP FUNCTION myfunc_int; +SELECT * FROM mysql.func; +--disable_info + +sync_slave_with_master; + +# Check to see if the UDFs were dropped on the slave +--echo "Running on the slave" +--enable_info +SELECT * FROM mysql.func; +--disable_info + +connection master; + +# Cleanup +--echo "Running on the master" +--enable_info +DROP TABLE t1; +--disable_info + +# +# Test 2) Test UDFs with SQL body +# +--echo "*** Test 2) Test UDFs with SQL body *** +--echo "Running on the master" +--enable_info +CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; +CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00; +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +--disable_info + +sync_slave_with_master; + +# Check to see that UDF CREATE statements were replicated +--echo "Running on the slave" +--enable_info +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +--disable_info + +connection master; + +# Use the UDFs to do something +--echo "Running on the master" +--enable_info +eval CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=$engine_type; +INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00)); +INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00)); +INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00)); +INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00)); +SELECT * FROM t1 ORDER BY sum; +--disable_info + +sync_slave_with_master; + +# Check to see if data was replicated +--echo "Running on the slave" +--enable_info +SELECT * FROM t1 ORDER BY sum; +--disable_info + +connection master; + +# Modify the UDFs to add a comment +--echo "Running on the master" +--enable_info +ALTER FUNCTION myfuncsql_int COMMENT "This was altered."; +ALTER FUNCTION myfuncsql_double COMMENT "This was altered."; +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +--disable_info + +sync_slave_with_master; + +# Check to see if data was replicated +--echo "Running on the slave" +--enable_info +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; + +# Check to see that the functions are available for execution on the slave +SELECT myfuncsql_int(25); +SELECT myfuncsql_double(75.00); +--disable_info + +connection master; + +# Drop the functions +--echo "Running on the master" +--enable_info +DROP FUNCTION myfuncsql_double; +DROP FUNCTION myfuncsql_int; +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +--disable_info + +sync_slave_with_master; + +# Check to see if the UDFs were dropped on the slave +--echo "Running on the slave" +--enable_info +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +--disable_info + +connection master; + +# Cleanup +--echo "Running on the master" +--enable_info +DROP TABLE t1; +--disable_info diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index ae848d10687..7377b4a0fed 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,5 +1,5 @@ ---let $binlog_start=102 +--let $binlog_start=106 --replace_result $binlog_start --replace_column 2 # 4 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ --eval show binlog events from $binlog_start diff --git a/mysql-test/r/binlog_row_binlog.result b/mysql-test/r/binlog_row_binlog.result index bd6487105e2..6fcaad010d2 100644 --- a/mysql-test/r/binlog_row_binlog.result +++ b/mysql-test/r/binlog_row_binlog.result @@ -8,25 +8,25 @@ commit; begin; insert t2 values (5); commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb -master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb +master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=innodb +master-bin.000001 # Query # # use `test`; 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 */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ drop table t1,t2; reset master; create table t1 (n int) engine=innodb; begin; commit; drop table t1; -show binlog events in 'master-bin.000001' from 102; +show binlog events in 'master-bin.000001' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN @@ -232,7 +232,7 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 -show binlog events in 'master-bin.000002' from 102; +show binlog events in 'master-bin.000002' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 reset master; @@ -254,58 +254,58 @@ INSERT INTO user SET host='localhost', user='@#@', password=password('Just a tes UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'; DELETE FROM user WHERE host='localhost' AND user='@#@'; use test; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` ( +master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +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`; 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` ( `a` int(11) DEFAULT NULL ) -master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( +master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL ) -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F drop table t1,t2,t3,tt1; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t2` ( +master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +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`; 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` ( `a` int(11) DEFAULT NULL ) -master-bin.000001 # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( +master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL ) -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Update_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysql.user) -master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */ -master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Update_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TABLE `t1`,`t2`,`t3` /* generated by server */ +master-bin.000001 # Query # # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam +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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 @@ -328,12 +328,12 @@ drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 342 +master-bin.000001 346 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); show master status /* must show new binlog index after rotating */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 102 +master-bin.000002 106 drop table t3; diff --git a/mysql-test/r/binlog_row_blackhole.result b/mysql-test/r/binlog_row_blackhole.result index f370232e2c3..8e90ac4f30b 100644 --- a/mysql-test/r/binlog_row_blackhole.result +++ b/mysql-test/r/binlog_row_blackhole.result @@ -104,23 +104,22 @@ select * from t2; a select * from t3; a -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; drop table t1,t2 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; alter table t1 add b int -master-bin.000001 # Query 1 # use `test`; alter table t1 drop b -master-bin.000001 # Query 1 # use `test`; create table t3 like t1 +master-bin.000001 # Query # # use `test`; drop table t1,t2 +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole +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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +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`; create table t2 (a varchar(200)) engine=blackhole +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`; alter table t1 add b int +master-bin.000001 # Query # # use `test`; alter table t1 drop b +master-bin.000001 # Query # # use `test`; create table t3 like t1 drop table t1,t2,t3; CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE; DELETE FROM t1 WHERE a=10; @@ -143,12 +142,11 @@ start transaction; insert into t1 values(2); rollback; set autocommit=1; -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole +master-bin.000001 # Query # # use `test`; 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`; COMMIT drop table if exists t1; diff --git a/mysql-test/r/binlog_row_ctype_ucs.result b/mysql-test/r/binlog_row_ctype_ucs.result index 4eeff79e13a..4f4e7bcedd7 100644 --- a/mysql-test/r/binlog_row_ctype_ucs.result +++ b/mysql-test/r/binlog_row_ctype_ucs.result @@ -3,10 +3,10 @@ create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); reset master; insert into t2 values (@v); -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Table_map 1 141 table_id: # (test.t2) -master-bin.000001 141 Write_rows 1 231 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 flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; diff --git a/mysql-test/r/binlog_row_drop_tmp_tbl.result b/mysql-test/r/binlog_row_drop_tmp_tbl.result index 2b09fe069e3..503076d66d9 100644 --- a/mysql-test/r/binlog_row_drop_tmp_tbl.result +++ b/mysql-test/r/binlog_row_drop_tmp_tbl.result @@ -11,8 +11,7 @@ get_lock("a",10) select get_lock("a",10); get_lock("a",10) 1 -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # create database `drop-temp+table-test` +master-bin.000001 # Query # # create database `drop-temp+table-test` drop database `drop-temp+table-test`; diff --git a/mysql-test/r/binlog_row_insert_select.result b/mysql-test/r/binlog_row_insert_select.result index 14cef6709b6..cd6ddafc47b 100644 --- a/mysql-test/r/binlog_row_insert_select.result +++ b/mysql-test/r/binlog_row_insert_select.result @@ -6,11 +6,10 @@ insert into t2 values(1),(2); reset master; insert into t1 select * from t2; ERROR 23000: Duplicate entry '2' for key 'a' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Table_map 1 141 table_id: # (test.t1) -master-bin.000001 141 Write_rows 1 175 table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F select * from t1; a 1 @@ -21,7 +20,6 @@ insert into t1 values(1),(1); reset master; create table t2(unique(a)) select a from t1; ERROR 23000: Duplicate entry '1' for key 'a' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 drop table t1; diff --git a/mysql-test/r/binlog_row_mix_innodb_myisam.result b/mysql-test/r/binlog_row_mix_innodb_myisam.result index 185ca33d4db..6ac942176c7 100644 --- a/mysql-test/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_row_mix_innodb_myisam.result @@ -6,14 +6,14 @@ begin; insert into t1 values(1); insert into t2 select * from t1; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -23,14 +23,14 @@ insert into t2 select * from t1; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; 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 # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; @@ -43,18 +43,18 @@ rollback to savepoint my_savepoint; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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; delete from t2; reset master; @@ -72,20 +72,20 @@ select a from t1 order by a; a 5 7 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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 +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -98,52 +98,52 @@ insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; 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 # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; insert into t1 values(9); insert into t2 select * from t1; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +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 */ +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F delete from t1; delete from t2; reset master; insert into t1 values(10); begin; insert into t2 select * from t1; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +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 */ +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F insert into t1 values(11); commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +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 */ +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`; 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 */ alter table t2 engine=INNODB; delete from t1; delete from t2; @@ -152,14 +152,14 @@ begin; insert into t1 values(12); insert into t2 select * from t1; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -167,7 +167,7 @@ begin; insert into t1 values(13); insert into t2 select * from t1; rollback; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info delete from t1; delete from t2; @@ -179,12 +179,12 @@ insert into t1 values(15); insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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; reset master; @@ -200,14 +200,14 @@ select a from t1 order by a; a 16 18 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; 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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; alter table t2 engine=MyISAM; @@ -252,30 +252,30 @@ insert into t2 values (3); select get_lock("lock1",60); get_lock("lock1",60) 1 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Delete_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; alter table t2 engine=MyISAM -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; drop table t1,t2 -master-bin.000001 # Query 1 # use `test`; create table t0 (n int) -master-bin.000001 # Table_map 1 # table_id: # (test.t0) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t0) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; create table t2 (n int) engine=innodb +master-bin.000001 # Query # # use `test`; 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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM +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 */ +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`; drop table t1,t2 +master-bin.000001 # Query # # use `test`; create table t0 (n int) +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t0) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb do release_lock("lock1"); drop table t0,t2; set autocommit=0; @@ -355,39 +355,39 @@ SELECT * from t2; a b 100 100 DROP TABLE t1,t2; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; DROP TABLE if exists t2 -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t2 -master-bin.000001 # Query 1 # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; DROP TABLE t2 -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; DROP TABLE `t1` /* generated by server */ +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`; DROP TABLE if exists 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 # # 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 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +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`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t2 +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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +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`; DROP TABLE `t1` /* generated by server */ reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; diff --git a/mysql-test/r/binlog_stm_binlog.result b/mysql-test/r/binlog_stm_binlog.result index ac73fd6eed8..66fe3e40270 100644 --- a/mysql-test/r/binlog_stm_binlog.result +++ b/mysql-test/r/binlog_stm_binlog.result @@ -4,11 +4,11 @@ insert into t1 values (1,2); commit; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # -master-bin.000001 102 Query 1 209 use `test`; create table t1 (a int, b int) engine=innodb -master-bin.000001 209 Query 1 277 use `test`; BEGIN -master-bin.000001 277 Query 1 90 use `test`; insert into t1 values (1,2) -master-bin.000001 367 Xid 1 394 COMMIT /* XID */ +master-bin.000001 4 Format_desc 1 106 Server ver: #, Binlog ver: # +master-bin.000001 106 Query 1 213 use `test`; create table t1 (a int, b int) engine=innodb +master-bin.000001 213 Query 1 281 use `test`; BEGIN +master-bin.000001 281 Query 1 90 use `test`; insert into t1 values (1,2) +master-bin.000001 371 Xid 1 398 COMMIT /* XID */ drop table t1; drop table if exists t1, t2; reset master; @@ -20,23 +20,23 @@ commit; begin; insert t2 values (5); commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=innodb -master-bin.000001 # Query 1 # use `test`; create table t2 (a int) engine=innodb -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert t1 values (5) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert t2 values (5) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=innodb +master-bin.000001 # Query # # use `test`; create table t2 (a int) engine=innodb +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert t1 values (5) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert t2 values (5) +master-bin.000001 # Xid # # COMMIT /* XID */ drop table t1,t2; reset master; create table t1 (n int) engine=innodb; begin; commit; drop table t1; -show binlog events in 'master-bin.000001' from 102; +show binlog events in 'master-bin.000001' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb master-bin.000001 # Query 1 # use `test`; BEGIN @@ -142,7 +142,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4) master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 -show binlog events in 'master-bin.000002' from 102; +show binlog events in 'master-bin.000002' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 reset master; @@ -164,46 +164,46 @@ INSERT INTO user SET host='localhost', user='@#@', password=password('Just a tes UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'; DELETE FROM user WHERE host='localhost' AND user='@#@'; use test; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) -master-bin.000001 # Intvar 1 # INSERT_ID=127 -master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int) -master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1 -master-bin.000001 # Query 1 # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test') -master-bin.000001 # Query 1 # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' -master-bin.000001 # Query 1 # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' +master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +master-bin.000001 # Intvar # # INSERT_ID=127 +master-bin.000001 # Query # # use `test`; insert into t1 values(null) +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 # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test') +master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' +master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' drop table t1,t2,t3,tt1; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; set @@session.auto_increment_increment=1, @@session.auto_increment_offset=1; insert delayed into t1 values (207); insert delayed into t1 values (null); insert delayed into t1 values (300); -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; create table t1 (id tinyint auto_increment primary key) -master-bin.000001 # Intvar 1 # INSERT_ID=127 -master-bin.000001 # Query 1 # use `test`; insert into t1 values(null) -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 1 # use `test`; create table if not exists t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; create temporary table tt1 (a int) -master-bin.000001 # Query 1 # use `test`; create table if not exists t3 like tt1 -master-bin.000001 # Query 1 # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test') -master-bin.000001 # Query 1 # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' -master-bin.000001 # Query 1 # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' -master-bin.000001 # Query 1 # use `test`; drop table t1,t2,t3,tt1 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; create table t1 (id tinyint auto_increment primary key) +master-bin.000001 # Intvar # # INSERT_ID=127 +master-bin.000001 # Query # # use `test`; insert into t1 values(null) +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 # # use `mysql`; INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test') +master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' +master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' +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 # 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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F insert delayed into t1 values (null),(null),(null),(null); insert delayed into t1 values (null),(null),(400),(null); 11 == 11 @@ -226,12 +226,12 @@ drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 342 +master-bin.000001 346 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); show master status /* must show new binlog index after rotating */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 102 +master-bin.000002 106 drop table t3; diff --git a/mysql-test/r/binlog_stm_blackhole.result b/mysql-test/r/binlog_stm_blackhole.result index d382c94fba9..bf2fdfa616b 100644 --- a/mysql-test/r/binlog_stm_blackhole.result +++ b/mysql-test/r/binlog_stm_blackhole.result @@ -104,24 +104,23 @@ select * from t2; a select * from t3; a -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; drop table t1,t2 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole -master-bin.000001 # Query 1 # use `test`; delete from t1 where a=10 -master-bin.000001 # Query 1 # use `test`; update t1 set a=11 where a=15 -master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) -master-bin.000001 # Query 1 # use `test`; insert ignore into t1 values(1) -master-bin.000001 # Query 1 # use `test`; replace into t1 values(100) -master-bin.000001 # Query 1 # use `test`; create table t2 (a varchar(200)) engine=blackhole -master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 -master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1 -master-bin.000001 # Query 1 # use `test`; alter table t1 add b int -master-bin.000001 # Query 1 # use `test`; alter table t1 drop b -master-bin.000001 # Query 1 # use `test`; create table t3 like t1 -master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t3 -master-bin.000001 # Query 1 # use `test`; replace into t1 select * from t3 +master-bin.000001 # Query # # use `test`; drop table t1,t2 +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole +master-bin.000001 # Query # # use `test`; delete from t1 where a=10 +master-bin.000001 # Query # # use `test`; update t1 set a=11 where a=15 +master-bin.000001 # Query # # use `test`; insert into t1 values(1) +master-bin.000001 # Query # # use `test`; insert ignore into t1 values(1) +master-bin.000001 # Query # # use `test`; replace into t1 values(100) +master-bin.000001 # Query # # use `test`; create table t2 (a varchar(200)) engine=blackhole +master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581 +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t2 ;file_id=1 +master-bin.000001 # Query # # use `test`; alter table t1 add b int +master-bin.000001 # Query # # use `test`; alter table t1 drop b +master-bin.000001 # Query # # use `test`; create table t3 like t1 +master-bin.000001 # Query # # use `test`; insert into t1 select * from t3 +master-bin.000001 # Query # # use `test`; replace into t1 select * from t3 drop table t1,t2,t3; CREATE TABLE t1(a INT, b INT) ENGINE=BLACKHOLE; DELETE FROM t1 WHERE a=10; @@ -144,11 +143,10 @@ start transaction; insert into t1 values(2); rollback; set autocommit=1; -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) engine=blackhole -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) -master-bin.000001 # Query 1 # use `test`; COMMIT +master-bin.000001 # Query # # use `test`; create table t1 (a int) engine=blackhole +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(1) +master-bin.000001 # Query # # use `test`; COMMIT drop table if exists t1; diff --git a/mysql-test/r/binlog_stm_ctype_ucs.result b/mysql-test/r/binlog_stm_ctype_ucs.result index 76f3a3b06b9..c789c618876 100644 --- a/mysql-test/r/binlog_stm_ctype_ucs.result +++ b/mysql-test/r/binlog_stm_ctype_ucs.result @@ -3,10 +3,10 @@ create table t2 (c char(30)) charset=ucs2; set @v=convert('abc' using ucs2); reset master; insert into t2 values (@v); -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 User var 1 142 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci -master-bin.000001 142 Query 1 231 use `test`; insert into t2 values (@v) +master-bin.000001 # User var # # @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci +master-bin.000001 # Query # # use `test`; insert into t2 values (@v) flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; diff --git a/mysql-test/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/r/binlog_stm_drop_tmp_tbl.result index 96481341bd6..dc4349dea59 100644 --- a/mysql-test/r/binlog_stm_drop_tmp_tbl.result +++ b/mysql-test/r/binlog_stm_drop_tmp_tbl.result @@ -11,12 +11,11 @@ get_lock("a",10) select get_lock("a",10); get_lock("a",10) 1 -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # create database `drop-temp+table-test` -master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn1 (a int) -master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table `table:name` (a int) -master-bin.000001 # Query 1 # use `drop-temp+table-test`; create temporary table shortn2 (a int) -master-bin.000001 # Query 1 # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1` +master-bin.000001 # Query # # create database `drop-temp+table-test` +master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn1 (a int) +master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table `table:name` (a int) +master-bin.000001 # Query # # use `drop-temp+table-test`; create temporary table shortn2 (a int) +master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`shortn2`,`drop-temp+table-test`.`table:name`,`drop-temp+table-test`.`shortn1` drop database `drop-temp+table-test`; diff --git a/mysql-test/r/binlog_stm_insert_select.result b/mysql-test/r/binlog_stm_insert_select.result index 646a76b254d..a93a8edf4aa 100644 --- a/mysql-test/r/binlog_stm_insert_select.result +++ b/mysql-test/r/binlog_stm_insert_select.result @@ -6,10 +6,9 @@ insert into t2 values(1),(2); reset master; insert into t1 select * from t2; ERROR 23000: Duplicate entry '2' for key 'a' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 196 use `test`; insert into t1 select * from t2 +master-bin.000001 # Query # # use `test`; insert into t1 select * from t2 select * from t1; a 1 @@ -20,7 +19,6 @@ insert into t1 values(1),(1); reset master; create table t2(unique(a)) select a from t1; ERROR 23000: Duplicate entry '1' for key 'a' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 drop table t1; diff --git a/mysql-test/r/binlog_stm_mix_innodb_myisam.result b/mysql-test/r/binlog_stm_mix_innodb_myisam.result index 23f4e50826a..c74fb17d600 100644 --- a/mysql-test/r/binlog_stm_mix_innodb_myisam.result +++ b/mysql-test/r/binlog_stm_mix_innodb_myisam.result @@ -6,12 +6,12 @@ begin; insert into t1 values(1); insert into t2 select * from t1; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(1) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(1) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -21,12 +21,12 @@ insert into t2 select * from t1; rollback; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(2) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(2) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; @@ -39,15 +39,15 @@ rollback to savepoint my_savepoint; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(3) -master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 # Query 1 # use `test`; insert into t1 values(4) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(3) +master-bin.000001 # Query # # use `test`; savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(4) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -65,16 +65,16 @@ select a from t1 order by a; a 5 7 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(5) -master-bin.000001 # Query 1 # use `test`; savepoint my_savepoint -master-bin.000001 # Query 1 # use `test`; insert into t1 values(6) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; rollback to savepoint my_savepoint -master-bin.000001 # Query 1 # use `test`; insert into t1 values(7) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(5) +master-bin.000001 # Query # # use `test`; savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(6) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; rollback to savepoint my_savepoint +master-bin.000001 # Query # # use `test`; insert into t1 values(7) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -87,43 +87,43 @@ insert into t2 select * from t1; select get_lock("a",10); get_lock("a",10) 1 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(8) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; ROLLBACK +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(8) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; ROLLBACK delete from t1; delete from t2; reset master; insert into t1 values(9); insert into t2 select * from t1; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; insert into t1 values(9) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; insert into t1 values(9) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 delete from t1; delete from t2; reset master; insert into t1 values(10); begin; insert into t2 select * from t1; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; insert into t1 values(10) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 insert into t1 values(11); commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; insert into t1 values(10) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(11) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; insert into t1 values(10) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(11) +master-bin.000001 # Xid # # COMMIT /* XID */ alter table t2 engine=INNODB; delete from t1; delete from t2; @@ -132,12 +132,12 @@ begin; insert into t1 values(12); insert into t2 select * from t1; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(12) -master-bin.000001 # Query 1 # use `test`; insert into t2 select * from t1 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(12) +master-bin.000001 # Query # # use `test`; insert into t2 select * from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -145,7 +145,7 @@ begin; insert into t1 values(13); insert into t2 select * from t1; rollback; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info delete from t1; delete from t2; @@ -157,11 +157,11 @@ insert into t1 values(15); insert into t2 select * from t1; rollback to savepoint my_savepoint; commit; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(14) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(14) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; reset master; @@ -177,12 +177,12 @@ select a from t1 order by a; a 16 18 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(16) -master-bin.000001 # Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(16) +master-bin.000001 # Query # # use `test`; insert into t1 values(18) +master-bin.000001 # Xid # # COMMIT /* XID */ delete from t1; delete from t2; alter table t2 engine=MyISAM; @@ -227,31 +227,31 @@ insert into t2 values (3); select get_lock("lock1",60); get_lock("lock1",60) 1 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; insert into t1 values(16) -master-bin.000001 # Query 1 # use `test`; insert into t1 values(18) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; delete from t1 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; delete from t2 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; alter table t2 engine=MyISAM -master-bin.000001 # Query 1 # use `test`; insert into t1 values (1) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; insert into t2 values (20) -master-bin.000001 # Query 1 # use `test`; drop table t1,t2 -master-bin.000001 # Query 1 # use `test`; create temporary table ti (a int) engine=innodb -master-bin.000001 # Query 1 # use `test`; insert into ti values(1) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; create temporary table t1 (a int) engine=myisam -master-bin.000001 # Query 1 # use `test`; insert t1 values (1) -master-bin.000001 # Query 1 # use `test`; create table t0 (n int) -master-bin.000001 # Query 1 # use `test`; insert t0 select * from t1 -master-bin.000001 # Query 1 # use `test`; insert into t0 select GET_LOCK("lock1",null) -master-bin.000001 # Query 1 # use `test`; create table t2 (n int) engine=innodb -master-bin.000001 # Query 1 # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `test`.`t1`,`test`.`ti` +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; insert into t1 values(16) +master-bin.000001 # Query # # use `test`; insert into t1 values(18) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; delete from t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; delete from t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; alter table t2 engine=MyISAM +master-bin.000001 # Query # # use `test`; insert into t1 values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; insert into t2 values (20) +master-bin.000001 # Query # # use `test`; drop table t1,t2 +master-bin.000001 # Query # # use `test`; create temporary table ti (a int) engine=innodb +master-bin.000001 # Query # # use `test`; insert into ti values(1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; create temporary table t1 (a int) engine=myisam +master-bin.000001 # Query # # use `test`; insert t1 values (1) +master-bin.000001 # Query # # use `test`; create table t0 (n int) +master-bin.000001 # Query # # use `test`; insert t0 select * from t1 +master-bin.000001 # Query # # use `test`; insert into t0 select GET_LOCK("lock1",null) +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 `test`.`t1`,`test`.`ti` do release_lock("lock1"); drop table t0,t2; set autocommit=0; @@ -331,30 +331,30 @@ SELECT * from t2; a b 100 100 DROP TABLE t1,t2; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (1,1),(1,2) -master-bin.000001 # Query 1 # use `test`; DROP TABLE if exists t2 -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (3,3) -master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t2 -master-bin.000001 # Query 1 # use `test`; CREATE TABLE t2 (a int, b int, primary key (a)) engine=innodb -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (4,4) -master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (5,5) -master-bin.000001 # Query 1 # use `test`; DROP TABLE t2 -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (6,6) -master-bin.000001 # Query 1 # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (7,7) -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (8,8) -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (9,9) -master-bin.000001 # Query 1 # use `test`; TRUNCATE table t2 -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 values (10,10) -master-bin.000001 # Query 1 # use `test`; BEGIN -master-bin.000001 # Query 1 # use `test`; INSERT INTO t2 values (100,100) -master-bin.000001 # Xid 1 # COMMIT /* xid= */ -master-bin.000001 # Query 1 # use `test`; DROP TABLE t1,t2 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (1,1),(1,2) +master-bin.000001 # Query # # use `test`; DROP TABLE if exists t2 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (3,3) +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 # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5,5) +master-bin.000001 # Query # # use `test`; DROP TABLE t2 +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (6,6) +master-bin.000001 # Query # # use `test`; CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a)) engine=innodb +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (7,7) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (8,8) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (9,9) +master-bin.000001 # Query # # use `test`; TRUNCATE table t2 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; INSERT INTO t1 values (10,10) +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t2 values (100,100) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1,t2 reset master; create table t1 (a int) engine=innodb; create table t2 (a int) engine=myisam; diff --git a/mysql-test/r/client_xml.result b/mysql-test/r/client_xml.result index 7395b2433e8..6a148954fcd 100644 --- a/mysql-test/r/client_xml.result +++ b/mysql-test/r/client_xml.result @@ -7,7 +7,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 1 2 @@ -34,7 +34,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 1 @@ -42,7 +42,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 1 @@ -50,7 +50,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 0 @@ -58,7 +58,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 1 @@ -66,7 +66,7 @@ insert into t1 values (1, 2, 'a&b ab'); +" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> diff --git a/mysql-test/r/ctype_cp932_binlog_row.result b/mysql-test/r/ctype_cp932_binlog_row.result index f1a64241fbb..39d7727b58a 100644 --- a/mysql-test/r/ctype_cp932_binlog_row.result +++ b/mysql-test/r/ctype_cp932_binlog_row.result @@ -6,11 +6,11 @@ CREATE TABLE t1(f1 blob); PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; SET @var1= x'8300'; EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F SELECT HEX(f1) FROM t1; HEX(f1) 8300 diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index ef024e2fa20..b486d2faaa9 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -6,11 +6,11 @@ CREATE TABLE t1(f1 blob); PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; SET @var1= x'8300'; EXECUTE stmt1 USING @var1; -SHOW BINLOG EVENTS FROM 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(f1 blob) -master-bin.000001 # User var 1 # @`var1`=_binary 0x8300 COLLATE binary -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@'var1') +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(f1 blob) +master-bin.000001 # User var # # @`var1`=_binary 0x8300 COLLATE binary +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES(@'var1') SELECT HEX(f1) FROM t1; HEX(f1) 8300 @@ -30,17 +30,17 @@ HEX(s1) HEX(s2) d 466F6F2773206120426172 ED40ED41ED42 47.93 DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 406| +SHOW BINLOG EVENTS FROM 410| Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 406 Query 1 572 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, +master-bin.000001 410 Query 1 576 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, s2 CHAR(50) CHARACTER SET cp932, d DECIMAL(10,2)) -master-bin.000001 572 Query 1 820 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE bug18293 (IN ins1 CHAR(50), +master-bin.000001 576 Query 1 824 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 820 Query 1 1039 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) -master-bin.000001 1039 Query 1 1128 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1128 Query 1 1207 use `test`; DROP TABLE t4 +master-bin.000001 824 Query 1 1043 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172), NAME_CONST('ins2',_cp932 0xED40ED41ED42), NAME_CONST('ind',47.93)) +master-bin.000001 1043 Query 1 1132 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1132 Query 1 1211 use `test`; DROP TABLE t4 diff --git a/mysql-test/r/ctype_uca.result b/mysql-test/r/ctype_uca.result index 3e286c77c00..1fd1493bf1e 100644 --- a/mysql-test/r/ctype_uca.result +++ b/mysql-test/r/ctype_uca.result @@ -2654,3 +2654,12 @@ ii 2 ii 2 İİ 4 İİ 4 ii 2 İİ 4 II 2 ıı 4 II 2 DROP TABLE t1; +CREATE TABLE t1 ( +c1 text character set ucs2 collate ucs2_polish_ci NOT NULL +) ENGINE=MyISAM; +insert into t1 values (''),('a'); +SELECT COUNT(*), c1 FROM t1 GROUP BY c1; +COUNT(*) c1 +1 +1 a +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index a65b19695ec..fcfe5d6345b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -839,6 +839,24 @@ lily river drop table t1; deallocate prepare stmt; +set names latin1; +set character_set_connection=ucs2; +select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); +soundex('') soundex('he') soundex('hello all folks') soundex('#3556 in bugdb') + H000 H4142 I51231 +select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb')); +hex(soundex('')) hex(soundex('he')) hex(soundex('hello all folks')) hex(soundex('#3556 in bugdb')) + 0048003000300030 00480034003100340032 004900350031003200330031 +select 'mood' sounds like 'mud'; +'mood' sounds like 'mud' +1 +select hex(soundex(_ucs2 0x041004110412)); +hex(soundex(_ucs2 0x041004110412)) +0410003000300030 +select hex(soundex(_ucs2 0x00BF00C0)); +hex(soundex(_ucs2 0x00BF00C0)) +00C0003000300030 +set names latin1; create table t1(a blob, b text charset utf8, c text charset ucs2); select data_type, character_octet_length, character_maximum_length from information_schema.columns where table_name='t1'; diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 37ef5e2756f..380cf2f227d 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -854,6 +854,18 @@ select * from t1 where soundex(a) = soundex('test'); id a 1 Test drop table t1; +select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); +soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB) +阅000 +select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); +hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)) +E99885303030 +select soundex(_utf8 0xD091D092D093); +soundex(_utf8 0xD091D092D093) +Б000 +select hex(soundex(_utf8 0xD091D092D093)); +hex(soundex(_utf8 0xD091D092D093)) +D091303030 SET collation_connection='utf8_general_ci'; create table t1 select repeat('a',4000) a; delete from t1; diff --git a/mysql-test/r/events.result b/mysql-test/r/events.result index cab5762012c..59073358185 100644 --- a/mysql-test/r/events.result +++ b/mysql-test/r/events.result @@ -193,7 +193,7 @@ create event SHOW CREATE EVENT ðóóò21; Event sql_mode time_zone Create Event ðóóò21 SYSTEM CREATE EVENT `ðóóò21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'òîâà å 1251 êîìåíòàð' DO select 1 -insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND"); +insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1); show create event root22; ERROR 42000: This version of MySQL doesn't yet support 'MICROSECOND' SHOW EVENTS; @@ -225,18 +225,18 @@ drop event set names latin1; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 ALTER TABLE mysql.event ADD dummy INT FIRST; SHOW EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 18. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. Table probably corrupted ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST; SHOW EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 18. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 19. Table probably corrupted ALTER TABLE mysql.event DROP dummy2; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; @@ -258,10 +258,11 @@ event CREATE TABLE `event` ( `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, `ends` datetime DEFAULT NULL, - `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED', + `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `originator` int(10) NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (`db`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' @@ -270,8 +271,8 @@ ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error l ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default ''; "This should work" SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default ''; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. @@ -280,14 +281,14 @@ SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log. ALTER TABLE mysql.event DROP comment, DROP starts; SELECT event_name FROM INFORMATION_SCHEMA.EVENTS; -ERROR HY000: Column count of mysql.event is wrong. Expected 17, found 15. Table probably corrupted +ERROR HY000: Column count of mysql.event is wrong. Expected 18, found 16. Table probably corrupted DROP TABLE mysql.event; CREATE TABLE mysql.event like event_like; INSERT INTO mysql.event SELECT * FROM event_like; DROP TABLE event_like; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 DROP EVENT intact_check; create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; @@ -400,5 +401,5 @@ ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa SHOW EVENTS FROM ``; ERROR 42000: Incorrect database name '' SHOW EVENTS FROM `events\\test`; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator drop database events_test; diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 1a34f098b12..9b58420465e 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -30,7 +30,7 @@ create event e_55 on schedule at 20000101000000 do drop table t; Warnings: Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator create event e_55 on schedule at 20200101000000 starts 10000101000000 do drop table t; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'starts 10000101000000 do drop table t' at line 1 create event e_55 on schedule at 20200101000000 ends 10000101000000 do drop table t; diff --git a/mysql-test/r/events_grant.result b/mysql-test/r/events_grant.result index 8bcf40b5167..278cc5956f5 100644 --- a/mysql-test/r/events_grant.result +++ b/mysql-test/r/events_grant.result @@ -2,8 +2,8 @@ CREATE DATABASE IF NOT EXISTS events_test; use events_test; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT NULL events_test one_event root@localhost SQL SELECT 123 RECURRING NULL 10 SECOND ENABLED NOT PRESERVE @@ -29,8 +29,8 @@ ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_te USE events_test; "We should see one event"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 SELECT CONCAT("Let's create some new events from the name of ", USER()); CONCAT("Let's create some new events from the name of ", USER()) Let's create some new events from the name of ev_test@localhost @@ -40,18 +40,18 @@ CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE CO CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; "Now we should see 3 events:"; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED -events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED -events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 "This should show us only 2 events:"; SHOW EVENTS LIKE 't%event'; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED -events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +events_test three_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 +events_test two_event ev_test@localhost SYSTEM RECURRING NULL 20 # # NULL ENABLED 1 "This should show us no events:"; SHOW EVENTS FROM test LIKE '%'; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator GRANT EVENT ON events_test2.* TO ev_test@localhost; USE events_test2; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; diff --git a/mysql-test/r/events_restart_phase1.result b/mysql-test/r/events_restart_phase1.result index 0c032884dc4..75e3ef5176f 100644 --- a/mysql-test/r/events_restart_phase1.result +++ b/mysql-test/r/events_restart_phase1.result @@ -7,6 +7,6 @@ create event abc2 on schedule every 1 second do insert into execution_log value( create event abc3 on schedule every 1 second do insert into execution_log value('abc3'); select name from execution_log; name -insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1','SYSTEM'); -insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2','SYSTEM'); +insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1',1,'SYSTEM'); +insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2',1,'SYSTEM'); "Now we restart the server" diff --git a/mysql-test/r/events_scheduling.result b/mysql-test/r/events_scheduling.result index d885dc3a048..12f270748a6 100644 --- a/mysql-test/r/events_scheduling.result +++ b/mysql-test/r/events_scheduling.result @@ -69,7 +69,7 @@ OK SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') OK -DROP EVENT start_n_end; +DROP EVENT IF EXISTS events_test.start_n_end; "Already dropped because ended. Therefore an error." DROP EVENT only_one_time; ERROR HY000: Unknown event 'only_one_time' diff --git a/mysql-test/r/events_time_zone.result b/mysql-test/r/events_time_zone.result index 3d5ff794848..ec5cae88f4f 100644 --- a/mysql-test/r/events_time_zone.result +++ b/mysql-test/r/events_time_zone.result @@ -7,30 +7,30 @@ SET TIME_ZONE= '+00:00'; SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59'); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1 SET TIME_ZONE= '-01:00'; ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2000-01-01 00:00:00'; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost -01:00 RECURRING NULL 1 DAY 2000-01-01 00:00:00 NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost -01:00 RECURRING NULL 1 DAY 2000-01-01 00:00:00 NULL ENABLED 1 SET TIME_ZONE= '+02:00'; ALTER EVENT e1 ON SCHEDULE AT '2000-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost +02:00 ONE TIME 2000-01-02 00:00:00 NULL NULL NULL NULL DISABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost +02:00 ONE TIME 2000-01-02 00:00:00 NULL NULL NULL NULL DISABLED 1 SET TIME_ZONE= '-03:00'; ALTER EVENT e1 ON SCHEDULE EVERY 1 DAY ENDS '2030-01-03 00:00:00' ON COMPLETION PRESERVE DISABLE; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 DISABLED 1 SET TIME_ZONE= '+04:00'; ALTER EVENT e1 DO SELECT 2; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost -03:00 RECURRING NULL 1 DAY 2005-12-31 20:58:59 2030-01-03 00:00:00 ENABLED 1 DROP EVENT e1; SET TIME_ZONE='+05:00'; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO @@ -44,15 +44,15 @@ SET TIME_ZONE='+00:00'; CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; SELECT * FROM INFORMATION_SCHEMA.EVENTS; -EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT -NULL mysqltest_db1 e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL -NULL mysqltest_db1 e2 root@localhost -05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:00 2005-12-31 23:59:00 NULL -NULL mysqltest_db1 e3 root@localhost +00:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:01 2005-12-31 23:59:01 NULL +EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR +NULL mysqltest_db1 e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1 +NULL mysqltest_db1 e2 root@localhost -05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:00 2005-12-31 23:59:00 NULL 1 +NULL mysqltest_db1 e3 root@localhost +00:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:59:01 2005-12-31 23:59:01 NULL 1 SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 SHOW CREATE EVENT e1; Event sql_mode time_zone Create Event e1 +05:00 CREATE EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 @@ -92,10 +92,10 @@ SELECT 1; Warnings: Note 1584 Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost +05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e2 root@localhost -05:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED 1 The following should succeed giving a warning. ALTER EVENT e1 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE; @@ -128,15 +128,15 @@ CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00' DO SELECT 1; SHOW EVENTS; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -mysqltest_db1 e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED -mysqltest_db1 e2 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED -mysqltest_db1 e4 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED -mysqltest_db1 e5 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED -mysqltest_db1 e6 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED -mysqltest_db1 e7 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED -mysqltest_db1 e8 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +mysqltest_db1 e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 +mysqltest_db1 e2 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e3 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 +mysqltest_db1 e4 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 +mysqltest_db1 e5 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 +mysqltest_db1 e6 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 NULL ENABLED 1 +mysqltest_db1 e7 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 +mysqltest_db1 e8 root@localhost +00:00 ONE TIME 1999-01-01 00:00:00 NULL NULL NULL NULL DISABLED 1 DROP EVENT e8; DROP EVENT e7; DROP EVENT e6; diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result index 1d045b21763..16fb143ee4c 100644 --- a/mysql-test/r/flush_block_commit_notembedded.result +++ b/mysql-test/r/flush_block_commit_notembedded.result @@ -5,11 +5,11 @@ insert t1 values (1); flush tables with read lock; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 102 +master-bin.000001 106 commit; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 102 +master-bin.000001 106 unlock tables; drop table t1; set autocommit=1; diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index da90ff2cf6b..895e5dd46fa 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3440,8 +3440,8 @@ use first; set time_zone = 'UTC'; create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 show create event ee1; Event sql_mode time_zone Create Event ee1 UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 @@ -3449,26 +3449,26 @@ drop database first; create database second; use second; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 show create event ee1; Event sql_mode time_zone Create Event ee1 NO_AUTO_VALUE_ON_ZERO UTC CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED -second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 +second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 +second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 drop database second; create database third; use third; show events; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status -third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED -third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator +third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 +third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 +third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 drop database third; set time_zone = 'SYSTEM'; use test; diff --git a/mysql-test/r/ndb_binlog_multi.result b/mysql-test/r/ndb_binlog_multi.result index 3a84c89a7a4..cae1cfa8ce7 100644 --- a/mysql-test/r/ndb_binlog_multi.result +++ b/mysql-test/r/ndb_binlog_multi.result @@ -13,6 +13,7 @@ master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t2) master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # +master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT select * from t2 order by a; @@ -35,6 +36,7 @@ master-bin.000001 # Query # # BEGIN master-bin.000001 # Table_map # # table_id: # (test.t2) master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) 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 # # COMMIT master-bin.000001 # Query # # use `test`; DROP TABLE t2 @@ -53,6 +55,7 @@ master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t1) master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # +master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT SELECT @the_epoch2:=epoch,inserts,updates,deletes,schemaops FROM @@ -71,6 +74,7 @@ master-bin1.000001 # Query # # BEGIN master-bin1.000001 # Table_map # # table_id: # (test.t1) master-bin1.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) master-bin1.000001 # Write_rows # # table_id: # +master-bin1.000001 # Write_rows # # table_id: # master-bin1.000001 # Write_rows # # table_id: # flags: STMT_END_F master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # use `test`; drop table t1 diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index c4e44945ec4..1df845850b8 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -1968,11 +1968,11 @@ prepare abc from "show master logs"; deallocate prepare abc; create procedure proc_1() show events; call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator call proc_1(); -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator drop procedure proc_1; create function func_1() returns int begin show events; return 1; end| ERROR 0A000: Not allowed to return a result set from a function @@ -1982,11 +1982,11 @@ drop function func_1; ERROR 42000: FUNCTION test.func_1 does not exist prepare abc from "show events"; execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator execute abc; -Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator deallocate prepare abc; drop procedure if exists a; create procedure a() select 42; diff --git a/mysql-test/r/rpl_000015.result b/mysql-test/r/rpl_000015.result index a53750f82ad..13da328e522 100644 --- a/mysql-test/r/rpl_000015.result +++ b/mysql-test/r/rpl_000015.result @@ -1,7 +1,7 @@ reset master; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 102 +master-bin.000001 106 reset slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master @@ -17,7 +17,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # drop table if exists t1; create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result index 513de9494ba..c3909de5ba5 100644 --- a/mysql-test/r/rpl_change_master.result +++ b/mysql-test/r/rpl_change_master.result @@ -13,11 +13,11 @@ insert into t1 values(2); stop slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 187 # None 0 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # change master to master_user='root'; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 187 # None 0 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # start slave; select * from t1; n diff --git a/mysql-test/r/rpl_ddl.result b/mysql-test/r/rpl_ddl.result index ace86532b12..d41462de621 100644 --- a/mysql-test/r/rpl_ddl.result +++ b/mysql-test/r/rpl_ddl.result @@ -4,45 +4,133 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; + +-------- switch to master ------- SET AUTOCOMMIT = 1; DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest3; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; -CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="InnoDB"; +CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=InnoDB; INSERT INTO mysqltest1.t1 SET f1= 0; -CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE="InnoDB"; +CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=InnoDB; CREATE INDEX my_idx6 ON mysqltest1.t6(f1); -CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE="InnoDB"; +CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=InnoDB; INSERT INTO mysqltest1.t7 SET f1= 0; -CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE="InnoDB"; -CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT); +CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=InnoDB; +CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=InnoDB; +CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=MEMORY; SET AUTOCOMMIT = 0; use mysqltest1; -------- switch to slave -------- -SET AUTOCOMMIT = 0; +SET AUTOCOMMIT = 1; use mysqltest1; -------- switch to master ------- -######## COMMIT ######## +######## SELECT 1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT 1; +1 +1 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## SELECT COUNT(*) FROM t1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## COMMIT ######## -------- switch to master ------- INSERT INTO t1 SET f1= 0 + 1; @@ -82,14 +170,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## ROLLBACK ######## +######## ROLLBACK ######## -------- switch to master ------- INSERT INTO t1 SET f1= 1 + 1; @@ -129,14 +211,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## SET AUTOCOMMIT=1 ######## +######## SET AUTOCOMMIT=1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 1 + 1; @@ -175,16 +251,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SET AUTOCOMMIT=0; -######## START TRANSACTION ######## +######## START TRANSACTION ######## -------- switch to master ------- INSERT INTO t1 SET f1= 2 + 1; @@ -224,14 +294,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## BEGIN ######## +######## BEGIN ######## -------- switch to master ------- INSERT INTO t1 SET f1= 3 + 1; @@ -271,14 +335,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## DROP TABLE mysqltest1.t2 ######## +######## DROP TABLE mysqltest1.t2 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 4 + 1; @@ -317,12 +375,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW TABLES LIKE 't2'; Tables_in_mysqltest1 (t2) @@ -333,7 +385,7 @@ Tables_in_mysqltest1 (t2) -------- switch to master ------- -######## DROP TEMPORARY TABLE mysqltest1.t23 ######## +######## DROP TEMPORARY TABLE mysqltest1.t23 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 5 + 1; @@ -368,15 +420,9 @@ TEST-INFO: MASTER: The INSERT is not committed (Succeeded) -------- switch to slave -------- SELECT MAX(f1) FROM t1; MAX(f1) -6 +5 -TEST-INFO: SLAVE: The INSERT is committed (Succeeded) - --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) -------- switch to master ------- SHOW TABLES LIKE 't23'; @@ -388,7 +434,7 @@ Tables_in_mysqltest1 (t23) -------- switch to master ------- -######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## +######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 5 + 1; @@ -399,7 +445,7 @@ MAX(f1) -------- switch to slave -------- SELECT MAX(f1) FROM t1; MAX(f1) -6 +5 -------- switch to master ------- RENAME TABLE mysqltest1.t3 to mysqltest1.t20; @@ -427,12 +473,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW TABLES LIKE 't20'; Tables_in_mysqltest1 (t20) @@ -445,7 +485,7 @@ t20 -------- switch to master ------- -######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## +######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## -------- switch to master ------- INSERT INTO t1 SET f1= 6 + 1; @@ -484,12 +524,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- describe mysqltest1.t4; Field Type Null Key Default Extra @@ -504,7 +538,7 @@ f2 bigint(20) YES NULL -------- switch to master ------- -######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB" ######## +######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB ######## -------- switch to master ------- INSERT INTO t1 SET f1= 7 + 1; @@ -518,7 +552,7 @@ MAX(f1) 7 -------- switch to master ------- -CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "InnoDB"; +CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= InnoDB; SELECT MAX(f1) FROM t1; MAX(f1) 8 @@ -544,14 +578,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ######## +######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ######## -------- switch to master ------- INSERT INTO t1 SET f1= 8 + 1; @@ -565,7 +593,7 @@ MAX(f1) 8 -------- switch to master ------- -CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT); +CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY; SELECT MAX(f1) FROM t1; MAX(f1) 9 @@ -586,19 +614,13 @@ TEST-INFO: MASTER: The INSERT is not committed (Succeeded) -------- switch to slave -------- SELECT MAX(f1) FROM t1; MAX(f1) -9 +8 -TEST-INFO: SLAVE: The INSERT is committed (Succeeded) - --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) -------- switch to master ------- -######## TRUNCATE TABLE mysqltest1.t7 ######## +######## TRUNCATE TABLE mysqltest1.t7 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 8 + 1; @@ -609,7 +631,7 @@ MAX(f1) -------- switch to slave -------- SELECT MAX(f1) FROM t1; MAX(f1) -9 +8 -------- switch to master ------- TRUNCATE TABLE mysqltest1.t7; @@ -637,21 +659,17 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SELECT * FROM mysqltest1.t7; f1 + -------- switch to slave -------- SELECT * FROM mysqltest1.t7; f1 + -------- switch to master ------- -######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## +######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## -------- switch to master ------- INSERT INTO t1 SET f1= 9 + 1; @@ -690,16 +708,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- UNLOCK TABLES; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -738,16 +750,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- LOCK TABLES mysqltest1.t1 READ; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -787,16 +793,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -836,14 +836,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## +######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 11 + 1; @@ -882,12 +876,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW INDEX FROM mysqltest1.t6; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -898,7 +886,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par -------- switch to master ------- -######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## +######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## -------- switch to master ------- INSERT INTO t1 SET f1= 12 + 1; @@ -937,12 +925,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW INDEX FROM mysqltest1.t5; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -955,7 +937,7 @@ t5 1 my_idx5 1 f1 A NULL NULL NULL YES BTREE -------- switch to master ------- -######## DROP DATABASE mysqltest2 ######## +######## DROP DATABASE mysqltest2 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 13 + 1; @@ -994,12 +976,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW DATABASES LIKE "mysqltest2"; Database (mysqltest2) @@ -1010,7 +986,7 @@ Database (mysqltest2) -------- switch to master ------- -######## CREATE DATABASE mysqltest3 ######## +######## CREATE DATABASE mysqltest3 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 14 + 1; @@ -1049,12 +1025,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW DATABASES LIKE "mysqltest3"; Database (mysqltest3) @@ -1067,7 +1037,7 @@ mysqltest3 -------- switch to master ------- -######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## +######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## -------- switch to master ------- INSERT INTO t1 SET f1= 15 + 1; @@ -1107,33 +1077,30 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment -######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## +######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## -------- switch to master ------- INSERT INTO t1 SET f1= 16 + 1; @@ -1173,33 +1140,30 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment I have been altered - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment I have been altered -######## DROP PROCEDURE p1 ######## +######## DROP PROCEDURE p1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 17 + 1; @@ -1239,17 +1203,14 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## +######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 18 + 1; @@ -1289,22 +1250,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to master ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` --------- switch to slave ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` - -######## ALTER VIEW v1 AS select f1 from t1 ######## +######## ALTER VIEW v1 AS select f1 from t1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 19 + 1; @@ -1344,22 +1301,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to master ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` --------- switch to slave ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` - -######## DROP VIEW IF EXISTS v1 ######## +######## DROP VIEW IF EXISTS v1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 20 + 1; @@ -1399,20 +1352,16 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist -------- switch to master ------- -SHOW CREATE VIEW v1; -ERROR 42S02: Table 'mysqltest1.v1' doesn't exist --------- switch to slave ------- -SHOW CREATE VIEW v1; -ERROR 42S02: Table 'mysqltest1.v1' doesn't exist - -######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## +######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 21 + 1; @@ -1452,22 +1401,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to slave -------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to master ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost --------- switch to slave ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost - -######## DROP TRIGGER trg1 ######## +######## DROP TRIGGER trg1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 22 + 1; @@ -1507,20 +1452,16 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer -------- switch to slave -------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer -------- switch to master ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer --------- switch to slave ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer - -######## CREATE USER user1@localhost ######## +######## CREATE USER user1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 23 + 1; @@ -1560,22 +1501,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'user1'; -user -user1 --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'user1'; -user -user1 - -######## RENAME USER user1@localhost TO rename1@localhost ######## +######## RENAME USER user1@localhost TO rename1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 24 + 1; @@ -1615,22 +1552,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -rename1 --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -rename1 - -######## DROP USER rename1@localhost ######## +######## DROP USER rename1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 25 + 1; @@ -1670,18 +1603,14 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +use test; -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user - --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest3; diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result index caf040c0997..48fdf051d50 100644 --- a/mysql-test/r/rpl_deadlock_innodb.result +++ b/mysql-test/r/rpl_deadlock_innodb.result @@ -80,7 +80,7 @@ Master_SSL_Key Seconds_Behind_Master # stop slave; delete from t3; -change master to master_log_pos=544; +change master to master_log_pos=548; begin; select * from t2 for update; a @@ -136,7 +136,7 @@ set @my_max_relay_log_size= @@global.max_relay_log_size; set global max_relay_log_size=0; stop slave; delete from t3; -change master to master_log_pos=544; +change master to master_log_pos=548; begin; select * from t2 for update; a diff --git a/mysql-test/r/rpl_events.result b/mysql-test/r/rpl_events.result new file mode 100644 index 00000000000..bff1a814a6d --- /dev/null +++ b/mysql-test/r/rpl_events.result @@ -0,0 +1,161 @@ +set global event_scheduler=1; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set binlog_format=row; +DROP EVENT IF EXISTS test.justonce; +drop table if exists t1,t2; +CREATE TABLE `t1` ( +`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`c` VARCHAR(50) NOT NULL, +`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 (c) VALUES ('manually'); +CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 +(c) VALUES ('from justonce'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce ENABLED 1 +"in the master" +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +"in the slave" +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce SLAVESIDE_DISABLED 1 +DROP EVENT IF EXISTS test.slave_once; +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +INSERT INTO t1(c) VALUES ('from slave_once'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; +db name status originator +test slave_once ENABLED 2 +DROP EVENT IF EXISTS test.slave_once; +DROP EVENT IF EXISTS test.justonce; +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +INSERT INTO t1(c) VALUES ('from er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') +"in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') +"in the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') +"in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') +"in the master" +DROP EVENT test.er; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; +db name status originator +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; +db name status originator +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +db name status originator +test slave_terminate ENABLED 2 +DROP EVENT test.slave_terminate; +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +db name status originator +test slave_terminate SLAVESIDE_DISABLED 2 +DROP EVENT test.slave_terminate; +"in the master" +DROP TABLE t1; +set binlog_format=statement; +DROP EVENT IF EXISTS test.justonce; +drop table if exists t1,t2; +CREATE TABLE `t1` ( +`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, +`c` VARCHAR(50) NOT NULL, +`ts` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, +PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO t1 (c) VALUES ('manually'); +CREATE EVENT test.justonce ON SCHEDULE AT NOW() + INTERVAL 2 SECOND DO INSERT INTO t1 +(c) VALUES ('from justonce'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce ENABLED 1 +"in the master" +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +"in the slave" +SELECT * FROM t1 WHERE c = 'from justonce' OR c = 'manually' ORDER BY id; +id c ts +1 manually TIMESTAMP +2 from justonce TIMESTAMP +affected rows: 2 +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'justonce'; +db name status originator +test justonce SLAVESIDE_DISABLED 1 +DROP EVENT IF EXISTS test.slave_once; +CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE DO +INSERT INTO t1(c) VALUES ('from slave_once'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; +db name status originator +test slave_once ENABLED 2 +DROP EVENT IF EXISTS test.slave_once; +DROP EVENT IF EXISTS test.justonce; +CREATE EVENT test.er ON SCHEDULE EVERY 3 SECOND DO +INSERT INTO t1(c) VALUES ('from er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT INTO t1(c) VALUES ('from er') +"in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT INTO t1(c) VALUES ('from er') +"in the master" +ALTER EVENT test.er ON SCHEDULE EVERY 5 SECOND DO INSERT into t1(c) VALUES ('from alter er'); +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er ENABLED 1 INSERT into t1(c) VALUES ('from alter er') +"in the slave" +SELECT db, name, status, originator, body FROM mysql.event WHERE db = 'test' AND name = 'er'; +db name status originator body +test er SLAVESIDE_DISABLED 1 INSERT into t1(c) VALUES ('from alter er') +"in the master" +DROP EVENT test.er; +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; +db name status originator +"in the slave" +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test'; +db name status originator +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +db name status originator +test slave_terminate ENABLED 2 +DROP EVENT test.slave_terminate; +CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND +DISABLE ON SLAVE DO INSERT INTO t1(c) VALUES ('from slave_terminate'); +SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; +db name status originator +test slave_terminate SLAVESIDE_DISABLED 2 +DROP EVENT test.slave_terminate; +"in the master" +DROP TABLE t1; diff --git a/mysql-test/r/rpl_flushlog_loop.result b/mysql-test/r/rpl_flushlog_loop.result index 16d8ba251f4..40eb403f6e7 100644 --- a/mysql-test/r/rpl_flushlog_loop.result +++ b/mysql-test/r/rpl_flushlog_loop.result @@ -24,7 +24,7 @@ Master_User root Master_Port SLAVE_PORT Connect_Retry 60 Master_Log_File slave-bin.000001 -Read_Master_Log_Pos 212 +Read_Master_Log_Pos 216 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File slave-bin.000001 @@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 212 +Exec_Master_Log_Pos 216 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/r/rpl_incident.result b/mysql-test/r/rpl_incident.result new file mode 100644 index 00000000000..70086c1e848 --- /dev/null +++ b/mysql-test/r/rpl_incident.result @@ -0,0 +1,108 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** On Master **** +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; +a +1 +2 +3 +SET @saved = @@debug; +SET SESSION debug="d,incident_database_resync_on_replace"; +REPLACE INTO t1 VALUES (4); +SET SESSION debug=@saved; +SELECT * FROM t1; +a +1 +2 +3 +4 +**** On Slave **** +SELECT * FROM t1; +a +1 +2 +3 +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000002 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 1586 +Last_Error The incident LOST_EVENTS occured on the master. Message: +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +START SLAVE; +SELECT * FROM t1; +a +1 +2 +3 +4 +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000002 +Read_Master_Log_Pos # +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000002 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos # +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +DROP TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/r/rpl_known_bugs_detection.result b/mysql-test/r/rpl_known_bugs_detection.result index eabc6185780..9ce6ac25c88 100644 --- a/mysql-test/r/rpl_known_bugs_detection.result +++ b/mysql-test/r/rpl_known_bugs_detection.result @@ -33,7 +33,7 @@ Replicate_Wild_Ignore_Table Last_Errno 1105 Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10' Skip_Counter 0 -Exec_Master_Log_Pos 242 +Exec_Master_Log_Pos 246 Relay_Log_Space # Until_Condition None Until_Log_File @@ -115,7 +115,7 @@ FROM t2 ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c' Skip_Counter 0 -Exec_Master_Log_Pos 1274 +Exec_Master_Log_Pos 1278 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result index cae11e98caa..c68d2d9677e 100644 --- a/mysql-test/r/rpl_loaddata.result +++ b/mysql-test/r/rpl_loaddata.result @@ -28,7 +28,7 @@ day id category name 2003-03-22 2416 a bbbbb show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -slave-bin.000001 1276 +slave-bin.000001 1280 drop table t1; drop table t2; drop table t3; @@ -39,7 +39,7 @@ set global sql_slave_skip_counter=1; start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1793 # # master-bin.000001 Yes Yes # 0 0 1793 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # set sql_log_bin=0; delete from t1; set sql_log_bin=1; @@ -49,7 +49,7 @@ change master to master_user='test'; change master to master_user='root'; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1828 # # master-bin.000001 No No # 0 0 1828 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; diff --git a/mysql-test/r/rpl_loaddata_s.result b/mysql-test/r/rpl_loaddata_s.result index f0c79c81c15..4fc33eee20d 100644 --- a/mysql-test/r/rpl_loaddata_s.result +++ b/mysql-test/r/rpl_loaddata_s.result @@ -10,6 +10,6 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table test.t1; select count(*) from test.t1; count(*) 2 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info drop table test.t1; diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result index c7484022b23..01ff89741c8 100644 --- a/mysql-test/r/rpl_log_pos.result +++ b/mysql-test/r/rpl_log_pos.result @@ -6,37 +6,37 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 102 +master-bin.000001 106 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # stop slave; -change master to master_log_pos=74; +change master to master_log_pos=75; start slave; stop slave; -change master to master_log_pos=74; +change master to master_log_pos=75; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 74 # # master-bin.000001 No No 0 0 74 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No No 0 0 75 # None 0 No # start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 74 # # master-bin.000001 No Yes 0 0 74 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No Yes 0 0 75 # None 0 No # stop slave; -change master to master_log_pos=177; +change master to master_log_pos=178; start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 177 # # master-bin.000001 No Yes 0 0 177 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 102 +master-bin.000001 106 create table if not exists t1 (n int); drop table if exists t1; create table t1 (n int); insert into t1 values (1),(2),(3); stop slave; -change master to master_log_pos=102; +change master to master_log_pos=106; start slave; select * from t1 ORDER BY n; n diff --git a/mysql-test/r/rpl_misc_functions.result b/mysql-test/r/rpl_misc_functions.result index c11663b8ac8..526414cec9c 100644 --- a/mysql-test/r/rpl_misc_functions.result +++ b/mysql-test/r/rpl_misc_functions.result @@ -18,6 +18,29 @@ create table t2 like t1; load data local infile 'MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2; select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); id i r1 r2 p id i r1 r2 p -stop slave; -drop table t1; drop table t1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (col_a double default NULL); +CREATE PROCEDURE test_replication_sp1() +BEGIN +INSERT INTO t1 VALUES (rand()), (rand()); +INSERT INTO t1 VALUES (rand()); +END| +CREATE PROCEDURE test_replication_sp2() +BEGIN +CALL test_replication_sp1(); +CALL test_replication_sp1(); +END| +CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC +BEGIN +RETURN (rand() + rand()); +END| +CALL test_replication_sp1(); +CALL test_replication_sp2(); +INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 VALUES (test_replication_sf()); +DROP PROCEDURE IF EXISTS test_replication_sp1; +DROP PROCEDURE IF EXISTS test_replication_sp2; +DROP FUNCTION IF EXISTS test_replication_sf; +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result index 40fb639d8d8..499ce41597c 100644 --- a/mysql-test/r/rpl_ndb_basic.result +++ b/mysql-test/r/rpl_ndb_basic.result @@ -132,8 +132,8 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 146 -Last_Error Error in Write_rows event: error during transaction execution on table test.t1 +Last_Errno 1105 +Last_Error Unknown error Skip_Counter 0 Exec_Master_Log_Pos Relay_Log_Space diff --git a/mysql-test/r/rpl_ndb_charset.result b/mysql-test/r/rpl_ndb_charset.result index 0ce4446c8a5..ed9b3cfbfa8 100644 --- a/mysql-test/r/rpl_ndb_charset.result +++ b/mysql-test/r/rpl_ndb_charset.result @@ -109,39 +109,39 @@ a b 1 cp850_general_ci drop database mysqltest2; drop database mysqltest3; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest2 -master-bin.000001 # Query 1 # drop database if exists mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # drop database mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # drop database mysqltest2 -master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Query # # drop database if exists mysqltest3 +master-bin.000001 # Query # # create database mysqltest2 character set latin2 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # drop database mysqltest3 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # drop database mysqltest2 +master-bin.000001 # Query # # drop database mysqltest3 select "--- --global--" as ""; --- --global-- diff --git a/mysql-test/r/rpl_ndb_ddl.result b/mysql-test/r/rpl_ndb_ddl.result index f5d8073be94..aeaca1e7de0 100644 --- a/mysql-test/r/rpl_ndb_ddl.result +++ b/mysql-test/r/rpl_ndb_ddl.result @@ -4,45 +4,133 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; + +-------- switch to master ------- SET AUTOCOMMIT = 1; DROP DATABASE IF EXISTS mysqltest1; DROP DATABASE IF EXISTS mysqltest2; DROP DATABASE IF EXISTS mysqltest3; CREATE DATABASE mysqltest1; CREATE DATABASE mysqltest2; -CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE="NDB"; +CREATE TABLE mysqltest1.t1 (f1 BIGINT) ENGINE=NDB; INSERT INTO mysqltest1.t1 SET f1= 0; -CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE="NDB"; +CREATE TABLE mysqltest1.t2 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t3 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t4 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t5 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t6 (f1 BIGINT) ENGINE=NDB; CREATE INDEX my_idx6 ON mysqltest1.t6(f1); -CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE="NDB"; +CREATE TABLE mysqltest1.t7 (f1 BIGINT) ENGINE=NDB; INSERT INTO mysqltest1.t7 SET f1= 0; -CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE="NDB"; -CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE="NDB"; -CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT); +CREATE TABLE mysqltest1.t8 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t9 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t10 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t11 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t12 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t13 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t14 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t15 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t16 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t17 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t18 (f1 BIGINT) ENGINE=NDB; +CREATE TABLE mysqltest1.t19 (f1 BIGINT) ENGINE=NDB; +CREATE TEMPORARY TABLE mysqltest1.t23 (f1 BIGINT) ENGINE=MEMORY; SET AUTOCOMMIT = 0; use mysqltest1; -------- switch to slave -------- -SET AUTOCOMMIT = 0; +SET AUTOCOMMIT = 1; use mysqltest1; -------- switch to master ------- -######## COMMIT ######## +######## SELECT 1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT 1; +1 +1 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## SELECT COUNT(*) FROM t1 ######## + +-------- switch to master ------- +INSERT INTO t1 SET f1= 0 + 1; +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +SELECT COUNT(*) FROM t1; +COUNT(*) +2 +SELECT MAX(f1) FROM t1; +MAX(f1) +1 + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +-------- switch to master ------- +ROLLBACK; +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: MASTER: The INSERT is not committed (Succeeded) + +-------- switch to slave -------- +SELECT MAX(f1) FROM t1; +MAX(f1) +0 + +TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) + +-------- switch to master ------- + +######## COMMIT ######## -------- switch to master ------- INSERT INTO t1 SET f1= 0 + 1; @@ -82,14 +170,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## ROLLBACK ######## +######## ROLLBACK ######## -------- switch to master ------- INSERT INTO t1 SET f1= 1 + 1; @@ -129,14 +211,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## SET AUTOCOMMIT=1 ######## +######## SET AUTOCOMMIT=1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 1 + 1; @@ -175,16 +251,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SET AUTOCOMMIT=0; -######## START TRANSACTION ######## +######## START TRANSACTION ######## -------- switch to master ------- INSERT INTO t1 SET f1= 2 + 1; @@ -224,14 +294,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## BEGIN ######## +######## BEGIN ######## -------- switch to master ------- INSERT INTO t1 SET f1= 3 + 1; @@ -271,14 +335,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## DROP TABLE mysqltest1.t2 ######## +######## DROP TABLE mysqltest1.t2 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 4 + 1; @@ -317,12 +375,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW TABLES LIKE 't2'; Tables_in_mysqltest1 (t2) @@ -333,7 +385,7 @@ Tables_in_mysqltest1 (t2) -------- switch to master ------- -######## DROP TEMPORARY TABLE mysqltest1.t23 ######## +######## DROP TEMPORARY TABLE mysqltest1.t23 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 5 + 1; @@ -372,12 +424,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW TABLES LIKE 't23'; Tables_in_mysqltest1 (t23) @@ -388,7 +434,7 @@ Tables_in_mysqltest1 (t23) -------- switch to master ------- -######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## +######## RENAME TABLE mysqltest1.t3 to mysqltest1.t20 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 5 + 1; @@ -427,12 +473,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW TABLES LIKE 't20'; Tables_in_mysqltest1 (t20) @@ -445,7 +485,7 @@ t20 -------- switch to master ------- -######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## +######## ALTER TABLE mysqltest1.t4 ADD column f2 BIGINT ######## -------- switch to master ------- INSERT INTO t1 SET f1= 6 + 1; @@ -484,12 +524,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- describe mysqltest1.t4; Field Type Null Key Default Extra @@ -504,7 +538,7 @@ f2 bigint(20) YES NULL -------- switch to master ------- -######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "NDB" ######## +######## CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB ######## -------- switch to master ------- INSERT INTO t1 SET f1= 7 + 1; @@ -518,7 +552,7 @@ MAX(f1) 7 -------- switch to master ------- -CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= "NDB"; +CREATE TABLE mysqltest1.t21 (f1 BIGINT) ENGINE= NDB; SELECT MAX(f1) FROM t1; MAX(f1) 8 @@ -544,14 +578,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ######## +######## CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY ######## -------- switch to master ------- INSERT INTO t1 SET f1= 8 + 1; @@ -565,7 +593,7 @@ MAX(f1) 8 -------- switch to master ------- -CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT); +CREATE TEMPORARY TABLE mysqltest1.t22 (f1 BIGINT) ENGINE=MEMORY; SELECT MAX(f1) FROM t1; MAX(f1) 9 @@ -591,14 +619,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## TRUNCATE TABLE mysqltest1.t7 ######## +######## TRUNCATE TABLE mysqltest1.t7 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 8 + 1; @@ -637,21 +659,17 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SELECT * FROM mysqltest1.t7; f1 + -------- switch to slave -------- SELECT * FROM mysqltest1.t7; f1 + -------- switch to master ------- -######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## +######## LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ ######## -------- switch to master ------- INSERT INTO t1 SET f1= 9 + 1; @@ -690,16 +708,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- UNLOCK TABLES; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -738,16 +750,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- LOCK TABLES mysqltest1.t1 READ; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -787,16 +793,10 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is not committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- LOCK TABLES mysqltest1.t1 WRITE, mysqltest1.t8 READ; -######## UNLOCK TABLES ######## +######## UNLOCK TABLES ######## -------- switch to master ------- INSERT INTO t1 SET f1= 10 + 1; @@ -836,14 +836,8 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; --------- switch to slave -------- -flush logs; - --------- switch to master ------- - -######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## +######## DROP INDEX my_idx6 ON mysqltest1.t6 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 11 + 1; @@ -882,12 +876,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW INDEX FROM mysqltest1.t6; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -898,7 +886,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par -------- switch to master ------- -######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## +######## CREATE INDEX my_idx5 ON mysqltest1.t5(f1) ######## -------- switch to master ------- INSERT INTO t1 SET f1= 12 + 1; @@ -937,12 +925,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW INDEX FROM mysqltest1.t5; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment @@ -955,7 +937,7 @@ t5 1 my_idx5 1 f1 A 0 NULL NULL YES BTREE -------- switch to master ------- -######## DROP DATABASE mysqltest2 ######## +######## DROP DATABASE mysqltest2 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 13 + 1; @@ -994,12 +976,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW DATABASES LIKE "mysqltest2"; Database (mysqltest2) @@ -1010,7 +986,7 @@ Database (mysqltest2) -------- switch to master ------- -######## CREATE DATABASE mysqltest3 ######## +######## CREATE DATABASE mysqltest3 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 14 + 1; @@ -1049,12 +1025,6 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) --------- switch to master ------- -flush logs; - --------- switch to slave -------- -flush logs; - -------- switch to master ------- SHOW DATABASES LIKE "mysqltest3"; Database (mysqltest3) @@ -1067,7 +1037,7 @@ mysqltest3 -------- switch to master ------- -######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## +######## CREATE PROCEDURE p1() READS SQL DATA SELECT "this is p1" ######## -------- switch to master ------- INSERT INTO t1 SET f1= 15 + 1; @@ -1107,33 +1077,30 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment -######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## +######## ALTER PROCEDURE p1 COMMENT "I have been altered" ######## -------- switch to master ------- INSERT INTO t1 SET f1= 16 + 1; @@ -1173,33 +1140,30 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; +Db mysqltest1 +Name p1 +Type PROCEDURE +Definer root@localhost +Modified # +Created # +Security_type DEFINER +Comment I have been altered -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment I have been altered - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -Db mysqltest1 -Name p1 -Type PROCEDURE -Definer root@localhost -Modified # -Created # -Security_type DEFINER -Comment I have been altered -######## DROP PROCEDURE p1 ######## +######## DROP PROCEDURE p1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 17 + 1; @@ -1239,17 +1203,14 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; -------- switch to slave -------- -flush logs; +SHOW PROCEDURE STATUS LIKE 'p1'; -------- switch to master ------- -SHOW PROCEDURE STATUS LIKE 'p1'; - -------- switch to slave ------- -SHOW PROCEDURE STATUS LIKE 'p1'; -######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## +######## CREATE OR REPLACE VIEW v1 as select * from t1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 18 + 1; @@ -1289,22 +1250,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to master ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` --------- switch to slave ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` - -######## ALTER VIEW v1 AS select f1 from t1 ######## +######## ALTER VIEW v1 AS select f1 from t1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 19 + 1; @@ -1344,22 +1301,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +View Create View +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` -------- switch to master ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` --------- switch to slave ------- -SHOW CREATE VIEW v1; -View Create View -v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`f1` AS `f1` from `t1` - -######## DROP VIEW IF EXISTS v1 ######## +######## DROP VIEW IF EXISTS v1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 20 + 1; @@ -1399,20 +1352,16 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist -------- switch to slave -------- -flush logs; +SHOW CREATE VIEW v1; +ERROR 42S02: Table 'mysqltest1.v1' doesn't exist -------- switch to master ------- -SHOW CREATE VIEW v1; -ERROR 42S02: Table 'mysqltest1.v1' doesn't exist --------- switch to slave ------- -SHOW CREATE VIEW v1; -ERROR 42S02: Table 'mysqltest1.v1' doesn't exist - -######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## +######## CREATE TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @a:=1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 21 + 1; @@ -1452,22 +1401,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to slave -------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer +trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost -------- switch to master ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost --------- switch to slave ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer -trg1 INSERT t1 SET @a:=1 BEFORE NULL root@localhost - -######## DROP TRIGGER trg1 ######## +######## DROP TRIGGER trg1 ######## -------- switch to master ------- INSERT INTO t1 SET f1= 22 + 1; @@ -1507,20 +1452,16 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer -------- switch to slave -------- -flush logs; +SHOW TRIGGERS; +Trigger Event Table Statement Timing Created sql_mode Definer -------- switch to master ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer --------- switch to slave ------- -SHOW TRIGGERS; -Trigger Event Table Statement Timing Created sql_mode Definer - -######## CREATE USER user1@localhost ######## +######## CREATE USER user1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 23 + 1; @@ -1560,22 +1501,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'user1'; +user +user1 -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'user1'; -user -user1 --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'user1'; -user -user1 - -######## RENAME USER user1@localhost TO rename1@localhost ######## +######## RENAME USER user1@localhost TO rename1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 24 + 1; @@ -1615,22 +1552,18 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +rename1 -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -rename1 --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -rename1 - -######## DROP USER rename1@localhost ######## +######## DROP USER rename1@localhost ######## -------- switch to master ------- INSERT INTO t1 SET f1= 25 + 1; @@ -1670,19 +1603,14 @@ MAX(f1) TEST-INFO: SLAVE: The INSERT is committed (Succeeded) -------- switch to master ------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user -------- switch to slave -------- -flush logs; +SELECT user FROM mysql.user WHERE user = 'rename1'; +user +use test; -------- switch to master ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user - --------- switch to slave ------- -SELECT user FROM mysql.user WHERE user = 'rename1'; -user -DROP DATABASE IF EXISTS mysqltest1; -DROP DATABASE IF EXISTS mysqltest2; -DROP DATABASE IF EXISTS mysqltest3; -ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest3; diff --git a/mysql-test/r/rpl_ndb_extraCol.result b/mysql-test/r/rpl_ndb_extraCol.result index bc40e24ecac..336a6152d36 100644 --- a/mysql-test/r/rpl_ndb_extraCol.result +++ b/mysql-test/r/rpl_ndb_extraCol.result @@ -28,9 +28,9 @@ a b c *** Select from slave *** SELECT * FROM t1 ORDER BY a; a b c d e -1 2 TEXAS 2 TEST -2 1 AUSTIN 2 TEST -3 4 QA 2 TEST +1 2 TEXAS NULL NULL +2 1 AUSTIN NULL NULL +3 4 QA NULL NULL *** Drop t1 *** DROP TABLE t1; *** Create t3 on slave *** @@ -289,9 +289,9 @@ a b c *** Select from slave *** SELECT * FROM t7 ORDER BY a; a b c d e -1 b1b1 Kyle 0000-00-00 00:00:00 Extra Column Testing -2 b1b1 JOE 0000-00-00 00:00:00 Extra Column Testing -3 b1b1 QA 0000-00-00 00:00:00 Extra Column Testing +1 b1b1 Kyle NULL NULL +2 b1b1 JOE NULL NULL +3 b1b1 QA NULL NULL *** Drop t7 *** DROP TABLE t7; *** Create t8 on slave *** @@ -447,9 +447,9 @@ a b c *** Select on Slave *** SELECT * FROM t12 ORDER BY a; a b f c e -1 b1b1b1b1b1b1b1b1 Kyle test 1 -2 b1b1b1b1b1b1b1b1 JOE test 1 -3 b1b1b1b1b1b1b1b1 QA test 1 +1 b1b1b1b1b1b1b1b1 Kyle NULL NULL +2 b1b1b1b1b1b1b1b1 JOE NULL NULL +3 b1b1b1b1b1b1b1b1 QA NULL NULL *** Drop t12 *** DROP TABLE t12; **** Extra Colums End **** @@ -479,9 +479,9 @@ a b c *** Select on Slave **** SELECT * FROM t13 ORDER BY a; a b c d e -1 b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP -2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP -3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP +1 b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP *** Drop t13 *** DROP TABLE t13; *** 22117 END *** @@ -515,9 +515,9 @@ c1 c2 c3 c4 c5 *** Select on Slave **** SELECT * FROM t14 ORDER BY c1; c1 c2 c3 c4 c5 c6 c7 -1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP -2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP -3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP *** connect to master and drop columns *** ALTER TABLE t14 DROP COLUMN c2; ALTER TABLE t14 DROP COLUMN c4; @@ -530,9 +530,9 @@ c1 c3 c5 *** Select from Slave *** SELECT * FROM t14 ORDER BY c1; c1 c3 c5 c6 c7 -1 Replication Testing Extra Col Kyle 1 CURRENT_TIMESTAMP -2 This Test Should work JOE 1 CURRENT_TIMESTAMP -3 If is does not, I will open a bug QA 1 CURRENT_TIMESTAMP +1 Replication Testing Extra Col Kyle NULL CURRENT_TIMESTAMP +2 This Test Should work JOE NULL CURRENT_TIMESTAMP +3 If is does not, I will open a bug QA NULL CURRENT_TIMESTAMP *** Drop t14 *** DROP TABLE t14; *** Create t15 on slave *** @@ -563,9 +563,9 @@ c1 c2 c3 c4 c5 *** Select on Slave **** SELECT * FROM t15 ORDER BY c1; c1 c2 c3 c4 c5 c6 c7 -1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP -2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP -3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP *** Add column on master that is a Extra on Slave *** ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5; ******************************************** @@ -618,9 +618,9 @@ c1 c2 c3 c4 c5 c6 *** Try to select from slave **** SELECT * FROM t15 ORDER BY c1; c1 c2 c3 c4 c5 c6 c7 -1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP -2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP -3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP 5 2.00 Replication Testing b1b1b1b1b1b1b1b1 Buda 2 CURRENT_TIMESTAMP *** DROP TABLE t15 *** DROP TABLE t15; @@ -652,9 +652,9 @@ c1 c2 c3 c4 c5 *** Select on Slave **** SELECT * FROM t16 ORDER BY c1; c1 c2 c3 c4 c5 c6 c7 -1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle 1 CURRENT_TIMESTAMP -2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP -3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP +1 1.00 Replication Testing Extra Col b1b1b1b1b1b1b1b1 Kyle NULL CURRENT_TIMESTAMP +2 2.00 This Test Should work b1b1b1b1b1b1b1b1 JOE NULL CURRENT_TIMESTAMP +3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA NULL CURRENT_TIMESTAMP *** Add Partition on master *** ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4; INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer'); diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result index c93af3441d8..8d443780039 100644 --- a/mysql-test/r/rpl_ndb_log.result +++ b/mysql-test/r/rpl_ndb_log.result @@ -32,16 +32,17 @@ master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # +master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT -show binlog events from 102 limit 1; +show binlog events from 106 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB -show binlog events from 102 limit 2; +show binlog events from 106 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN -show binlog events from 102 limit 2,1; +show binlog events from 106 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Table_map 1 # table_id: # (test.t1) flush logs; @@ -55,25 +56,25 @@ flush logs; stop slave; create table t2 (n int)ENGINE=NDB; insert into t2 values (1); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=NDB -master-bin.000001 # Query 1 # BEGIN -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # COMMIT -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=NDB +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Table_map # # table_id: # (mysql.ndb_apply_status) +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 # # COMMIT +master-bin.000001 # Rotate # # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 @@ -87,13 +88,13 @@ master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Query 1 # COMMIT show binary logs; Log_name File_size -master-bin.000001 1740 -master-bin.000002 612 +master-bin.000001 1775 +master-bin.000002 617 start slave; show binary logs; Log_name File_size -slave-bin.000001 1835 -slave-bin.000002 198 +slave-bin.000001 1870 +slave-bin.000002 202 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 @@ -110,6 +111,7 @@ slave-bin.000001 # Query 2 # BEGIN slave-bin.000001 # Table_map 2 # table_id: # (test.t1) slave-bin.000001 # Table_map 2 # table_id: # (mysql.ndb_apply_status) slave-bin.000001 # Write_rows 2 # table_id: # +slave-bin.000001 # Write_rows 2 # table_id: # slave-bin.000001 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000001 # Query 2 # COMMIT slave-bin.000001 # Query 1 # use `test`; create table t3 (a int)ENGINE=NDB @@ -126,7 +128,7 @@ slave-bin.000002 # Write_rows 2 # table_id: # flags: STMT_END_F slave-bin.000002 # Query 2 # COMMIT show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 612 # # master-bin.000002 Yes Yes # 0 0 612 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 617 # # master-bin.000002 Yes Yes # 0 0 617 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; @@ -137,11 +139,10 @@ insert into t1 values (NULL, 1); reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F select * from t1; a b 1 1 diff --git a/mysql-test/r/rpl_ndb_multi.result b/mysql-test/r/rpl_ndb_multi.result index 66819c2c9c8..760114f3639 100644 --- a/mysql-test/r/rpl_ndb_multi.result +++ b/mysql-test/r/rpl_ndb_multi.result @@ -26,11 +26,11 @@ stop slave; SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) -102 master-bin1.000001 +106 master-bin1.000001 CHANGE MASTER TO master_port=, master_log_file = 'master-bin1.000001', -master_log_pos = 102 ; +master_log_pos = 106 ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; diff --git a/mysql-test/r/rpl_rbr_to_sbr.result b/mysql-test/r/rpl_rbr_to_sbr.result index 4b2d129c732..2cb0eafa5b8 100644 --- a/mysql-test/r/rpl_rbr_to_sbr.result +++ b/mysql-test/r/rpl_rbr_to_sbr.result @@ -28,7 +28,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 450 +Read_Master_Log_Pos 454 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 450 +Exec_Master_Log_Pos 454 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result index 264f5d224bd..cea84dba1ef 100644 --- a/mysql-test/r/rpl_rotate_logs.result +++ b/mysql-test/r/rpl_rotate_logs.result @@ -16,7 +16,7 @@ create table t1 (s text); insert into t1 values('Could not break slave'),('Tried hard'); show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 552 # # master-bin.000001 Yes Yes # 0 0 552 # None 0 No # +# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 556 # # master-bin.000001 Yes Yes # 0 0 556 # None 0 No # select * from t1; s Could not break slave @@ -27,9 +27,9 @@ insert into t2 values (34),(67),(123); flush logs; show binary logs; Log_name File_size -master-bin.000001 596 -master-bin.000002 367 -master-bin.000003 102 +master-bin.000001 600 +master-bin.000002 371 +master-bin.000003 106 create table t3 select * from temp_table; select * from t3; a @@ -43,21 +43,21 @@ start slave; purge master logs to 'master-bin.000002'; show master logs; Log_name File_size -master-bin.000002 367 -master-bin.000003 411 +master-bin.000002 371 +master-bin.000003 415 purge binary logs to 'master-bin.000002'; show binary logs; Log_name File_size -master-bin.000002 367 -master-bin.000003 411 +master-bin.000002 371 +master-bin.000003 415 purge master logs before now(); show binary logs; Log_name File_size -master-bin.000003 411 +master-bin.000003 415 insert into t2 values (65); show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 500 # # master-bin.000003 Yes Yes # 0 0 500 # None 0 No # +# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 504 # # master-bin.000003 Yes Yes # 0 0 504 # None 0 No # select * from t2; m 34 @@ -74,18 +74,18 @@ count(*) create table t4 select * from temp_table; show binary logs; Log_name File_size -master-bin.000003 4189 -master-bin.000004 4194 -master-bin.000005 2036 +master-bin.000003 4193 +master-bin.000004 4198 +master-bin.000005 2040 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000005 2036 +master-bin.000005 2040 select * from t4; a testing temporary tables part 2 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2036 # # master-bin.000005 Yes Yes # 0 0 2036 # None 0 No # +# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2040 # # master-bin.000005 Yes Yes # 0 0 2040 # None 0 No # lock tables t3 read; select count(*) from t3 where n >= 4; count(*) diff --git a/mysql-test/r/rpl_row_basic_11bugs-master.opt b/mysql-test/r/rpl_row_basic_11bugs-master.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/r/rpl_row_basic_11bugs-master.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/r/rpl_row_basic_11bugs-slave.opt b/mysql-test/r/rpl_row_basic_11bugs-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/r/rpl_row_basic_11bugs-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/r/rpl_row_basic_11bugs.result b/mysql-test/r/rpl_row_basic_11bugs.result index 6f7bd6e3f85..1025b965589 100644 --- a/mysql-test/r/rpl_row_basic_11bugs.result +++ b/mysql-test/r/rpl_row_basic_11bugs.result @@ -24,11 +24,11 @@ SHOW TABLES; Tables_in_test_ignore t2 INSERT INTO t2 VALUES (3,3), (4,4); -SHOW BINLOG EVENTS FROM 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 102 Query 1 195 use `test`; CREATE TABLE t1 (a INT, b INT) -master-bin.000001 195 Table_map 1 235 table_id: # (test.t1) -master-bin.000001 235 Write_rows 1 282 table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b INT) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F **** On Slave **** SHOW DATABASES; Database @@ -54,10 +54,10 @@ DELETE FROM t1 WHERE a = 0; UPDATE t1 SET a=99 WHERE a = 0; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) -master-bin.000001 227 Write_rows 1 266 table_id: # flags: STMT_END_F +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 192 Table_map 1 231 table_id: # (test.t1) +master-bin.000001 231 Write_rows 1 270 table_id: # flags: STMT_END_F DROP TABLE t1; ================ Test for BUG#17620 ================ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; @@ -119,4 +119,102 @@ HEX(a) b SELECT HEX(a),b FROM t1; HEX(a) b 0 2 -DROP TABLE t1; +DROP TABLE IF EXISTS t1; +================ Test for BUG#22583 ================ +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +**** On Master **** +CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM; +CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB; +CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM; +CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB; +**** On Slave **** +ALTER TABLE t1_myisam ENGINE=INNODB; +ALTER TABLE t1_innodb ENGINE=MYISAM; +ALTER TABLE t2_myisam ENGINE=INNODB; +ALTER TABLE t2_innodb ENGINE=MYISAM; +**** On Master **** +INSERT INTO t1_myisam VALUES(1, b'0', 257); +INSERT INTO t1_myisam VALUES(2, b'1', 256); +INSERT INTO t1_innodb VALUES(1, b'0', 257); +INSERT INTO t1_innodb VALUES(2, b'1', 256); +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +k HEX(a) HEX(b) +1 0 101 +2 1 100 +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +k HEX(a) HEX(b) +1 0 101 +2 1 100 +INSERT INTO t2_myisam VALUES(1, b'0', 9); +INSERT INTO t2_myisam VALUES(2, b'1', 8); +INSERT INTO t2_innodb VALUES(1, b'0', 9); +INSERT INTO t2_innodb VALUES(2, b'1', 8); +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +k HEX(a) HEX(b) +1 0 9 +2 1 8 +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +k HEX(a) HEX(b) +1 0 9 +2 1 8 +**** On Slave **** +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +k HEX(a) HEX(b) +1 0 101 +2 1 100 +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +k HEX(a) HEX(b) +1 0 101 +2 1 100 +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +k HEX(a) HEX(b) +1 0 9 +2 1 8 +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +k HEX(a) HEX(b) +1 0 9 +2 1 8 +**** On Master **** +UPDATE t1_myisam SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +k HEX(a) HEX(b) +1 0 101 +2 0 100 +UPDATE t1_innodb SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +k HEX(a) HEX(b) +1 0 101 +2 0 100 +UPDATE t2_myisam SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +k HEX(a) HEX(b) +1 0 9 +2 0 8 +UPDATE t2_innodb SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +k HEX(a) HEX(b) +1 0 9 +2 0 8 +**** On Slave **** +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +k HEX(a) HEX(b) +1 0 101 +2 0 100 +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +k HEX(a) HEX(b) +1 0 101 +2 0 100 +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +k HEX(a) HEX(b) +1 0 9 +2 0 8 +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +k HEX(a) HEX(b) +1 0 9 +2 0 8 +**** On Master **** +DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb; diff --git a/mysql-test/r/rpl_row_charset.result b/mysql-test/r/rpl_row_charset.result index 79cf75c8cc1..e51f3e57d1f 100644 --- a/mysql-test/r/rpl_row_charset.result +++ b/mysql-test/r/rpl_row_charset.result @@ -109,39 +109,39 @@ a b 1 cp850_general_ci drop database mysqltest2; drop database mysqltest3; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest2 -master-bin.000001 # Query 1 # drop database if exists mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # drop database mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Table_map 1 # table_id: # (mysqltest2.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # drop database mysqltest2 -master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Query # # drop database if exists mysqltest3 +master-bin.000001 # Query # # create database mysqltest2 character set latin2 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # drop database mysqltest3 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Table_map # # table_id: # (mysqltest2.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # drop database mysqltest2 +master-bin.000001 # Query # # drop database mysqltest3 select "--- --global--" as ""; --- --global-- diff --git a/mysql-test/r/rpl_row_create_table.result b/mysql-test/r/rpl_row_create_table.result index 8f587fb5796..e76ce5b962d 100644 --- a/mysql-test/r/rpl_row_create_table.result +++ b/mysql-test/r/rpl_row_create_table.result @@ -8,30 +8,30 @@ CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; -SHOW BINLOG EVENTS FROM 212; +SHOW BINLOG EVENTS FROM 216; Log_name # -Pos 212 +Pos 216 Event_type Query Server_id # -End_log_pos # +End_log_pos 309 Info use `test`; CREATE TABLE t1 (a INT, b INT) Log_name # -Pos 305 +Pos 309 Event_type Query Server_id # -End_log_pos # +End_log_pos 415 Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge Log_name # -Pos 411 +Pos 415 Event_type Query Server_id # -End_log_pos # +End_log_pos 521 Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8 Log_name # -Pos 517 +Pos 521 Event_type Query Server_id # -End_log_pos # +End_log_pos 640 Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8 **** On Master **** SHOW CREATE TABLE t1; @@ -127,7 +127,7 @@ NULL 5 10 NULL 6 12 CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 1118; +SHOW BINLOG EVENTS FROM 1098; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -137,11 +137,11 @@ a b 1 2 2 4 3 6 -SHOW BINLOG EVENTS FROM 1118; +SHOW BINLOG EVENTS FROM 1098; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1118 Query 1 1218 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) -master-bin.000001 1218 Table_map 1 1258 table_id: # (test.t7) -master-bin.000001 1258 Write_rows 1 1314 table_id: # flags: STMT_END_F +# 1098 Query # 1198 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) +# 1198 Table_map # 1238 table_id: # (test.t7) +# 1238 Write_rows # 1294 table_id: # flags: STMT_END_F SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -154,10 +154,10 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -SHOW BINLOG EVENTS FROM 1314; +SHOW BINLOG EVENTS FROM 1294; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1314 Table_map 1 1354 table_id: # (test.t7) -master-bin.000001 1354 Write_rows 1 1410 table_id: # flags: STMT_END_F +# 1294 Table_map # 1334 table_id: # (test.t7) +# 1334 Write_rows # 1390 table_id: # flags: STMT_END_F SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -192,10 +192,10 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW BINLOG EVENTS FROM 1410; +SHOW BINLOG EVENTS FROM 1390; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 1410 Query 1 1496 use `test`; CREATE TABLE t8 LIKE t4 -master-bin.000001 1496 Query 1 1635 use `test`; CREATE TABLE `t9` ( +# 1390 Query # 1476 use `test`; CREATE TABLE t8 LIKE t4 +# 1476 Query # 1615 use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) @@ -274,33 +274,33 @@ a 3 SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # -master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) -master-bin.000001 227 Write_rows 1 271 table_id: # flags: STMT_END_F -master-bin.000001 271 Query 1 339 use `test`; BEGIN -master-bin.000001 339 Query 1 125 use `test`; CREATE TABLE `t2` ( +# 4 Format_desc # 106 Server ver: #, Binlog ver: # +# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) +# 192 Table_map # 231 table_id: # (test.t1) +# 231 Write_rows # 275 table_id: # flags: STMT_END_F +# 275 Query # 343 use `test`; BEGIN +# 343 Query # 125 use `test`; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -master-bin.000001 464 Table_map 1 164 table_id: # (test.t2) -master-bin.000001 503 Write_rows 1 208 table_id: # flags: STMT_END_F -master-bin.000001 547 Xid 1 574 COMMIT /* XID */ -master-bin.000001 574 Query 1 642 use `test`; BEGIN -master-bin.000001 642 Query 1 125 use `test`; CREATE TABLE `t3` ( +# 468 Table_map # 164 table_id: # (test.t2) +# 507 Write_rows # 208 table_id: # flags: STMT_END_F +# 551 Xid # 578 COMMIT /* XID */ +# 578 Query # 646 use `test`; BEGIN +# 646 Query # 125 use `test`; CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -master-bin.000001 767 Table_map 1 164 table_id: # (test.t3) -master-bin.000001 806 Write_rows 1 208 table_id: # flags: STMT_END_F -master-bin.000001 850 Xid 1 877 COMMIT /* XID */ -master-bin.000001 877 Query 1 945 use `test`; BEGIN -master-bin.000001 945 Query 1 125 use `test`; CREATE TABLE `t4` ( +# 771 Table_map # 164 table_id: # (test.t3) +# 810 Write_rows # 208 table_id: # flags: STMT_END_F +# 854 Xid # 881 COMMIT /* XID */ +# 881 Query # 949 use `test`; BEGIN +# 949 Query # 125 use `test`; CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -master-bin.000001 1070 Table_map 1 164 table_id: # (test.t4) -master-bin.000001 1109 Write_rows 1 208 table_id: # flags: STMT_END_F -master-bin.000001 1153 Xid 1 1180 COMMIT /* XID */ -master-bin.000001 1180 Table_map 1 1219 table_id: # (test.t1) -master-bin.000001 1219 Write_rows 1 1263 table_id: # flags: STMT_END_F +# 1074 Table_map # 164 table_id: # (test.t4) +# 1113 Write_rows # 208 table_id: # flags: STMT_END_F +# 1157 Xid # 1184 COMMIT /* XID */ +# 1184 Table_map # 1223 table_id: # (test.t1) +# 1223 Write_rows # 1267 table_id: # flags: STMT_END_F SHOW TABLES; Tables_in_test t1 @@ -365,17 +365,17 @@ a 9 SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: #, Binlog ver: # -master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 188 Table_map 1 227 table_id: # (test.t1) -master-bin.000001 227 Write_rows 1 271 table_id: # flags: STMT_END_F -master-bin.000001 271 Query 1 371 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB -master-bin.000001 371 Query 1 439 use `test`; BEGIN -master-bin.000001 439 Table_map 1 39 table_id: # (test.t2) -master-bin.000001 478 Write_rows 1 83 table_id: # flags: STMT_END_F -master-bin.000001 522 Table_map 1 122 table_id: # (test.t2) -master-bin.000001 561 Write_rows 1 161 table_id: # flags: STMT_END_F -master-bin.000001 600 Xid 1 627 COMMIT /* XID */ +# 4 Format_desc # 106 Server ver: #, Binlog ver: # +# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) +# 192 Table_map # 231 table_id: # (test.t1) +# 231 Write_rows # 275 table_id: # flags: STMT_END_F +# 275 Query # 375 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB +# 375 Query # 443 use `test`; BEGIN +# 443 Table_map # 39 table_id: # (test.t2) +# 482 Write_rows # 83 table_id: # flags: STMT_END_F +# 526 Table_map # 122 table_id: # (test.t2) +# 565 Write_rows # 161 table_id: # flags: STMT_END_F +# 604 Xid # 631 COMMIT /* XID */ SELECT * FROM t2 ORDER BY a; a 1 @@ -394,10 +394,10 @@ INSERT INTO t2 SELECT a+2 FROM tt2; ROLLBACK; SELECT * FROM t2 ORDER BY a; a -SHOW BINLOG EVENTS FROM 627; +SHOW BINLOG EVENTS FROM 631; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 627 Query 1 80 use `test`; TRUNCATE TABLE t2 -master-bin.000001 707 Xid 1 734 COMMIT /* XID */ +# 631 Query # 80 use `test`; TRUNCATE TABLE t2 +# 711 Xid # 738 COMMIT /* XID */ SELECT * FROM t2 ORDER BY a; a DROP TABLE t1,t2; diff --git a/mysql-test/r/rpl_row_delayed_ins.result b/mysql-test/r/rpl_row_delayed_ins.result index 21b251db193..800a39bd567 100644 --- a/mysql-test/r/rpl_row_delayed_ins.result +++ b/mysql-test/r/rpl_row_delayed_ins.result @@ -14,17 +14,16 @@ a 1 2 3 -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 222 use `test`; create table t1(a int not null primary key) engine=myisam -master-bin.000001 222 Table_map 1 261 table_id: # (test.t1) -master-bin.000001 261 Write_rows 1 295 table_id: # flags: STMT_END_F -master-bin.000001 295 Table_map 1 334 table_id: # (test.t1) -master-bin.000001 334 Write_rows 1 368 table_id: # flags: STMT_END_F -master-bin.000001 368 Table_map 1 407 table_id: # (test.t1) -master-bin.000001 407 Write_rows 1 441 table_id: # flags: STMT_END_F -master-bin.000001 441 Query 1 516 use `test`; flush tables +master-bin.000001 # Query # # use `test`; create table t1(a int not null primary key) engine=myisam +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.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +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`; flush tables SELECT * FROM t1 ORDER BY a; a 1 diff --git a/mysql-test/r/rpl_row_drop.result b/mysql-test/r/rpl_row_drop.result index 4ef21884fda..89654ebf165 100644 --- a/mysql-test/r/rpl_row_drop.result +++ b/mysql-test/r/rpl_row_drop.result @@ -43,10 +43,10 @@ t2 DROP TABLE t1,t2; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 188 use `test`; CREATE TABLE t1 (a int) -master-bin.000001 188 Query 1 274 use `test`; CREATE TABLE t2 (a int) -master-bin.000001 274 Query 1 378 use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int) +master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int) +master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/r/rpl_row_flsh_tbls.result b/mysql-test/r/rpl_row_flsh_tbls.result index e2352b8605b..942a6b83bf6 100644 --- a/mysql-test/r/rpl_row_flsh_tbls.result +++ b/mysql-test/r/rpl_row_flsh_tbls.result @@ -12,13 +12,13 @@ create table t4 (a int); insert into t4 select * from t3; rename table t1 to t5, t2 to t1; flush no_write_to_binlog tables; -SHOW BINLOG EVENTS FROM 615 ; +SHOW BINLOG EVENTS FROM 619 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 select * from t3; a flush tables; -SHOW BINLOG EVENTS FROM 615 ; +SHOW BINLOG EVENTS FROM 619 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 master-bin.000001 # Query 1 # use `test`; flush tables diff --git a/mysql-test/r/rpl_row_inexist_tbl.result b/mysql-test/r/rpl_row_inexist_tbl.result index 5f5a4556d76..7d0d7504ee7 100644 --- a/mysql-test/r/rpl_row_inexist_tbl.result +++ b/mysql-test/r/rpl_row_inexist_tbl.result @@ -39,7 +39,7 @@ Replicate_Wild_Ignore_Table Last_Errno 1146 Last_Error Error 'Table 'test.t1' doesn't exist' on opening table `test`.`t1` Skip_Counter 0 -Exec_Master_Log_Pos 519 +Exec_Master_Log_Pos 524 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result index c6b85e7b329..5d252d72bd1 100644 --- a/mysql-test/r/rpl_row_log.result +++ b/mysql-test/r/rpl_row_log.result @@ -26,14 +26,14 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -show binlog events from 102 limit 1; +show binlog events from 106 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -show binlog events from 102 limit 2; +show binlog events from 106 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Table_map 1 # table_id: # (test.t1) -show binlog events from 102 limit 2,1; +show binlog events from 106 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F flush logs; @@ -47,17 +47,16 @@ flush logs; stop slave; create table t2 (n int)ENGINE=MyISAM; insert into t2 values (1); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM +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`; drop table t1 +master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Rotate # # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 @@ -67,13 +66,13 @@ master-bin.000002 # Table_map 1 # table_id: # (test.t2) master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F show binary logs; Log_name File_size -master-bin.000001 1256 -master-bin.000002 373 +master-bin.000001 1260 +master-bin.000002 377 start slave; show binary logs; Log_name File_size -slave-bin.000001 1354 -slave-bin.000002 274 +slave-bin.000001 1358 +slave-bin.000002 278 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 @@ -94,7 +93,7 @@ slave-bin.000002 # Table_map 1 # table_id: # (test.t2) slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 373 # # master-bin.000002 Yes Yes # 0 0 373 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 377 # # master-bin.000002 Yes Yes # 0 0 377 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; @@ -105,11 +104,10 @@ insert into t1 values (NULL, 1); reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F select * from t1; a b 1 1 diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result index bc13047f973..ff1fabb35cb 100644 --- a/mysql-test/r/rpl_row_log_innodb.result +++ b/mysql-test/r/rpl_row_log_innodb.result @@ -28,14 +28,14 @@ master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not nul master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ -show binlog events from 102 limit 1; +show binlog events from 106 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -show binlog events from 102 limit 2; +show binlog events from 106 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB master-bin.000001 # Table_map 1 # table_id: # (test.t1) -show binlog events from 102 limit 2,1; +show binlog events from 106 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F flush logs; @@ -49,19 +49,18 @@ flush logs; stop slave; create table t2 (n int)ENGINE=InnoDB; insert into t2 values (1); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* XID */ -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Xid 1 # COMMIT /* XID */ -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB +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 */ +master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=InnoDB +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 */ +master-bin.000001 # Rotate # # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 @@ -72,13 +71,13 @@ master-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000002 # Xid 1 # COMMIT /* XID */ show binary logs; Log_name File_size -master-bin.000001 1310 -master-bin.000002 400 +master-bin.000001 1314 +master-bin.000002 404 start slave; show binary logs; Log_name File_size -slave-bin.000001 1408 -slave-bin.000002 301 +slave-bin.000001 1412 +slave-bin.000002 305 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 @@ -102,7 +101,7 @@ slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F slave-bin.000002 # Xid 1 # COMMIT /* XID */ show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 400 # # master-bin.000002 Yes Yes # 0 0 400 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 404 # # master-bin.000002 Yes Yes # 0 0 404 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; @@ -113,11 +112,10 @@ insert into t1 values (NULL, 1); reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Table_map 1 # table_id: # (test.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F select * from t1; a b 1 1 diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result index 8bb10ffb080..4c0f923c323 100644 --- a/mysql-test/r/rpl_row_max_relay_size.result +++ b/mysql-test/r/rpl_row_max_relay_size.result @@ -30,7 +30,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 58664 +Read_Master_Log_Pos 58668 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -45,7 +45,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 58664 +Exec_Master_Log_Pos 58668 Relay_Log_Space # Until_Condition None Until_Log_File @@ -73,7 +73,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 58664 +Read_Master_Log_Pos 58668 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -88,7 +88,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 58664 +Exec_Master_Log_Pos 58668 Relay_Log_Space # Until_Condition None Until_Log_File @@ -116,7 +116,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 58664 +Read_Master_Log_Pos 58668 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -131,7 +131,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 58664 +Exec_Master_Log_Pos 58668 Relay_Log_Space # Until_Condition None Until_Log_File @@ -197,7 +197,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 58750 +Read_Master_Log_Pos 58754 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -212,7 +212,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 58750 +Exec_Master_Log_Pos 58754 Relay_Log_Space # Until_Condition None Until_Log_File @@ -236,7 +236,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 58826 +Read_Master_Log_Pos 58830 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -251,7 +251,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 58826 +Exec_Master_Log_Pos 58830 Relay_Log_Space # Until_Condition None Until_Log_File @@ -266,7 +266,7 @@ Seconds_Behind_Master # flush logs; show master status; File master-bin.000002 -Position 102 +Position 106 Binlog_Do_DB Binlog_Ignore_DB set global max_binlog_size= @my_max_binlog_size; diff --git a/mysql-test/r/rpl_row_reset_slave.result b/mysql-test/r/rpl_row_reset_slave.result index 57fc95708e5..657dad30266 100644 --- a/mysql-test/r/rpl_row_reset_slave.result +++ b/mysql-test/r/rpl_row_reset_slave.result @@ -6,12 +6,12 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # stop slave; change master to master_user='test'; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 No No # 0 0 102 # None 0 No # +# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # reset slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master @@ -19,7 +19,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # stop slave; reset slave; start slave; diff --git a/mysql-test/r/rpl_row_tabledefs_2myisam.result b/mysql-test/r/rpl_row_tabledefs_2myisam.result index d62650fa142..10001c736ac 100644 --- a/mysql-test/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/r/rpl_row_tabledefs_2myisam.result @@ -122,7 +122,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1364 +Last_Errno 1105 Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef Skip_Counter 0 Exec_Master_Log_Pos # diff --git a/mysql-test/r/rpl_row_tabledefs_3innodb.result b/mysql-test/r/rpl_row_tabledefs_3innodb.result index 0c3bb734e95..6bb98afd4c4 100644 --- a/mysql-test/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/r/rpl_row_tabledefs_3innodb.result @@ -122,7 +122,7 @@ Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table -Last_Errno 1364 +Last_Errno 1105 Last_Error Error in Write_rows event: error during transaction execution on table test.t1_nodef Skip_Counter 0 Exec_Master_Log_Pos # diff --git a/mysql-test/r/rpl_row_until.result b/mysql-test/r/rpl_row_until.result index 8d4b0d6b591..cffcf12a31b 100644 --- a/mysql-test/r/rpl_row_until.result +++ b/mysql-test/r/rpl_row_until.result @@ -21,7 +21,7 @@ n 4 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 311 # Master master-bin.000001 311 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-bin.000001 311 No # start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; select * from t1; n @@ -31,7 +31,7 @@ n 4 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 311 # Master master-no-such-bin.000001 291 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-no-such-bin.000001 291 No # start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728; select * from t2; n @@ -39,13 +39,13 @@ n 2 show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 # No 0 0 586 # Relay slave-relay-bin.000004 728 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 590 # Relay slave-relay-bin.000004 728 No # start slave; stop slave; start slave until master_log_file='master-bin.000001', master_log_pos=740; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 740 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 740 # Master master-bin.000001 740 No # +# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 744 # Master master-bin.000001 740 No # start slave until master_log_file='master-bin', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12; diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result index c94a7748fcd..3f0c1a79de3 100644 --- a/mysql-test/r/rpl_server_id1.result +++ b/mysql-test/r/rpl_server_id1.result @@ -10,7 +10,7 @@ stop slave; change master to master_port=SLAVE_PORT; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master - 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 102 None 0 No NULL + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL start slave; insert into t1 values (1); show status like "slave_running"; diff --git a/mysql-test/r/rpl_server_id2.result b/mysql-test/r/rpl_server_id2.result index 72db862040e..60550aba98e 100644 --- a/mysql-test/r/rpl_server_id2.result +++ b/mysql-test/r/rpl_server_id2.result @@ -10,7 +10,7 @@ stop slave; change master to master_port=SLAVE_PORT; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master - 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 102 None 0 No NULL + 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL start slave; insert into t1 values (1); select * from t1; diff --git a/mysql-test/r/rpl_sp.result b/mysql-test/r/rpl_sp.result index ea07a86d009..6dc3be94e32 100644 --- a/mysql-test/r/rpl_sp.result +++ b/mysql-test/r/rpl_sp.result @@ -381,7 +381,7 @@ return 0; end| use mysqltest; set @a:= mysqltest2.f1(); -show binlog events in 'master-bin.000001' from 102; +show binlog events in 'master-bin.000001' from 106; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # drop database if exists mysqltest1 master-bin.000001 # Query 1 # create database mysqltest1 diff --git a/mysql-test/r/rpl_stm_charset.result b/mysql-test/r/rpl_stm_charset.result index f1691608bc7..fd9c40843d5 100644 --- a/mysql-test/r/rpl_stm_charset.result +++ b/mysql-test/r/rpl_stm_charset.result @@ -103,40 +103,40 @@ a b 1 cp850_general_ci drop database mysqltest2; drop database mysqltest3; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest2 -master-bin.000001 # Query 1 # drop database if exists mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest2 character set latin2 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # drop database mysqltest3 -master-bin.000001 # Query 1 # create database mysqltest3 -master-bin.000001 # Query 1 # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) -master-bin.000001 # Intvar 1 # INSERT_ID=1 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_server) -master-bin.000001 # Intvar 1 # INSERT_ID=2 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_server) -master-bin.000001 # Intvar 1 # INSERT_ID=3 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_client) -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection) -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Intvar 1 # INSERT_ID=1 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 # Intvar 1 # INSERT_ID=2 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) -master-bin.000001 # Intvar 1 # INSERT_ID=3 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) -master-bin.000001 # Query 1 # use `mysqltest2`; truncate table t1 -master-bin.000001 # Intvar 1 # INSERT_ID=1 -master-bin.000001 # User var 1 # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t1 (b) values(collation(@a)) -master-bin.000001 # Query 1 # drop database mysqltest2 -master-bin.000001 # Query 1 # drop database mysqltest3 +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Query # # drop database if exists mysqltest3 +master-bin.000001 # Query # # create database mysqltest2 character set latin2 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # drop database mysqltest3 +master-bin.000001 # Query # # create database mysqltest3 +master-bin.000001 # Query # # use `mysqltest2`; create table t1 (a int auto_increment primary key, b varchar(100)) +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_server) +master-bin.000001 # Intvar # # INSERT_ID=2 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_server) +master-bin.000001 # Intvar # # INSERT_ID=3 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_client) +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@character_set_connection) +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 # Intvar # # INSERT_ID=2 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) +master-bin.000001 # Intvar # # INSERT_ID=3 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(@@collation_connection) +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(LEAST("Müller","Muffler")) +master-bin.000001 # Query # # use `mysqltest2`; truncate table t1 +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # User var # # @`a`=_cp850 0x4DFC6C6C6572 COLLATE cp850_general_ci +master-bin.000001 # Query # # use `mysqltest2`; insert into t1 (b) values(collation(@a)) +master-bin.000001 # Query # # drop database mysqltest2 +master-bin.000001 # Query # # drop database mysqltest3 set global character_set_server=latin2; set global character_set_server=latin1; set global character_set_server=latin2; diff --git a/mysql-test/r/rpl_stm_flsh_tbls.result b/mysql-test/r/rpl_stm_flsh_tbls.result index a6123d75cb3..1c6b5615b6e 100644 --- a/mysql-test/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/r/rpl_stm_flsh_tbls.result @@ -12,13 +12,13 @@ create table t4 (a int); insert into t4 select * from t3; rename table t1 to t5, t2 to t1; flush no_write_to_binlog tables; -SHOW BINLOG EVENTS FROM 652 ; +SHOW BINLOG EVENTS FROM 656 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 select * from t3; a flush tables; -SHOW BINLOG EVENTS FROM 652 ; +SHOW BINLOG EVENTS FROM 656 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 master-bin.000001 # Query 1 # use `test`; flush tables diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result index 496685981aa..f69ad8a57c1 100644 --- a/mysql-test/r/rpl_stm_log.result +++ b/mysql-test/r/rpl_stm_log.result @@ -26,14 +26,14 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 -show binlog events from 102 limit 1; +show binlog events from 106 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -show binlog events from 102 limit 2; +show binlog events from 106 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Intvar 1 # INSERT_ID=1 -show binlog events from 102 limit 2,1; +show binlog events from 106 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) flush logs; @@ -47,17 +47,16 @@ flush logs; stop slave; create table t2 (n int)ENGINE=MyISAM; insert into t2 values (1); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -master-bin.000001 # Intvar 1 # INSERT_ID=1 -master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM -master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 -master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 -master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 +master-bin.000001 # Query # # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM +master-bin.000001 # Intvar # # INSERT_ID=1 +master-bin.000001 # Query # # use `test`; insert into t1 values (NULL) +master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM +master-bin.000001 # Begin_load_query # # ;file_id=1;block_len=581 +master-bin.000001 # Execute_load_query # # use `test`; load data infile '../std_data_ln/words.dat' into table t1 ignore 1 lines ;file_id=1 +master-bin.000001 # Rotate # # master-bin.000002;pos=4 show binlog events in 'master-bin.000002'; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 @@ -66,13 +65,13 @@ master-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM master-bin.000002 # Query 1 # use `test`; insert into t2 values (1) show binary logs; Log_name File_size -master-bin.000001 1343 -master-bin.000002 388 +master-bin.000001 1347 +master-bin.000002 392 start slave; show binary logs; Log_name File_size -slave-bin.000001 1443 -slave-bin.000002 289 +slave-bin.000001 1447 +slave-bin.000002 293 show binlog events in 'slave-bin.000001' from 4; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 @@ -92,7 +91,7 @@ slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1) show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 388 # # master-bin.000002 Yes Yes # 0 0 388 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 392 # # master-bin.000002 Yes Yes # 0 0 392 # None 0 No # show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; @@ -103,12 +102,11 @@ insert into t1 values (NULL, 1); reset master; set insert_id=5; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()); -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Format_desc 1 # Server ver: VERSION, Binlog ver: 4 -master-bin.000001 # Intvar 1 # LAST_INSERT_ID=1 -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()) +master-bin.000001 # Intvar # # LAST_INSERT_ID=1 +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `test`; insert into t1 values (NULL, last_insert_id()), (NULL, last_insert_id()) select * from t1; a b 1 1 diff --git a/mysql-test/r/rpl_stm_max_relay_size.result b/mysql-test/r/rpl_stm_max_relay_size.result index c4a9a5bd3ff..2509cc08205 100644 --- a/mysql-test/r/rpl_stm_max_relay_size.result +++ b/mysql-test/r/rpl_stm_max_relay_size.result @@ -28,7 +28,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 72956 +Read_Master_Log_Pos 72960 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -43,7 +43,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 72956 +Exec_Master_Log_Pos 72960 Relay_Log_Space # Until_Condition None Until_Log_File @@ -71,7 +71,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 72956 +Read_Master_Log_Pos 72960 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -86,7 +86,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 72956 +Exec_Master_Log_Pos 72960 Relay_Log_Space # Until_Condition None Until_Log_File @@ -114,7 +114,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 72956 +Read_Master_Log_Pos 72960 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -129,7 +129,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 72956 +Exec_Master_Log_Pos 72960 Relay_Log_Space # Until_Condition None Until_Log_File @@ -195,7 +195,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 73042 +Read_Master_Log_Pos 73046 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -210,7 +210,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 73042 +Exec_Master_Log_Pos 73046 Relay_Log_Space # Until_Condition None Until_Log_File @@ -234,7 +234,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 73118 +Read_Master_Log_Pos 73122 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -249,7 +249,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 73118 +Exec_Master_Log_Pos 73122 Relay_Log_Space # Until_Condition None Until_Log_File @@ -264,7 +264,7 @@ Seconds_Behind_Master # flush logs; show master status; File master-bin.000002 -Position 102 +Position 106 Binlog_Do_DB Binlog_Ignore_DB set global max_binlog_size= @my_max_binlog_size; diff --git a/mysql-test/r/rpl_stm_multi_query.result b/mysql-test/r/rpl_stm_multi_query.result index bf914e6ce6c..625c686f383 100644 --- a/mysql-test/r/rpl_stm_multi_query.result +++ b/mysql-test/r/rpl_stm_multi_query.result @@ -19,14 +19,14 @@ n 3 4 5 -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest -master-bin.000001 # Query 1 # create database mysqltest -master-bin.000001 # Query 1 # use `test`; create table mysqltest.t1 ( n int) -master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(1) -master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(2) -master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(3) -master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(4) -master-bin.000001 # Query 1 # use `test`; insert into mysqltest.t1 values(5) +master-bin.000001 # Query # # drop database if exists mysqltest +master-bin.000001 # Query # # create database mysqltest +master-bin.000001 # Query # # use `test`; create table mysqltest.t1 ( n int) +master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(1) +master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(2) +master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(3) +master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(4) +master-bin.000001 # Query # # use `test`; insert into mysqltest.t1 values(5) drop database mysqltest; diff --git a/mysql-test/r/rpl_stm_reset_slave.result b/mysql-test/r/rpl_stm_reset_slave.result index 834b9add089..2b9fdca0911 100644 --- a/mysql-test/r/rpl_stm_reset_slave.result +++ b/mysql-test/r/rpl_stm_reset_slave.result @@ -6,12 +6,12 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # stop slave; change master to master_user='test'; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 No No # 0 0 102 # None 0 No # +# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # reset slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master @@ -19,7 +19,7 @@ Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File start slave; show slave status; Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 102 # # master-bin.000001 Yes Yes # 0 0 102 # None 0 No # +# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # stop slave; reset slave; start slave; diff --git a/mysql-test/r/rpl_stm_until.result b/mysql-test/r/rpl_stm_until.result index e8e33b66864..63544199f4c 100644 --- a/mysql-test/r/rpl_stm_until.result +++ b/mysql-test/r/rpl_stm_until.result @@ -26,7 +26,7 @@ Master_User root Master_Port MASTER_MYPORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 780 +Read_Master_Log_Pos 784 Relay_Log_File slave-relay-bin.000004 Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -41,7 +41,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 323 +Exec_Master_Log_Pos 327 Relay_Log_Space # Until_Condition Master Until_Log_File master-bin.000001 @@ -67,7 +67,7 @@ Master_User root Master_Port MASTER_MYPORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 780 +Read_Master_Log_Pos 784 Relay_Log_File slave-relay-bin.000004 Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -82,7 +82,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 323 +Exec_Master_Log_Pos 327 Relay_Log_Space # Until_Condition Master Until_Log_File master-no-such-bin.000001 @@ -106,7 +106,7 @@ Master_User root Master_Port MASTER_MYPORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 780 +Read_Master_Log_Pos 784 Relay_Log_File slave-relay-bin.000004 Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -121,7 +121,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 612 +Exec_Master_Log_Pos 616 Relay_Log_Space # Until_Condition Relay Until_Log_File slave-relay-bin.000004 @@ -143,7 +143,7 @@ Master_User root Master_Port MASTER_MYPORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 780 +Read_Master_Log_Pos 784 Relay_Log_File slave-relay-bin.000004 Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -158,7 +158,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 780 +Exec_Master_Log_Pos 784 Relay_Log_Space # Until_Condition Master Until_Log_File master-bin.000001 diff --git a/mysql-test/r/rpl_switch_stm_row_mixed.result b/mysql-test/r/rpl_switch_stm_row_mixed.result index fe0d986eba6..6d9f1a32980 100644 --- a/mysql-test/r/rpl_switch_stm_row_mixed.result +++ b/mysql-test/r/rpl_switch_stm_row_mixed.result @@ -405,84 +405,84 @@ CREATE TABLE t12 (data LONG); LOCK TABLES t12 WRITE; INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest1 -master-bin.000001 # Query 1 # create database mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_8_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_9_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_10_") -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_11_" -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_13_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_14_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_15_") -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_16_" -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_18_") -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_21_" -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_24_" -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` ( +master-bin.000001 # Query # # drop database if exists mysqltest1 +master-bin.000001 # Query # # create database mysqltest1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_") +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_" +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_") +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_" +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_") +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_" +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_" +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` ( `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` ( `1` varbinary(36) NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t4` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t4` ( `a` varchar(100) DEFAULT NULL ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t4) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t5) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t5) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() begin insert into t1 values("work_25_"); insert into t1 values(concat("for_26_",UUID())); insert into t1 select "yesterday_27_"; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() begin insert into t1 values(concat("emergency_28_",UUID())); insert into t1 values("work_29_"); @@ -491,308 +491,308 @@ set session binlog_format=row; # accepted for stored procs insert into t1 values("more work_31_"); set session binlog_format=mixed; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned begin set session binlog_format=row; # rejected for stored funcs insert into t1 values("alarm"); return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100)) begin insert into t1 values(concat("work_250_",x)); insert into t1 select "yesterday_270_"; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello'))) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_" -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world'))) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_" -master-bin.000001 # Query 1 # use `mysqltest1`; drop function foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello'))) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_" +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world'))) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_" +master-bin.000001 # Query # # use `mysqltest1`; drop function foo3 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned begin insert into t1 values("foo3_32_"); call foo(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned begin insert into t2 select foo3(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned begin insert into t2 select UUID(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned begin insert into t2 select x; return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid() -master-bin.000001 # Query 1 # use `mysqltest1`; create table t11 (data varchar(255)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid() +master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row begin set NEW.data = concat(NEW.data,UUID()); end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t20 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t21 select * from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t22 select * from t3 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1,t2,t3 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t3 (b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2 +master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic begin insert into t1 values(null,x); insert into t2 values(null,x); return 1; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Intvar 1 # INSERT_ID=3 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_44_") -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') -master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f -master-bin.000001 # Query 1 # use `mysqltest1`; create table t14 (unique (a)) select * from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; truncate table t2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Intvar # # INSERT_ID=3 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_") +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') +master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; drop function f +master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2 +master-bin.000001 # Query # # use `mysqltest1`; truncate table t2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic begin insert into t1 values(null,x); return 1; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic begin insert into t2 values(null,x); return 1; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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: # (mysqltest1.t3) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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 # # use `mysqltest1`; drop function f2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic begin declare y int; insert into t1 values(null,x); set y = (select count(*) from t2); return y; end -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') +master-bin.000001 # Query # # use `mysqltest1`; drop function f2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row begin insert into t2 values(null,"try_55_"); end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t1 modify a int, drop primary key -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_57_") -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t16` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_") +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t16` ( `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_") -master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene') -master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -show binlog events from 102; +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_") +master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene') +master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest1 -master-bin.000001 # Query 1 # create database mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_8_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_9_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_10_") -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_11_" -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_13_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_14_") -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("for_15_") -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_16_" -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values("work_18_") -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_21_" -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # User var 1 # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select @'string' -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_24_" -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` ( +master-bin.000001 # Query # # drop database if exists mysqltest1 +master-bin.000001 # Query # # create database mysqltest1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t1 (a varchar(100)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_8_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_9_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_10_") +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_11_" +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_13_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_14_") +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31325F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("for_15_") +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_16_" +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values("work_18_") +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_21_" +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # User var # # @`string`=_latin1 0x656D657267656E63795F31375F COLLATE latin1_swedish_ci +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select @'string' +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_24_" +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t2` ( `rpad(UUID(),100,' ')` varchar(100) CHARACTER SET utf8 NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t3` ( `1` varbinary(36) NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t4` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t3) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t4` ( `a` varchar(100) DEFAULT NULL ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t4) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t5) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t4) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t5) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo() begin insert into t1 values("work_25_"); insert into t1 values(concat("for_26_",UUID())); insert into t1 select "yesterday_27_"; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo2() begin insert into t1 values(concat("emergency_28_",UUID())); insert into t1 values("work_29_"); @@ -801,229 +801,229 @@ set session binlog_format=row; # accepted for stored procs insert into t1 values("more work_31_"); set session binlog_format=mixed; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned begin set session binlog_format=row; # rejected for stored funcs insert into t1 values("alarm"); return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` procedure foo4(x varchar(100)) begin insert into t1 values(concat("work_250_",x)); insert into t1 select "yesterday_270_"; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello'))) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_" -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world'))) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 select "yesterday_270_" -master-bin.000001 # Query 1 # use `mysqltest1`; drop function foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'hello'))) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_" +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(concat("work_250_", NAME_CONST('x',_latin1'world'))) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 select "yesterday_270_" +master-bin.000001 # Query # # use `mysqltest1`; drop function foo3 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo3() returns bigint unsigned begin insert into t1 values("foo3_32_"); call foo(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo4() returns bigint unsigned begin insert into t2 select foo3(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo5() returns bigint unsigned begin insert into t2 select UUID(); return 100; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function foo6(x varchar(100)) returns bigint unsigned begin insert into t2 select x; return 100; end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid() -master-bin.000001 # Query 1 # use `mysqltest1`; create table t11 (data varchar(255)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`foo6`(_latin1'foo6_1_') +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select uuid() +master-bin.000001 # Query # # use `mysqltest1`; create table t11 (data varchar(255)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; insert into t11 select TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA='mysqltest1' and TABLE_NAME IN ('v1','t11') +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t11_bi before insert on t11 for each row begin set NEW.data = concat(NEW.data,UUID()); end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t20 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t21 select * from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t22 select * from t3 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1,t2,t3 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t3 (b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t20 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t21 select * from t2 +master-bin.000001 # Query # # use `mysqltest1`; create table t22 select * from t3 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1,t2,t3 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; create table t2 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; create table t3 (b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f (x varchar(100)) returns int deterministic begin insert into t1 values(null,x); insert into t2 values(null,x); return 1; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Intvar 1 # INSERT_ID=3 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_44_") -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; create table t12 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') -master-bin.000001 # Query 1 # use `mysqltest1`; create table t13 select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f -master-bin.000001 # Query 1 # use `mysqltest1`; create table t14 (unique (a)) select * from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; truncate table t2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +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: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Intvar # # INSERT_ID=3 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_44_") +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; create table t12 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int, b varchar(100), key(a)) +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f`(_latin1'try_45_') +master-bin.000001 # Query # # use `mysqltest1`; create table t13 select * from t1 +master-bin.000001 # Query # # use `mysqltest1`; drop table t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int primary key auto_increment, b varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; drop function f +master-bin.000001 # Query # # use `mysqltest1`; create table t14 (unique (a)) select * from t2 +master-bin.000001 # Query # # use `mysqltest1`; truncate table t2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f1 (x varchar(100)) returns int deterministic begin insert into t1 values(null,x); return 1; end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic begin insert into t2 values(null,x); return 1; end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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: # (mysqltest1.t3) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +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 # # use `mysqltest1`; drop function f2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` function f2 (x varchar(100)) returns int deterministic begin declare y int; insert into t1 values(null,x); set y = (select count(*) from t2); return y; end -master-bin.000001 # Intvar 1 # INSERT_ID=4 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') -master-bin.000001 # Query 1 # use `mysqltest1`; drop function f2 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row +master-bin.000001 # Intvar # # INSERT_ID=4 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f1`(_latin1'try_53_') +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`f2`(_latin1'try_54_') +master-bin.000001 # Query # # use `mysqltest1`; drop function f2 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger t1_bi before insert on t1 for each row begin insert into t2 values(null,"try_55_"); end -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t1) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2) -master-bin.000001 # Write_rows 1 # table_id: # -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t1 modify a int, drop primary key -master-bin.000001 # Intvar 1 # INSERT_ID=5 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(null,"try_57_") -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t16` ( +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t1) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t2) +master-bin.000001 # Write_rows # # table_id: # +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; alter table t1 modify a int, drop primary key +master-bin.000001 # Intvar # # INSERT_ID=5 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(null,"try_57_") +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE `t16` ( `UUID()` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT '' ) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t16) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t16 values("try_66_") -master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t11 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255)) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t11) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F -master-bin.000001 # Query 1 # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene') -master-bin.000001 # Query 1 # use `mysqltest1`; DROP TABLE IF EXISTS t12 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE t12 (data LONG) -master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t12) -master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t16) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; insert into t16 values("try_66_") +master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t11 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t11 (song VARCHAR(255)) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t11) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `mysqltest1`; INSERT INTO t11 VALUES('Careful With That Axe, Eugene') +master-bin.000001 # Query # # use `mysqltest1`; DROP TABLE IF EXISTS t12 +master-bin.000001 # Query # # use `mysqltest1`; CREATE TABLE t12 (data LONG) +master-bin.000001 # Table_map # # table_id: # (mysqltest1.t12) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F drop database mysqltest1; set global binlog_format =@my_binlog_format; diff --git a/mysql-test/r/rpl_truncate_2myisam.result b/mysql-test/r/rpl_truncate_2myisam.result index 41640a709b9..c7ef28ba56b 100644 --- a/mysql-test/r/rpl_truncate_2myisam.result +++ b/mysql-test/r/rpl_truncate_2myisam.result @@ -29,13 +29,12 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1 -master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -61,13 +60,12 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Query 1 387 use `test`; TRUNCATE TABLE t1 -master-bin.000001 387 Query 1 463 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; @@ -93,14 +91,13 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Table_map 1 250 table_id: # (test.t1) -master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F -master-bin.000001 297 Query 1 377 use `test`; TRUNCATE TABLE t1 -master-bin.000001 377 Query 1 453 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +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`; TRUNCATE TABLE t1 +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; @@ -126,13 +123,12 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1 -master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Query # # use `test`; DELETE FROM t1 +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -158,13 +154,12 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Query 1 307 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Query 1 384 use `test`; DELETE FROM t1 -master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Query # # use `test`; DELETE FROM t1 +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; @@ -191,12 +186,11 @@ a b 3 3 **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM -master-bin.000001 210 Table_map 1 250 table_id: # (test.t1) -master-bin.000001 250 Write_rows 1 297 table_id: # flags: STMT_END_F -master-bin.000001 297 Table_map 1 337 table_id: # (test.t1) -master-bin.000001 337 Delete_rows 1 384 table_id: # flags: STMT_END_F -master-bin.000001 384 Query 1 460 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=MyISAM +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.t1) +master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; DROP TABLE t1 diff --git a/mysql-test/r/rpl_truncate_3innodb.result b/mysql-test/r/rpl_truncate_3innodb.result index 062c9704ae0..7ce48c2e983 100644 --- a/mysql-test/r/rpl_truncate_3innodb.result +++ b/mysql-test/r/rpl_truncate_3innodb.result @@ -29,15 +29,14 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Xid 1 334 COMMIT /* xid= */ -master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1 -master-bin.000001 414 Xid 1 441 COMMIT /* xid= */ -master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -63,15 +62,14 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Xid 1 334 COMMIT /* xid= */ -master-bin.000001 334 Query 1 80 use `test`; TRUNCATE TABLE t1 -master-bin.000001 414 Xid 1 441 COMMIT /* xid= */ -master-bin.000001 441 Query 1 517 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; @@ -97,16 +95,15 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F -master-bin.000001 297 Xid 1 324 COMMIT /* xid= */ -master-bin.000001 324 Query 1 80 use `test`; TRUNCATE TABLE t1 -master-bin.000001 404 Xid 1 431 COMMIT /* xid= */ -master-bin.000001 431 Query 1 507 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +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 */ +master-bin.000001 # Query # # use `test`; TRUNCATE TABLE t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=STATEMENT; SET GLOBAL BINLOG_FORMAT=STATEMENT; @@ -132,15 +129,14 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Xid 1 334 COMMIT /* xid= */ -master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1 -master-bin.000001 411 Xid 1 438 COMMIT /* xid= */ -master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DELETE FROM t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=MIXED; SET GLOBAL BINLOG_FORMAT=MIXED; @@ -166,15 +162,14 @@ SELECT * FROM t1; a b **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Query 1 97 use `test`; INSERT INTO t1 VALUES (1,1), (2,2) -master-bin.000001 307 Xid 1 334 COMMIT /* xid= */ -master-bin.000001 334 Query 1 77 use `test`; DELETE FROM t1 -master-bin.000001 411 Xid 1 438 COMMIT /* xid= */ -master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1,1), (2,2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DELETE FROM t1 +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 **** On Master **** SET SESSION BINLOG_FORMAT=ROW; SET GLOBAL BINLOG_FORMAT=ROW; @@ -201,14 +196,13 @@ a b 3 3 **** On Master **** DROP TABLE t1; -SHOW BINLOG EVENTS; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 210 use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB -master-bin.000001 210 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 250 Write_rows 1 87 table_id: # flags: STMT_END_F -master-bin.000001 297 Xid 1 324 COMMIT /* xid= */ -master-bin.000001 324 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 364 Delete_rows 1 87 table_id: # flags: STMT_END_F -master-bin.000001 411 Xid 1 438 COMMIT /* xid= */ -master-bin.000001 438 Query 1 514 use `test`; DROP TABLE t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=InnoDB +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 */ +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Delete_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `test`; DROP TABLE t1 diff --git a/mysql-test/r/rpl_truncate_7ndb.result b/mysql-test/r/rpl_truncate_7ndb.result index 21399be4686..62ace911e45 100644 --- a/mysql-test/r/rpl_truncate_7ndb.result +++ b/mysql-test/r/rpl_truncate_7ndb.result @@ -29,16 +29,17 @@ a b DROP TABLE t1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 219 Query 1 283 BEGIN -master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 381 Write_rows 1 156 table_id: # -master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F -master-bin.000001 486 Query 1 551 COMMIT -master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1 -master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1 +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 385 Write_rows 1 157 table_id: # +master-bin.000001 444 Write_rows 1 195 table_id: # +master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 520 Query 1 585 COMMIT +master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1 +master-bin.000001 665 Query 1 741 use `test`; DROP TABLE t1 **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; INSERT INTO t1 VALUES (1,1), (2,2); @@ -65,27 +66,30 @@ a b DROP TABLE t1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 102 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 102 Query 1 219 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 219 Query 1 283 BEGIN -master-bin.000001 283 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 323 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 381 Write_rows 1 156 table_id: # -master-bin.000001 439 Write_rows 1 203 table_id: # flags: STMT_END_F -master-bin.000001 486 Query 1 551 COMMIT -master-bin.000001 551 Query 1 631 use `test`; TRUNCATE TABLE t1 -master-bin.000001 631 Query 1 707 use `test`; DROP TABLE t1 -master-bin.000001 707 Query 1 824 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 824 Query 1 888 BEGIN -master-bin.000001 888 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 928 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 986 Write_rows 1 156 table_id: # -master-bin.000001 1044 Write_rows 1 203 table_id: # flags: STMT_END_F -master-bin.000001 1091 Query 1 1156 COMMIT -master-bin.000001 1156 Query 1 1220 BEGIN -master-bin.000001 1220 Table_map 1 40 table_id: # (test.t1) -master-bin.000001 1260 Table_map 1 98 table_id: # (mysql.ndb_apply_status) -master-bin.000001 1318 Write_rows 1 156 table_id: # -master-bin.000001 1376 Delete_rows 1 195 table_id: # flags: STMT_END_F -master-bin.000001 1415 Query 1 1480 COMMIT -master-bin.000001 1480 Query 1 1556 use `test`; DROP TABLE t1 +master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 223 Query 1 287 BEGIN +master-bin.000001 287 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 327 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 385 Write_rows 1 157 table_id: # +master-bin.000001 444 Write_rows 1 195 table_id: # +master-bin.000001 482 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 520 Query 1 585 COMMIT +master-bin.000001 585 Query 1 665 use `test`; TRUNCATE TABLE t1 +master-bin.000001 665 Query 1 741 use `test`; DROP TABLE t1 +master-bin.000001 741 Query 1 858 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 858 Query 1 922 BEGIN +master-bin.000001 922 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 962 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1020 Write_rows 1 157 table_id: # +master-bin.000001 1079 Write_rows 1 195 table_id: # +master-bin.000001 1117 Write_rows 1 233 table_id: # flags: STMT_END_F +master-bin.000001 1155 Query 1 1220 COMMIT +master-bin.000001 1220 Query 1 1284 BEGIN +master-bin.000001 1284 Table_map 1 40 table_id: # (test.t1) +master-bin.000001 1324 Table_map 1 98 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1382 Write_rows 1 157 table_id: # +master-bin.000001 1441 Delete_rows 1 191 table_id: # +master-bin.000001 1475 Delete_rows 1 225 table_id: # flags: STMT_END_F +master-bin.000001 1509 Query 1 1574 COMMIT +master-bin.000001 1574 Query 1 1650 use `test`; DROP TABLE t1 diff --git a/mysql-test/r/rpl_udf.result b/mysql-test/r/rpl_udf.result new file mode 100644 index 00000000000..6587632bca0 --- /dev/null +++ b/mysql-test/r/rpl_udf.result @@ -0,0 +1,310 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +set binlog_format=row; +drop table if exists t1; +"*** Test 1) Test UDFs via loadable libraries *** +"Running on the master" +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Can't find symbol 'myfunc_nonexist' in library +SELECT * FROM mysql.func; +name ret dl type +myfunc_double 1 UDF_LIB function +myfunc_int 2 UDF_LIB function +affected rows: 2 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +myfunc_double 1 UDF_LIB function +myfunc_int 2 UDF_LIB function +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +SELECT myfunc_int(25); +myfunc_int(25) +25 +affected rows: 1 +SELECT myfunc_double(75.00); +myfunc_double(75.00) +50.00 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfunc_double; +affected rows: 0 +DROP FUNCTION myfunc_int; +affected rows: 0 +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +"*** Test 2) Test UDFs with SQL body *** +"Running on the master" +CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; +affected rows: 0 +CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 1000 +10 10 +100 100 +200 50 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 1000 +10 10 +100 100 +200 50 +affected rows: 4 +"Running on the master" +ALTER FUNCTION myfuncsql_int COMMENT "This was altered."; +affected rows: 0 +ALTER FUNCTION myfuncsql_double COMMENT "This was altered."; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +SELECT myfuncsql_int(25); +myfuncsql_int(25) +25 +affected rows: 1 +SELECT myfuncsql_double(75.00); +myfuncsql_double(75.00) +150 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfuncsql_double; +affected rows: 0 +DROP FUNCTION myfuncsql_int; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +set binlog_format=statement; +drop table if exists t1; +"*** Test 1) Test UDFs via loadable libraries *** +"Running on the master" +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +affected rows: 0 +CREATE FUNCTION myfunc_nonexist RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +ERROR HY000: Can't find symbol 'myfunc_nonexist' in library +SELECT * FROM mysql.func; +name ret dl type +myfunc_int 2 UDF_LIB function +myfunc_double 1 UDF_LIB function +affected rows: 2 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +myfunc_int 2 UDF_LIB function +myfunc_double 1 UDF_LIB function +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfunc_int(100), myfunc_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(10), myfunc_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(200), myfunc_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfunc_int(1), myfunc_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 48.5 +10 48.75 +100 48.6 +200 49 +affected rows: 4 +SELECT myfunc_int(25); +myfunc_int(25) +25 +affected rows: 1 +SELECT myfunc_double(75.00); +myfunc_double(75.00) +50.00 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfunc_double; +affected rows: 0 +DROP FUNCTION myfunc_int; +affected rows: 0 +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the slave" +SELECT * FROM mysql.func; +name ret dl type +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 +"*** Test 2) Test UDFs with SQL body *** +"Running on the master" +CREATE FUNCTION myfuncsql_int(i INT) RETURNS INTEGER DETERMINISTIC RETURN i; +affected rows: 0 +CREATE FUNCTION myfuncsql_double(d DOUBLE) RETURNS INTEGER DETERMINISTIC RETURN d * 2.00; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 +test myfuncsql_int FUNCTION i INT RETURN i +affected rows: 2 +"Running on the master" +CREATE TABLE t1(sum INT, price FLOAT(24)) ENGINE=MyISAM; +affected rows: 0 +INSERT INTO t1 VALUES(myfuncsql_int(100), myfuncsql_double(50.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(10), myfuncsql_double(5.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(200), myfuncsql_double(25.00)); +affected rows: 1 +INSERT INTO t1 VALUES(myfuncsql_int(1), myfuncsql_double(500.00)); +affected rows: 1 +SELECT * FROM t1 ORDER BY sum; +sum price +1 1000 +10 10 +100 100 +200 50 +affected rows: 4 +"Running on the slave" +SELECT * FROM t1 ORDER BY sum; +sum price +1 1000 +10 10 +100 100 +200 50 +affected rows: 4 +"Running on the master" +ALTER FUNCTION myfuncsql_int COMMENT "This was altered."; +affected rows: 0 +ALTER FUNCTION myfuncsql_double COMMENT "This was altered."; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +test myfuncsql_double FUNCTION d DOUBLE RETURN d * 2.00 This was altered. +test myfuncsql_int FUNCTION i INT RETURN i This was altered. +affected rows: 2 +SELECT myfuncsql_int(25); +myfuncsql_int(25) +25 +affected rows: 1 +SELECT myfuncsql_double(75.00); +myfuncsql_double(75.00) +150 +affected rows: 1 +"Running on the master" +DROP FUNCTION myfuncsql_double; +affected rows: 0 +DROP FUNCTION myfuncsql_int; +affected rows: 0 +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the slave" +SELECT db, name, type, param_list, body, comment FROM mysql.proc WHERE db = 'test' AND name LIKE 'myfuncsql%'; +db name type param_list body comment +affected rows: 0 +"Running on the master" +DROP TABLE t1; +affected rows: 0 diff --git a/mysql-test/r/system_mysql_db.result b/mysql-test/r/system_mysql_db.result index 29223cd3061..5acbace480a 100644 --- a/mysql-test/r/system_mysql_db.result +++ b/mysql-test/r/system_mysql_db.result @@ -220,10 +220,11 @@ event CREATE TABLE `event` ( `last_executed` datetime DEFAULT NULL, `starts` datetime DEFAULT NULL, `ends` datetime DEFAULT NULL, - `status` enum('ENABLED','DISABLED') NOT NULL DEFAULT 'ENABLED', + `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', + `originator` int(10) NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (`db`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events' diff --git a/mysql-test/r/user_var-binlog.result b/mysql-test/r/user_var-binlog.result index 1c50289a85d..b76b399c9e2 100644 --- a/mysql-test/r/user_var-binlog.result +++ b/mysql-test/r/user_var-binlog.result @@ -6,13 +6,13 @@ INSERT INTO t1 VALUES(@`a b`); set @var1= "';aaa"; SET @var2=char(ascii('a')); insert into t1 values (@var1),(@var2); -show binlog events from 102; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # User var 1 # @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES(@`a b`) -master-bin.000001 # User var 1 # @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci -master-bin.000001 # User var 1 # @`var2`=_binary 0x61 COLLATE binary -master-bin.000001 # Query 1 # use `test`; insert into t1 values (@var1),(@var2) +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 # 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) flush logs; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 183c57c0c04..8c625dc70a4 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -683,12 +683,12 @@ INSERT INTO t1 VALUES(1, 'test1'); CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1; ==========MASTER========== SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator test_rpl e1 root@localhost RECURRING NULL 1 SECOND # # ENABLED ==========SLAVE=========== USE test_rpl; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) @@ -742,12 +742,12 @@ a b ALTER EVENT e1 RENAME TO e2; ==========MASTER========== SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator test_rpl e2 root@localhost RECURRING NULL 1 SECOND # # ENABLED ==========SLAVE=========== USE test_rpl; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator ==========MASTER========== SELECT COUNT(*) FROM t1; COUNT(*) @@ -776,11 +776,11 @@ a b DROP EVENT e2; ==========MASTER========== SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator ==========SLAVE=========== USE test_rpl; SHOW EVENTS; -Db Name Definer Type Execute at Interval value Interval field Starts Ends Status +Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator DELETE FROM t1; DELETE FROM t2; diff --git a/mysql-test/t/binlog_row_mix_innodb_myisam.test b/mysql-test/t/binlog_row_mix_innodb_myisam.test index b131e5350af..335a05be146 100644 --- a/mysql-test/t/binlog_row_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_row_mix_innodb_myisam.test @@ -20,7 +20,7 @@ # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; ---exec $MYSQL_BINLOG --start-position=516 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output +--exec $MYSQL_BINLOG --start-position=520 $MYSQLTEST_VARDIR/log/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")) diff --git a/mysql-test/t/binlog_stm_mix_innodb_myisam.test b/mysql-test/t/binlog_stm_mix_innodb_myisam.test index 8d7399b918e..72651c13be7 100644 --- a/mysql-test/t/binlog_stm_mix_innodb_myisam.test +++ b/mysql-test/t/binlog_stm_mix_innodb_myisam.test @@ -12,7 +12,7 @@ # ER_SERVER_SHUTDOWN (i.e. disconnection just rolls back transaction # and does not make slave to stop) flush logs; ---exec $MYSQL_BINLOG --start-position=551 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output +--exec $MYSQL_BINLOG --start-position=555 $MYSQLTEST_VARDIR/log/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")) diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index 9111c4ad369..3e20e123258 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -22,7 +22,7 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)| SELECT HEX(s1),HEX(s2),d FROM t4| DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 406| +SHOW BINLOG EVENTS FROM 410| delimiter ;| # End of 5.0 tests diff --git a/mysql-test/t/ctype_uca.test b/mysql-test/t/ctype_uca.test index 3e49b9de883..64349bc40a6 100644 --- a/mysql-test/t/ctype_uca.test +++ b/mysql-test/t/ctype_uca.test @@ -475,3 +475,13 @@ ALTER TABLE t1 MODIFY a VARCHAR(30) character set utf8 collate utf8_turkish_ci; SELECT a, length(a) la, @l:=lower(a) l, length(@l) ll, @u:=upper(a) u, length(@u) lu FROM t1 ORDER BY id; DROP TABLE t1; + +# +# Bug #27079 Crash while grouping empty ucs2 strings +# +CREATE TABLE t1 ( + c1 text character set ucs2 collate ucs2_polish_ci NOT NULL +) ENGINE=MyISAM; +insert into t1 values (''),('a'); +SELECT COUNT(*), c1 FROM t1 GROUP BY c1; +DROP TABLE IF EXISTS t1; diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 5a3720dc431..c3320159c41 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -572,6 +572,20 @@ select utext from t1 where utext like '%%'; drop table t1; deallocate prepare stmt; +# +# Bug#22638 SOUNDEX broken for international characters +# +set names latin1; +set character_set_connection=ucs2; +select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); +select hex(soundex('')),hex(soundex('he')),hex(soundex('hello all folks')),hex(soundex('#3556 in bugdb')); +select 'mood' sounds like 'mud'; +# Cyrillic A, BE, VE +select hex(soundex(_ucs2 0x041004110412)); +# Make sure that "U+00BF INVERTED QUESTION MARK" is not considered as letter +select hex(soundex(_ucs2 0x00BF00C0)); +set names latin1; + # # Bug #14290: character_maximum_length for text fields # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 47a43258be1..c0060b7b813 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -702,6 +702,14 @@ select * from t1 where soundex(a) = soundex('TEST'); select * from t1 where soundex(a) = soundex('test'); drop table t1; +# +# Bug#22638 SOUNDEX broken for international characters +# +select soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB); +select hex(soundex(_utf8 0xE99885E8A788E99A8FE697B6E69BB4E696B0E79A84E696B0E997BB)); +select soundex(_utf8 0xD091D092D093); +select hex(soundex(_utf8 0xD091D092D093)); + SET collation_connection='utf8_general_ci'; -- source include/ctype_filesort.inc diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 60a28516195..f229d11a45c 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -21,11 +21,10 @@ partition_03ndb : BUG#16385 2006-03-24 mikael Partitions: crash when up rpl_ndb_2innodb : BUG#19227 2006-04-20 pekka pk delete apparently not replicated rpl_ndb_2myisam : BUG#19227 Seems to pass currently rpl_ndb_dd_partitions : BUG#19259 2006-04-21 rpl_ndb_dd_partitions fails on s/AMD -rpl_ndb_ddl : BUG#18946 result file needs update + test needs to checked +rpl_ddl : BUG#26418 2007-03-01 mleich Slave out of sync after CREATE/DROP TEMPORARY TABLE + ROLLBACK on master rpl_ndb_innodb2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_ndb_myisam2ndb : Bug #19710 Cluster replication to partition table fails on DELETE FROM statement rpl_row_blob_innodb : BUG#18980 2006-04-10 kent Test fails randomly -rpl_multi_engine : BUG#22583 2006-09-23 lars synchronization : Bug#24529 Test 'synchronization' fails on Mac pushbuild; Also on Linux 64 bit. # the below testcase have been reworked to avoid the bug, test contains comment, keep bug open diff --git a/mysql-test/t/events.test b/mysql-test/t/events.test index 24f4b4eccab..8236ae32588 100644 --- a/mysql-test/t/events.test +++ b/mysql-test/t/events.test @@ -179,7 +179,7 @@ set names cp1251; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; --replace_regex /STARTS '[^']+'/STARTS '#'/ SHOW CREATE EVENT ðóóò21; -insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND"); +insert into mysql.event (db, name, body, definer, interval_value, interval_field, originator) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND", 1); --error ER_NOT_SUPPORTED_YET show create event root22; --error ER_NOT_SUPPORTED_YET diff --git a/mysql-test/t/events_restart_phase1.test b/mysql-test/t/events_restart_phase1.test index 0a84f6c4966..b2c052d303c 100644 --- a/mysql-test/t/events_restart_phase1.test +++ b/mysql-test/t/events_restart_phase1.test @@ -14,6 +14,6 @@ create event abc3 on schedule every 1 second do insert into execution_log value( --sleep 1.5 select name from execution_log; -insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1','SYSTEM'); -insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2','SYSTEM'); +insert into mysql.event values ('db1','bad','select 42','root@localhost',NULL,1000,'MICROSECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment1',1,'SYSTEM'); +insert into mysql.event values ('db1','bad2','sect','root@localhost',NULL,1000,'SECOND','2006-05-05 17:39:11','2006-05-05 17:39:20','2016-05-05 15:39:24','2016-05-05 15:39:11',NULL,'ENABLED','DROP','','comment2',1,'SYSTEM'); --echo "Now we restart the server" diff --git a/mysql-test/t/events_scheduling.test b/mysql-test/t/events_scheduling.test index e3b55685e65..f7d4c3c14d6 100644 --- a/mysql-test/t/events_scheduling.test +++ b/mysql-test/t/events_scheduling.test @@ -51,7 +51,7 @@ SELECT IF(SUM(a) > 0, 'OK', 'ERROR') FROM table_4; DROP EVENT two_sec; SELECT IF(TIME_TO_SEC(TIMEDIFF(ENDS,STARTS))=6, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; SELECT IF(LAST_EXECUTED-ENDS < 3, 'OK', 'ERROR') FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_SCHEMA=DATABASE() AND EVENT_NAME='start_n_end' AND ENDS IS NOT NULL; -DROP EVENT start_n_end; +DROP EVENT IF EXISTS events_test.start_n_end; --echo "Already dropped because ended. Therefore an error." --error ER_EVENT_DOES_NOT_EXIST DROP EVENT only_one_time; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 9a27c4cbdb2..a73d7a40d8b 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -65,7 +65,7 @@ select "--- --database --" as ""; select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=235 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLTEST_VARDIR/log/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -97,7 +97,7 @@ select "--- --database --" as ""; select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=235 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 (mysqlbinlog does not accept input from stdin) --disable_query_log diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index 85a678055d4..cd49d3570e9 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -52,11 +52,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -82,11 +82,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=604 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=130 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLTEST_VARDIR/log/master-bin.000001 $MYSQLTEST_VARDIR/log/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -109,11 +109,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -136,11 +136,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=604 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=130 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log diff --git a/mysql-test/t/rpl_ddl.test b/mysql-test/t/rpl_ddl.test index ca1c25c5f09..80df16a7a00 100644 --- a/mysql-test/t/rpl_ddl.test +++ b/mysql-test/t/rpl_ddl.test @@ -22,13 +22,11 @@ # effects like failing 'sync_slave_with_master', crashes of the slave or # abort of the test case etc.. # -# 3. The assignment of the DDL command to be tested to $my_stmt can -# be a bit difficult. "'" must be avoided, because the test -# routine "include/rpl_stmt_seq.inc" performs a -# eval SELECT CONCAT('######## ','$my_stmt',' ########') as ""; -# --source include/not_ndb_default.inc ---source include/have_innodb.inc --source include/master-slave.inc -let $engine_type= "InnoDB"; +--source include/have_innodb.inc +let $engine_type= InnoDB; +let $temp_engine_type= MEMORY; +let $show_binlog = 0; +let $manipulate = 0; -- source extra/rpl_tests/rpl_ddl.test diff --git a/mysql-test/t/rpl_events.test b/mysql-test/t/rpl_events.test new file mode 100644 index 00000000000..895e94c438b --- /dev/null +++ b/mysql-test/t/rpl_events.test @@ -0,0 +1,24 @@ +################################################################## +# Author: Giuseppe # +# Date: 2006-12-20 # +# Purpose: To test that event effects are replicated # +# in both row based and statement based format # +################################################################## + +set global event_scheduler=1; + +--source include/not_embedded.inc +--source include/master-slave.inc + +let $engine_type= MyISAM; + +set binlog_format=row; + +# Embedded server doesn't support binlogging +--source include/rpl_events.inc + +set binlog_format=statement; + +# Embedded server doesn't support binlogging +--source include/rpl_events.inc + diff --git a/mysql-test/t/rpl_incident.test b/mysql-test/t/rpl_incident.test new file mode 100644 index 00000000000..9c30d29b6fd --- /dev/null +++ b/mysql-test/t/rpl_incident.test @@ -0,0 +1,47 @@ +--source include/master-slave.inc +--source include/have_debug.inc + +--echo **** On Master **** +CREATE TABLE t1 (a INT); + +INSERT INTO t1 VALUES (1),(2),(3); +SELECT * FROM t1; + +SET @saved = @@debug; +SET SESSION debug="d,incident_database_resync_on_replace"; + +# This will generate an incident log event and store it in the binary +# log before the replace statement. +REPLACE INTO t1 VALUES (4); +SET SESSION debug=@saved; +--save_master_pos +SELECT * FROM t1; + +connection slave; +--wait_for_slave_to_stop + +# The 4 should not be inserted into the table, since the incident log +# event should have stop the slave. +--echo **** On Slave **** +SELECT * FROM t1; + +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--query_vertical SHOW SLAVE STATUS + +SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; +START SLAVE; +--sync_with_master + +# Now, we should have inserted the row into the table and the slave +# should be running. We should also have rotated to a new binary log. + +SELECT * FROM t1; +--replace_result $MASTER_MYPORT MASTER_PORT +--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--query_vertical SHOW SLAVE STATUS + +DROP TABLE t1; +connection master; +DROP TABLE t1; + diff --git a/mysql-test/t/rpl_loaddata_s.test b/mysql-test/t/rpl_loaddata_s.test index 2c94c8ef953..f397d741310 100644 --- a/mysql-test/t/rpl_loaddata_s.test +++ b/mysql-test/t/rpl_loaddata_s.test @@ -20,9 +20,7 @@ save_master_pos; connection slave; sync_with_master; select count(*) from test.t1; # check that LOAD was replicated ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; # should be nothing +source include/show_binlog_events.inc; # Cleanup connection master; diff --git a/mysql-test/t/rpl_log_pos.test b/mysql-test/t/rpl_log_pos.test index 61c24da514e..ec1c83a9718 100644 --- a/mysql-test/t/rpl_log_pos.test +++ b/mysql-test/t/rpl_log_pos.test @@ -18,12 +18,12 @@ sync_slave_with_master; --replace_column 1 # 8 # 9 # 23 # 33 # show slave status; stop slave; -change master to master_log_pos=74; +change master to master_log_pos=75; start slave; sleep 5; stop slave; -change master to master_log_pos=74; +change master to master_log_pos=75; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # show slave status; @@ -33,7 +33,7 @@ sleep 5; --replace_column 1 # 8 # 9 # 23 # 33 # show slave status; stop slave; -change master to master_log_pos=177; +change master to master_log_pos=178; start slave; sleep 2; --replace_result $MASTER_MYPORT MASTER_PORT @@ -49,7 +49,7 @@ insert into t1 values (1),(2),(3); save_master_pos; connection slave; stop slave; -change master to master_log_pos=102; +change master to master_log_pos=106; start slave; sync_with_master; select * from t1 ORDER BY n; diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test index 6e0bda90503..f00beff583a 100644 --- a/mysql-test/t/rpl_misc_functions.test +++ b/mysql-test/t/rpl_misc_functions.test @@ -28,10 +28,76 @@ create table t2 like t1; eval load data local infile '$MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile' into table t2; # compare them with the replica; the SELECT below should return no row select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t1.r2=t2.r2 and t1.p=t2.p); -stop slave; -drop table t1; connection master; drop table t1; # End of 4.1 tests + +# +# BUG#25543 test calling rand() multiple times on the master in +# a stored procedure. +# + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (col_a double default NULL); + +DELIMITER |; + +# Use a SP that calls rand() multiple times +CREATE PROCEDURE test_replication_sp1() +BEGIN + INSERT INTO t1 VALUES (rand()), (rand()); + INSERT INTO t1 VALUES (rand()); +END| + +# Use a SP that calls another SP to call rand() multiple times +CREATE PROCEDURE test_replication_sp2() +BEGIN + CALL test_replication_sp1(); + CALL test_replication_sp1(); +END| + +# Use a SF that calls rand() multiple times +CREATE FUNCTION test_replication_sf() RETURNS DOUBLE DETERMINISTIC +BEGIN + RETURN (rand() + rand()); +END| + +DELIMITER ;| + +# Exercise the functions and procedures then compare the results on +# the master to those on the slave. +CALL test_replication_sp1(); +CALL test_replication_sp2(); +INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 VALUES (test_replication_sf()); + +# Record the results of the query on the master +--exec $MYSQL --port=$MASTER_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql + +--sync_slave_with_master + +# Record the results of the query on the slave +--exec $MYSQL --port=$SLAVE_MYPORT test -e "SELECT * FROM test.t1" > $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql + +# Compare the results from the master to the slave. +--exec diff $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql + +# Cleanup +connection master; +--disable_warnings +DROP PROCEDURE IF EXISTS test_replication_sp1; +DROP PROCEDURE IF EXISTS test_replication_sp2; +DROP FUNCTION IF EXISTS test_replication_sf; +DROP TABLE IF EXISTS t1; +--enable_warnings +--sync_slave_with_master + +# If all is good, when can cleanup our dump files. +--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_master.sql +--system rm $MYSQLTEST_VARDIR/tmp/rpl_rand_slave.sql diff --git a/mysql-test/t/rpl_ndb_ddl.test b/mysql-test/t/rpl_ndb_ddl.test index 0c503e56c9c..ca7a4ce4968 100644 --- a/mysql-test/t/rpl_ndb_ddl.test +++ b/mysql-test/t/rpl_ndb_ddl.test @@ -1,4 +1,4 @@ -######################## rpl_ddl.test ######################## +#################### rpl_ndb_ddl.test ######################## # # # DDL statements (sometimes with implicit COMMIT) executed # # by the master and it's propagation into the slave # @@ -22,14 +22,11 @@ # effects like failing 'sync_slave_with_master', crashes of the slave or # abort of the test case etc.. # -# 3. The assignment of the DDL command to be tested to $my_stmt can -# be a bit difficult. "'" must be avoided, because the test -# routine "include/rpl_stmt_seq.inc" performs a -# eval SELECT CONCAT('######## ','$my_stmt',' ########') as ""; -# ---source include/have_ndb.inc --source include/master-slave.inc -let $engine_type= "NDB"; --- source extra/rpl_tests/rpl_ndb_ddl.test - +--source include/have_ndb.inc +let $engine_type= NDB; +let $temp_engine_type= MEMORY; +let $show_binlog = 0; +let $manipulate = 0; +-- source extra/rpl_tests/rpl_ddl.test diff --git a/mysql-test/t/rpl_row_basic_11bugs-master.opt b/mysql-test/t/rpl_row_basic_11bugs-master.opt index ad03cdaa6d1..ceba85f40e5 100644 --- a/mysql-test/t/rpl_row_basic_11bugs-master.opt +++ b/mysql-test/t/rpl_row_basic_11bugs-master.opt @@ -1 +1,2 @@ ---binlog_ignore_db=test_ignore +--binlog_ignore_db=test_ignore --innodb + diff --git a/mysql-test/t/rpl_row_basic_11bugs-slave.opt b/mysql-test/t/rpl_row_basic_11bugs-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/t/rpl_row_basic_11bugs-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/t/rpl_row_basic_11bugs.test b/mysql-test/t/rpl_row_basic_11bugs.test index 348b6d45f52..17f5848ceef 100644 --- a/mysql-test/t/rpl_row_basic_11bugs.test +++ b/mysql-test/t/rpl_row_basic_11bugs.test @@ -24,8 +24,7 @@ USE test_ignore; CREATE TABLE t2 (a INT, b INT); SHOW TABLES; INSERT INTO t2 VALUES (3,3), (4,4); ---replace_regex /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 102; +source include/show_binlog_events.inc; sync_slave_with_master; --echo **** On Slave **** SHOW DATABASES; @@ -117,5 +116,69 @@ sync_slave_with_master; SELECT HEX(a),b FROM t1; connection master; -DROP TABLE t1; +DROP TABLE IF EXISTS t1; +sync_slave_with_master; + +# BUG#22583: RBR between MyISAM and non-MyISAM tables containing a BIT +# field does not work + +--echo ================ Test for BUG#22583 ================ +--disable_query_log +--source include/master-slave-reset.inc +--enable_query_log + +--echo **** On Master **** +connection master; +CREATE TABLE t1_myisam (k INT, a BIT(1), b BIT(9)) ENGINE=MYISAM; +CREATE TABLE t1_innodb (k INT, a BIT(1), b BIT(9)) ENGINE=INNODB; +CREATE TABLE t2_myisam (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=MYISAM; +CREATE TABLE t2_innodb (k INT, a BIT(1) NOT NULL, b BIT(4) NOT NULL) ENGINE=INNODB; +--echo **** On Slave **** +sync_slave_with_master; +ALTER TABLE t1_myisam ENGINE=INNODB; +ALTER TABLE t1_innodb ENGINE=MYISAM; +ALTER TABLE t2_myisam ENGINE=INNODB; +ALTER TABLE t2_innodb ENGINE=MYISAM; + +--echo **** On Master **** +connection master; +INSERT INTO t1_myisam VALUES(1, b'0', 257); +INSERT INTO t1_myisam VALUES(2, b'1', 256); +INSERT INTO t1_innodb VALUES(1, b'0', 257); +INSERT INTO t1_innodb VALUES(2, b'1', 256); +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +INSERT INTO t2_myisam VALUES(1, b'0', 9); +INSERT INTO t2_myisam VALUES(2, b'1', 8); +INSERT INTO t2_innodb VALUES(1, b'0', 9); +INSERT INTO t2_innodb VALUES(2, b'1', 8); +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +--echo **** On Slave **** +sync_slave_with_master; +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +SELECT k, HEX(a),HEX(b) FROM t2_innodb; + +--echo **** On Master **** +connection master; +UPDATE t1_myisam SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +UPDATE t1_innodb SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +UPDATE t2_myisam SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +UPDATE t2_innodb SET a=0 WHERE k=2; +SELECT k, HEX(a),HEX(b) FROM t2_innodb; +--echo **** On Slave **** +sync_slave_with_master; +SELECT k, HEX(a),HEX(b) FROM t1_myisam; +SELECT k, HEX(a),HEX(b) FROM t1_innodb; +SELECT k, HEX(a),HEX(b) FROM t2_myisam; +SELECT k, HEX(a),HEX(b) FROM t2_innodb; + +--echo **** On Master **** +connection master; +DROP TABLE IF EXISTS t1_myisam, t1_innodb, t2_myisam, t2_innodb; sync_slave_with_master; diff --git a/mysql-test/t/rpl_row_create_table.test b/mysql-test/t/rpl_row_create_table.test index 6afcae4b5e6..e00494a3a13 100644 --- a/mysql-test/t/rpl_row_create_table.test +++ b/mysql-test/t/rpl_row_create_table.test @@ -34,9 +34,9 @@ CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; ---replace_column 1 # 4 # 5 # +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---query_vertical SHOW BINLOG EVENTS FROM 212 +--query_vertical SHOW BINLOG EVENTS FROM 216 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 --query_vertical SHOW CREATE TABLE t2 @@ -70,8 +70,9 @@ connection master; --error ER_DUP_ENTRY_WITH_KEY_NAME CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1118; +SHOW BINLOG EVENTS FROM 1098; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -79,8 +80,9 @@ CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1118; +SHOW BINLOG EVENTS FROM 1098; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -90,8 +92,9 @@ INSERT INTO tt4 VALUES (4,8), (5,10), (6,12); BEGIN; INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1314; +SHOW BINLOG EVENTS FROM 1294; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -105,8 +108,9 @@ CREATE TEMPORARY TABLE tt7 SELECT 1; --echo **** On Master **** --query_vertical SHOW CREATE TABLE t8 --query_vertical SHOW CREATE TABLE t9 +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 1410; +SHOW BINLOG EVENTS FROM 1390; sync_slave_with_master; --echo **** On Slave **** --query_vertical SHOW CREATE TABLE t8 @@ -156,6 +160,7 @@ SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a; +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS; sync_slave_with_master; @@ -201,6 +206,7 @@ INSERT INTO t2 SELECT a+2 FROM tt1; COMMIT; SELECT * FROM t2 ORDER BY a; +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ SHOW BINLOG EVENTS; sync_slave_with_master; @@ -219,8 +225,9 @@ INSERT INTO t2 SELECT a+2 FROM tt2; ROLLBACK; SELECT * FROM t2 ORDER BY a; +--replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 627; +SHOW BINLOG EVENTS FROM 631; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/t/rpl_row_flsh_tbls.test b/mysql-test/t/rpl_row_flsh_tbls.test index 9e8efc1ac9c..a2f9e31fc5d 100644 --- a/mysql-test/t/rpl_row_flsh_tbls.test +++ b/mysql-test/t/rpl_row_flsh_tbls.test @@ -1,7 +1,7 @@ # depends on the binlog output -- source include/have_binlog_format_row.inc -let $rename_event_pos= 615; +let $rename_event_pos= 619; # Bug#18326: Do not lock table for writing during prepare of statement # The use of the ps protocol causes extra table maps in the binlog, so diff --git a/mysql-test/t/rpl_row_mysqlbinlog.test b/mysql-test/t/rpl_row_mysqlbinlog.test index 3b4c8db86d8..f7158107e4c 100644 --- a/mysql-test/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/t/rpl_row_mysqlbinlog.test @@ -162,12 +162,12 @@ connection master; # this test for position option -# By setting this position to 412, we should only get the create of t3 +# By setting this position to 413, we should only get the create of t3 --disable_query_log select "--- Test 2 position test --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=412 $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 $MYSQLTEST_VARDIR/log/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -263,7 +263,7 @@ select "--- Test 6 reading stdin --" as ""; select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --position=412 - < $MYSQLTEST_VARDIR/log/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --position=416 - < $MYSQLTEST_VARDIR/log/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log diff --git a/mysql-test/t/rpl_sp.test b/mysql-test/t/rpl_sp.test index 9230b3bff4f..84154e549b8 100644 --- a/mysql-test/t/rpl_sp.test +++ b/mysql-test/t/rpl_sp.test @@ -566,7 +566,7 @@ connection master; # were written to the binary log. --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events in 'master-bin.000001' from 102; +show binlog events in 'master-bin.000001' from 106; # Restore log_bin_trust_function_creators to its original value. diff --git a/mysql-test/t/rpl_stm_flsh_tbls.test b/mysql-test/t/rpl_stm_flsh_tbls.test index 43a5234ccc7..a8a33d05e8b 100644 --- a/mysql-test/t/rpl_stm_flsh_tbls.test +++ b/mysql-test/t/rpl_stm_flsh_tbls.test @@ -1,7 +1,7 @@ # depends on the binlog output --source include/have_binlog_format_mixed_or_statement.inc -let $rename_event_pos= 652; +let $rename_event_pos= 656; -- source extra/rpl_tests/rpl_flsh_tbls.test # End of 4.1 tests diff --git a/mysql-test/t/rpl_switch_stm_row_mixed.test b/mysql-test/t/rpl_switch_stm_row_mixed.test index 494e73fda49..b0012827db8 100644 --- a/mysql-test/t/rpl_switch_stm_row_mixed.test +++ b/mysql-test/t/rpl_switch_stm_row_mixed.test @@ -519,9 +519,7 @@ LOCK TABLES t12 WRITE; INSERT INTO t12 VALUES(UUID()); UNLOCK TABLES; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; sync_slave_with_master; # as we're using UUID we don't SELECT but use "diff" like in rpl_row_UUID @@ -536,9 +534,7 @@ sync_slave_with_master; diff_files $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_master.sql $MYSQLTEST_VARDIR/tmp/rpl_switch_stm_row_mixed_slave.sql; connection master; ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; # Now test that mysqlbinlog works fine on a binlog generated by the # mixed mode diff --git a/mysql-test/t/rpl_udf.test b/mysql-test/t/rpl_udf.test new file mode 100644 index 00000000000..262ad04630c --- /dev/null +++ b/mysql-test/t/rpl_udf.test @@ -0,0 +1,22 @@ +################################################################### +# Author: Chuck Bell # +# Date: 2006-12-21 # +# Purpose: To test that UDFs are replicated in both row based and # +# statement based format. This tests work completed in WL#3629. # +################################################################### + +--source include/not_embedded.inc +--source include/master-slave.inc + +let $engine_type= MyISAM; + +set binlog_format=row; + +# Embedded server doesn't support binlogging +--source include/rpl_udf.inc + +set binlog_format=statement; + +# Embedded server doesn't support binlogging +--source include/rpl_udf.inc + diff --git a/mysql-test/t/user_var-binlog.test b/mysql-test/t/user_var-binlog.test index ce1a476eb43..3ce01a0927b 100644 --- a/mysql-test/t/user_var-binlog.test +++ b/mysql-test/t/user_var-binlog.test @@ -13,9 +13,8 @@ INSERT INTO t1 VALUES(@`a b`); set @var1= "';aaa"; SET @var2=char(ascii('a')); insert into t1 values (@var1),(@var2); ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events from 102; +source include/show_binlog_events.inc; + # more important than SHOW BINLOG EVENTS, mysqlbinlog (where we # absolutely need variables names to be quoted and strings to be # escaped). diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index f6e2a45339e..5c67477ce5b 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -70,7 +70,7 @@ CALL create_slow_log_table(); DROP PROCEDURE create_slow_log_table; -CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; +CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts BIGINT UNSIGNED NOT NULL, updates BIGINT UNSIGNED NOT NULL, deletes BIGINT UNSIGNED NOT NULL, schemaops BIGINT UNSIGNED NOT NULL, PRIMARY KEY(epoch)) ENGINE=MYISAM; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index d973c1dddae..e9816bd21e9 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -477,9 +477,11 @@ ALTER TABLE event ADD sql_mode 'HIGH_NOT_PRECEDENCE' ) DEFAULT '' NOT NULL AFTER on_completion; ALTER TABLE event MODIFY name char(64) CHARACTER SET utf8 NOT NULL default ''; +ALTER TABLE event ADD COLUMN originator INT(10) NOT NULL; +ALTER TABLE event MODIFY COLUMN status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED'; ALTER TABLE event ADD COLUMN time_zone char(64) CHARACTER SET latin1 - NOT NULL DEFAULT 'SYSTEM' AFTER comment; + NOT NULL DEFAULT 'SYSTEM' AFTER originator; # # TRIGGER privilege diff --git a/sql/Makefile.am b/sql/Makefile.am index ac14ed3e883..a85eb012f1d 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -52,7 +52,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sql_error.h field.h handler.h mysqld_suffix.h \ ha_partition.h \ ha_ndbcluster.h ha_ndbcluster_binlog.h \ - ha_ndbcluster_tables.h \ + ha_ndbcluster_tables.h rpl_constants.h \ opt_range.h protocol.h rpl_tblmap.h rpl_utility.h \ log.h sql_show.h rpl_rli.h rpl_mi.h \ sql_select.h structs.h table.h sql_udf.h hash_filo.h \ diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 67ba371772a..a3fb9a284d5 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -101,7 +101,8 @@ Event_parse_data::new_instance(THD *thd) */ Event_parse_data::Event_parse_data() - :on_completion(ON_COMPLETION_DROP), status(ENABLED), do_not_create(FALSE), + :on_completion(Event_basic::ON_COMPLETION_DROP), + status(Event_basic::ENABLED), do_not_create(FALSE), item_starts(NULL), item_ends(NULL), item_execute_at(NULL), starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE), item_expression(NULL), expression(0) @@ -243,7 +244,7 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc) if (ltime_utc >= (my_time_t) thd->query_start()) return; - if (on_completion == ON_COMPLETION_DROP) + if (on_completion == Event_basic::ON_COMPLETION_DROP) { switch (thd->lex->sql_command) { case SQLCOM_CREATE_EVENT: @@ -260,9 +261,9 @@ Event_parse_data::check_if_in_the_past(THD *thd, my_time_t ltime_utc) do_not_create= TRUE; } - else if (status == ENABLED) + else if (status == Event_basic::ENABLED) { - status= DISABLED; + status= Event_basic::DISABLED; push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_EVENT_EXEC_TIME_IN_THE_PAST, ER(ER_EVENT_EXEC_TIME_IN_THE_PAST)); @@ -588,9 +589,9 @@ Event_parse_data::check_parse_data(THD *thd) init_name(thd, identifier); init_definer(thd); - ret= init_execute_at(thd) || init_interval(thd) || init_starts(thd) || init_ends(thd); + check_originator_id(thd); DBUG_RETURN(ret); } @@ -637,6 +638,31 @@ Event_parse_data::init_definer(THD *thd) } +/* + Set the originator id of the event to the server_id if executing on + the master or set to the server_id of the master if executing on + the slave. If executing on slave, also set status to SLAVESIDE_DISABLED. + + SYNOPSIS + Event_parse_data::check_originator_id() +*/ +void Event_parse_data::check_originator_id(THD *thd) +{ + /* Disable replicated events on slave. */ + if ((thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) || + (thd->system_thread == SYSTEM_THREAD_SLAVE_IO)) + { + DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED.")); + if ((status == Event_basic::ENABLED) || + (status == Event_basic::DISABLED)) + status = Event_basic::SLAVESIDE_DISABLED; + originator = thd->server_id; + } + else + originator = server_id; +} + + /* Constructor @@ -995,8 +1021,23 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table) goto error; DBUG_PRINT("load_from_row", ("Event [%s] is [%s]", name.str, ptr)); - status= (ptr[0]=='E'? Event_queue_element::ENABLED: - Event_queue_element::DISABLED); + + /* Set event status (ENABLED | SLAVESIDE_DISABLED | DISABLED) */ + switch (ptr[0]) + { + case 'E' : + status = Event_queue_element::ENABLED; + break; + case 'S' : + status = Event_queue_element::SLAVESIDE_DISABLED; + break; + case 'D' : + status = Event_queue_element::DISABLED; + break; + } + if ((ptr= get_field(&mem_root, table->field[ET_FIELD_ORIGINATOR])) == NullS) + goto error; + originator = table->field[ET_FIELD_ORIGINATOR]->val_int(); /* ToDo : Andrey . Find a way not to allocate ptr on event_mem_root */ if ((ptr= get_field(&mem_root, @@ -1343,7 +1384,7 @@ Event_queue_element::compute_next_execution_time() (long) starts, (long) ends, (long) last_executed, (long) this)); - if (status == Event_queue_element::DISABLED) + if (status != Event_queue_element::ENABLED) { DBUG_PRINT("compute_next_execution_time", ("Event %s is DISABLED", name.str)); @@ -1641,6 +1682,13 @@ Event_queue_element::update_timing_fields(THD *thd) status_changed= FALSE; } + /* + Turn off row binlogging of event timing updates. These are not used + for RBR of events replicated to the slave. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + if ((table->file->ha_update_row(table->record[1], table->record[0]))) ret= TRUE; @@ -1731,6 +1779,8 @@ Event_timed::get_create_event(THD *thd, String *buf) if (status == Event_timed::ENABLED) buf->append(STRING_WITH_LEN("ENABLE")); + else if (status == Event_timed::SLAVESIDE_DISABLED) + buf->append(STRING_WITH_LEN("SLAVESIDE_DISABLE")); else buf->append(STRING_WITH_LEN("DISABLE")); diff --git a/sql/event_data_objects.h b/sql/event_data_objects.h index 8e013e40400..d1d213901f0 100644 --- a/sql/event_data_objects.h +++ b/sql/event_data_objects.h @@ -22,11 +22,9 @@ #define EVEX_BAD_PARAMS -5 #define EVEX_MICROSECOND_UNSUP -6 - class sp_head; class Sql_alloc; - class Event_queue_element_for_exec { public: @@ -54,6 +52,24 @@ protected: MEM_ROOT mem_root; public: + /* + ENABLED = feature can function normally (is turned on) + SLAVESIDE_DISABLED = feature is turned off on slave + DISABLED = feature is turned off + */ + enum enum_status + { + ENABLED = 1, + DISABLED, + SLAVESIDE_DISABLED + }; + + enum enum_on_completion + { + ON_COMPLETION_DROP = 1, + ON_COMPLETION_PRESERVE + }; + LEX_STRING dbname; LEX_STRING name; LEX_STRING definer;// combination of user and host @@ -83,20 +99,9 @@ protected: bool last_executed_changed; public: - enum enum_status - { - ENABLED = 1, - DISABLED - }; - - enum enum_on_completion - { - ON_COMPLETION_DROP = 1, - ON_COMPLETION_PRESERVE - }; - - enum enum_on_completion on_completion; - enum enum_status status; + int on_completion; + int status; + longlong originator; my_time_t last_executed; my_time_t execute_at; @@ -216,19 +221,10 @@ private: class Event_parse_data : public Sql_alloc { public: - enum enum_status - { - ENABLED = 1, - DISABLED - }; - enum enum_on_completion - { - ON_COMPLETION_DROP = 1, - ON_COMPLETION_PRESERVE - }; - enum enum_on_completion on_completion; - enum enum_status status; + int on_completion; + int status; + longlong originator; /* do_not_create will be set if STARTS time is in the past and on_completion == ON_COMPLETION_DROP. @@ -298,6 +294,7 @@ private: check_if_in_the_past(THD *thd, my_time_t ltime_utc); Event_parse_data(const Event_parse_data &); /* Prevent use of these */ + void check_originator_id(THD *thd); void operator=(Event_parse_data &); }; diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 0c59d3e92f8..6b411212ddb 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -94,7 +94,7 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] = }, { { C_STRING_WITH_LEN("status") }, - { C_STRING_WITH_LEN("enum('ENABLED','DISABLED')") }, + { C_STRING_WITH_LEN("enum('ENABLED','DISABLED','SLAVESIDE_DISABLED')") }, {NULL, 0} }, { @@ -119,6 +119,11 @@ const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] = { C_STRING_WITH_LEN("char(64)") }, { C_STRING_WITH_LEN("utf8") } }, + { + { C_STRING_WITH_LEN("originator") }, + { C_STRING_WITH_LEN("int(10)") }, + {NULL, 0} + }, { { C_STRING_WITH_LEN("time_zone") }, { C_STRING_WITH_LEN("char(64)") }, @@ -175,6 +180,9 @@ mysql_event_fill_row(THD *thd, TABLE *table, Event_parse_data *et, fields[ET_FIELD_STATUS]->store((longlong)et->status, TRUE); + fields[ET_FIELD_ORIGINATOR]->store((longlong)et->originator, TRUE); + + /* Change the SQL_MODE only if body was present in an ALTER EVENT and of course always during CREATE EVENT. @@ -564,7 +572,6 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, goto err; } - DBUG_PRINT("info", ("name: %.*s", parse_data->name.length, parse_data->name.str)); @@ -632,6 +639,8 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, if ((ret= mysql_event_fill_row(thd, table, parse_data, FALSE))) goto err; + table->field[ET_FIELD_STATUS]->store((longlong)parse_data->status, TRUE); + /* Close active transaction only if We are going to modify disk */ if (end_active_trans(thd)) goto err; diff --git a/sql/event_db_repository.h b/sql/event_db_repository.h index 4991e2d0aa2..0c2fcf9542d 100644 --- a/sql/event_db_repository.h +++ b/sql/event_db_repository.h @@ -19,7 +19,7 @@ enum enum_events_table_field { - ET_FIELD_DB = 0, + ET_FIELD_DB = 0, ET_FIELD_NAME, ET_FIELD_BODY, ET_FIELD_DEFINER, @@ -35,6 +35,7 @@ enum enum_events_table_field ET_FIELD_ON_COMPLETION, ET_FIELD_SQL_MODE, ET_FIELD_COMMENT, + ET_FIELD_ORIGINATOR, ET_FIELD_TIME_ZONE, ET_FIELD_COUNT /* a cool trick to count the number of fields :) */ }; diff --git a/sql/event_queue.cc b/sql/event_queue.cc index ef9dddf9195..b9c7af1a1a2 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -199,7 +199,8 @@ Event_queue::create_event(THD *thd, Event_queue_element *new_element) DBUG_PRINT("enter", ("thd: 0x%lx et=%s.%s", (long) thd, new_element->dbname.str, new_element->name.str)); - if (new_element->status == Event_queue_element::DISABLED) + if ((new_element->status == Event_queue_element::DISABLED) + || (new_element->status == Event_queue_element::SLAVESIDE_DISABLED)) delete new_element; else { @@ -235,7 +236,8 @@ Event_queue::update_event(THD *thd, LEX_STRING dbname, LEX_STRING name, DBUG_ENTER("Event_queue::update_event"); DBUG_PRINT("enter", ("thd: 0x%lx et=[%s.%s]", (long) thd, dbname.str, name.str)); - if (new_element->status == Event_queue_element::DISABLED) + if ((new_element->status == Event_queue_element::DISABLED) || + (new_element->status == Event_queue_element::SLAVESIDE_DISABLED)) { DBUG_PRINT("info", ("The event is disabled.")); /* diff --git a/sql/events.cc b/sql/events.cc index 88014ee34af..df2f1124f38 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -324,7 +324,15 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists) DBUG_RETURN(TRUE); } + /* + Turn off row binlogging of this statement and use statement-based + so that all supporting tables are updated for CREATE EVENT command. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + pthread_mutex_lock(&LOCK_event_metadata); + /* On error conditions my_error() is called so no need to handle here */ if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists)) && !parse_data->do_not_create) @@ -340,8 +348,16 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, bool if_not_exists) DBUG_ASSERT(ret == OP_LOAD_ERROR); delete new_element; } - else + else /* Binlog the create event. */ + { event_queue->create_event(thd, new_element); + if (mysql_bin_log.is_open() && (thd->query_length > 0)) + { + thd->clear_error(); + thd->binlog_query(THD::MYSQL_QUERY_TYPE, + thd->query, thd->query_length, FALSE, FALSE); + } + } } pthread_mutex_unlock(&LOCK_event_metadata); @@ -383,7 +399,15 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to) DBUG_RETURN(TRUE); } + /* + Turn off row binlogging of this statement and use statement-based + so that all supporting tables are updated for UPDATE EVENT command. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + pthread_mutex_lock(&LOCK_event_metadata); + /* On error conditions my_error() is called so no need to handle here */ if (!(ret= db_repository->update_event(thd, parse_data, new_dbname, new_name))) { @@ -398,9 +422,17 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, sp_name *rename_to) DBUG_ASSERT(ret == OP_LOAD_ERROR); delete new_element; } - else + else /* Binlog the alter event. */ + { event_queue->update_event(thd, parse_data->dbname, parse_data->name, new_element); + if (mysql_bin_log.is_open() && (thd->query_length > 0)) + { + thd->clear_error(); + thd->binlog_query(THD::MYSQL_QUERY_TYPE, + thd->query, thd->query_length, FALSE, FALSE); + } + } } pthread_mutex_unlock(&LOCK_event_metadata); @@ -435,10 +467,26 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) DBUG_RETURN(TRUE); } + /* + Turn off row binlogging of this statement and use statement-based so + that all supporting tables are updated for DROP EVENT command. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + pthread_mutex_lock(&LOCK_event_metadata); /* On error conditions my_error() is called so no need to handle here */ if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists))) + { event_queue->drop_event(thd, dbname, name); + /* Binlog the drop event. */ + if (mysql_bin_log.is_open() && (thd->query_length > 0)) + { + thd->clear_error(); + thd->binlog_query(THD::MYSQL_QUERY_TYPE, + thd->query, thd->query_length, FALSE, FALSE); + } + } pthread_mutex_unlock(&LOCK_event_metadata); DBUG_RETURN(ret); } diff --git a/sql/field.cc b/sql/field.cc index 7240a59c75f..250a9e3c1b9 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8506,9 +8506,28 @@ char *Field_bit::pack(char *to, const char *from, uint max_length) { DBUG_ASSERT(max_length); uint length; - if (bit_len) + if (bit_len > 0) { - uchar bits= get_rec_bits(bit_ptr, bit_ofs, bit_len); + /* + We have the following: + + ptr Points into a field in record R1 + from Points to a field in a record R2 + bit_ptr Points to the byte (in the null bytes) that holds the + odd bits of R1 + from_bitp Points to the byte that holds the odd bits of R2 + + We have the following: + + ptr - bit_ptr = from - from_bitp + + We want to isolate 'from_bitp', so this gives: + + ptr - bit_ptr - from = - from_bitp + - ptr + bit_ptr + from = from_bitp + bit_ptr + from - ptr = from_bitp + */ + uchar bits= get_rec_bits(bit_ptr + (from - ptr), bit_ofs, bit_len); *to++= bits; } length= min(bytes_in_rec, max_length - (bit_len > 0)); @@ -8519,9 +8538,16 @@ char *Field_bit::pack(char *to, const char *from, uint max_length) const char *Field_bit::unpack(char *to, const char *from) { - if (bit_len) + if (bit_len > 0) { - set_rec_bits(*from, bit_ptr, bit_ofs, bit_len); + /* + set_rec_bits is a macro, don't put the post-increment in the + argument since that might cause strange side-effects. + + For the choice of the second argument, see the explanation for + Field_bit::pack(). + */ + set_rec_bits(*from, bit_ptr + (to - ptr), bit_ofs, bit_len); from++; } memcpy(to, from, bytes_in_rec); diff --git a/sql/field.h b/sql/field.h index b96be208e41..ac168c1b650 100644 --- a/sql/field.h +++ b/sql/field.h @@ -193,9 +193,9 @@ public: */ virtual void sql_type(String &str) const =0; virtual uint size_of() const =0; // For new field - inline bool is_null(uint row_offset=0) + inline bool is_null(my_ptrdiff_t row_offset= 0) { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : table->null_row; } - inline bool is_real_null(uint row_offset=0) + inline bool is_real_null(my_ptrdiff_t row_offset= 0) { return null_ptr ? (null_ptr[row_offset] & null_bit ? 1 : 0) : 0; } inline bool is_null_in_record(const uchar *record) { @@ -210,9 +210,9 @@ public: return 0; return test(null_ptr[offset] & null_bit); } - inline void set_null(int row_offset=0) + inline void set_null(my_ptrdiff_t row_offset= 0) { if (null_ptr) null_ptr[row_offset]|= null_bit; } - inline void set_notnull(int row_offset=0) + inline void set_notnull(my_ptrdiff_t row_offset= 0) { if (null_ptr) null_ptr[row_offset]&= (uchar) ~null_bit; } inline bool maybe_null(void) { return null_ptr != 0 || table->maybe_null; } inline bool real_maybe_null(void) { return null_ptr != 0; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a011a2884c8..e6f951bfc7b 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1813,7 +1813,8 @@ void Item_func_soundex::fix_length_and_dec() { collation.set(args[0]->collation); max_length=args[0]->max_length; - set_if_bigger(max_length,4); + set_if_bigger(max_length, 4 * collation.collation->mbminlen); + tmp_value.set_charset(collation.collation); } @@ -1823,14 +1824,15 @@ void Item_func_soundex::fix_length_and_dec() else return 0 */ -static char soundex_toupper(char ch) +static int soundex_toupper(int ch) { return (ch >= 'a' && ch <= 'z') ? ch - 'a' + 'A' : ch; } -static char get_scode(char *ptr) + +static char get_scode(int wc) { - uchar ch= soundex_toupper(*ptr); + int ch= soundex_toupper(wc); if (ch < 'A' || ch > 'Z') { // Thread extended alfa (country spec) @@ -1840,46 +1842,121 @@ static char get_scode(char *ptr) } +static bool my_uni_isalpha(int wc) +{ + /* + Return true for all Basic Latin letters: a..z A..Z. + Return true for all Unicode characters with code higher than U+00C0: + - characters between 'z' and U+00C0 are controls and punctuations. + - "U+00C0 LATIN CAPITAL LETTER A WITH GRAVE" is the first letter after 'z'. + */ + return (wc >= 'a' && wc <= 'z') || + (wc >= 'A' && wc <= 'Z') || + (wc >= 0xC0); +} + + String *Item_func_soundex::val_str(String *str) { DBUG_ASSERT(fixed == 1); String *res =args[0]->val_str(str); char last_ch,ch; CHARSET_INFO *cs= collation.collation; + my_wc_t wc; + uint nchars; + int rc; - if ((null_value=args[0]->null_value)) + if ((null_value= args[0]->null_value)) return 0; /* purecov: inspected */ - if (tmp_value.alloc(max(res->length(),4))) + if (tmp_value.alloc(max(res->length(), 4 * cs->mbminlen))) return str; /* purecov: inspected */ char *to= (char *) tmp_value.ptr(); - char *from= (char *) res->ptr(), *end=from+res->length(); - tmp_value.set_charset(cs); + char *to_end= to + tmp_value.alloced_length(); + char *from= (char *) res->ptr(), *end= from + res->length(); - while (from != end && !my_isalpha(cs,*from)) // Skip pre-space - from++; /* purecov: inspected */ - if (from == end) - return &my_empty_string; // No alpha characters. - *to++ = soundex_toupper(*from); // Copy first letter - last_ch = get_scode(from); // code of the first letter - // for the first 'double-letter check. - // Loop on input letters until - // end of input (null) or output - // letter code count = 3 - for (from++ ; from < end ; from++) + for ( ; ; ) /* Skip pre-space */ { - if (!my_isalpha(cs,*from)) - continue; - ch=get_scode(from); + if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0) + return &my_empty_string; /* EOL or invalid byte sequence */ + + if (rc == 1 && cs->ctype) + { + /* Single byte letter found */ + if (my_isalpha(cs, *from)) + { + last_ch= get_scode(*from); // Code of the first letter + *to++= soundex_toupper(*from++); // Copy first letter + break; + } + from++; + } + else + { + from+= rc; + if (my_uni_isalpha(wc)) + { + /* Multibyte letter found */ + wc= soundex_toupper(wc); + last_ch= get_scode(wc); // Code of the first letter + if ((rc= cs->cset->wc_mb(cs, wc, (uchar*) to, (uchar*) to_end)) <= 0) + { + /* Extra safety - should not really happen */ + DBUG_ASSERT(false); + return &my_empty_string; + } + to+= rc; + break; + } + } + } + + /* + last_ch is now set to the first 'double-letter' check. + loop on input letters until end of input + */ + for (nchars= 1 ; ; ) + { + if ((rc= cs->cset->mb_wc(cs, &wc, (uchar*) from, (uchar*) end)) <= 0) + break; /* EOL or invalid byte sequence */ + + if (rc == 1 && cs->ctype) + { + if (!my_isalpha(cs, *from++)) + continue; + } + else + { + from+= rc; + if (!my_uni_isalpha(wc)) + continue; + } + + ch= get_scode(wc); if ((ch != '0') && (ch != last_ch)) // if not skipped or double { - *to++ = ch; // letter, copy to output - last_ch = ch; // save code of last input letter - } // for next double-letter check + // letter, copy to output + if ((rc= cs->cset->wc_mb(cs, (my_wc_t) ch, + (uchar*) to, (uchar*) to_end)) <= 0) + { + // Extra safety - should not really happen + DBUG_ASSERT(false); + break; + } + to+= rc; + nchars++; + last_ch= ch; // save code of last input letter + } // for next double-letter check } - for (end=(char*) tmp_value.ptr()+4 ; to < end ; to++) - *to = '0'; - *to=0; // end string + + /* Pad up to 4 characters with DIGIT ZERO, if the string is shorter */ + if (nchars < 4) + { + uint nbytes= (4 - nchars) * cs->mbminlen; + cs->cset->fill(cs, to, nbytes, '0'); + to+= nbytes; + } + tmp_value.length((uint) (to-tmp_value.ptr())); return &tmp_value; } diff --git a/sql/lock.cc b/sql/lock.cc index 2373b62eb0a..4427e57a938 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -582,7 +582,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle, goto end; /* A temporary table does not have locks. */ - if (table->s->tmp_table == TMP_TABLE) + if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE) goto end; /* Get command lock or LOCK TABLES lock. Maybe empty for INSERT DELAYED. */ @@ -607,7 +607,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle, if (haystack->placeholder()) continue; table2= haystack->table; - if (table2->s->tmp_table == TMP_TABLE) + if (table2->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE) continue; /* All tables in list must be in lock. */ @@ -695,7 +695,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, uint system_count= 0; for (i=tables=lock_count=0 ; i < count ; i++) { - if (table_ptr[i]->s->tmp_table != TMP_TABLE) + if (table_ptr[i]->s->tmp_table != NON_TRANSACTIONAL_TMP_TABLE) { tables+=table_ptr[i]->file->lock_count(); lock_count++; @@ -737,7 +737,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count, TABLE *table; enum thr_lock_type lock_type; - if ((table=table_ptr[i])->s->tmp_table == TMP_TABLE) + if ((table=table_ptr[i])->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE) continue; lock_type= table->reginfo.lock_type; if (lock_type >= TL_WRITE_ALLOW_WRITE) diff --git a/sql/log.cc b/sql/log.cc index 4a51c52056d..fe3a4f7df5e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2499,7 +2499,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name, /* Set 'created' to 0, so that in next relay logs this event does not trigger cleaning actions on the slave in - Format_description_log_event::exec_event(). + Format_description_log_event::apply_event_impl(). */ description_event_for_queue->created= 0; /* Don't set log_pos in event header */ @@ -3206,8 +3206,10 @@ void MYSQL_BIN_LOG::new_file_impl(bool need_lock) { tc_log_page_waits++; pthread_mutex_lock(&LOCK_prep_xids); - while (prepared_xids) + while (prepared_xids) { + DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids)); pthread_cond_wait(&COND_prep_xids, &LOCK_prep_xids); + } pthread_mutex_unlock(&LOCK_prep_xids); } @@ -5061,8 +5063,10 @@ void TC_LOG_BINLOG::unlog(ulong cookie, my_xid xid) { pthread_mutex_lock(&LOCK_prep_xids); DBUG_ASSERT(prepared_xids > 0); - if (--prepared_xids == 0) + if (--prepared_xids == 0) { + DBUG_PRINT("info", ("prepared_xids=%lu", prepared_xids)); pthread_cond_signal(&COND_prep_xids); + } pthread_mutex_unlock(&LOCK_prep_xids); rotate_and_purge(0); // as ::write() did not rotate } diff --git a/sql/log_event.cc b/sql/log_event.cc index 8714c60f2c0..e3c94b5e1c9 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -75,8 +75,7 @@ public: ~Write_on_release_cache() { - if (!my_b_copy_to_file(m_cache, m_file)) - reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE); + copy_event_cache_to_file_and_reinit(m_cache, m_file); if (m_flags | FLUSH_F) fflush(m_file); } @@ -88,9 +87,10 @@ public: operator&() DESCRIPTION - Function to return a pointer to the internal, so that the object - can be treated as a IO_CACHE and used with the my_b_* IO_CACHE - functions + + Function to return a pointer to the internal cache, so that the + object can be treated as a IO_CACHE and used with the my_b_* + IO_CACHE functions RETURN VALUE A pointer to the internal IO_CACHE. @@ -305,7 +305,7 @@ static bool write_str(IO_CACHE *file, char *str, uint length) read_str() */ -static inline int read_str(char **buf, char *buf_end, char **str, +static inline int read_str(const char **buf, const char *buf_end, const char **str, uint8 *len) { if (*buf + ((uint) (uchar) **buf) >= buf_end) @@ -420,6 +420,7 @@ const char* Log_event::get_type_str() case DELETE_ROWS_EVENT: return "Delete_rows"; case BEGIN_LOAD_QUERY_EVENT: return "Begin_load_query"; case EXECUTE_LOAD_QUERY_EVENT: return "Execute_load_query"; + case INCIDENT_EVENT: return "Incident"; default: return "Unknown"; /* impossible */ } } @@ -531,25 +532,19 @@ Log_event::Log_event(const char* buf, #ifndef MYSQL_CLIENT #ifdef HAVE_REPLICATION -/* - Log_event::exec_event() -*/ - -int Log_event::exec_event(struct st_relay_log_info* rli) +int Log_event::do_update_pos(RELAY_LOG_INFO *rli) { - DBUG_ENTER("Log_event::exec_event"); - /* - rli is null when (as far as I (Guilhem) know) - the caller is - Load_log_event::exec_event *and* that one is called from - Execute_load_log_event::exec_event. - In this case, we don't do anything here ; - Execute_load_log_event::exec_event will call Log_event::exec_event - again later with the proper rli. - Strictly speaking, if we were sure that rli is null - only in the case discussed above, 'if (rli)' is useless here. - But as we are not 100% sure, keep it for now. + rli is null when (as far as I (Guilhem) know) the caller is + Load_log_event::do_apply_event *and* that one is called from + Execute_load_log_event::do_apply_event. In this case, we don't + do anything here ; Execute_load_log_event::do_apply_event will + call Log_event::do_apply_event again later with the proper rli. + Strictly speaking, if we were sure that rli is null only in the + case discussed above, 'if (rli)' is useless here. But as we are + not 100% sure, keep it for now. + + Matz: I don't think we will need this check with this refactoring. */ if (rli) { @@ -584,18 +579,37 @@ int Log_event::exec_event(struct st_relay_log_info* rli) { rli->inc_group_relay_log_pos(log_pos); flush_relay_log_info(rli); - /* - Note that Rotate_log_event::exec_event() does not call this - function, so there is no chance that a fake rotate event resets - last_master_timestamp. - Note that we update without mutex (probably ok - except in some very - rare cases, only consequence is that value may take some time to - display in Seconds_Behind_Master - not critical). + /* + Note that Rotate_log_event::do_apply_event() does not call + this function, so there is no chance that a fake rotate event + resets last_master_timestamp. Note that we update without + mutex (probably ok - except in some very rare cases, only + consequence is that value may take some time to display in + Seconds_Behind_Master - not critical). */ rli->last_master_timestamp= when; } } - DBUG_RETURN(0); + + return 0; // Cannot fail currently +} + + +Log_event::enum_skip_reason +Log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + DBUG_PRINT("info", ("ev->server_id=%lu, ::server_id=%lu," + " rli->replicate_same_server_id=%d," + " rli->slave_skip_counter=%d", + (ulong) server_id, (ulong) ::server_id, + rli->replicate_same_server_id, + rli->slave_skip_counter)); + if (server_id == ::server_id && !rli->replicate_same_server_id) + return EVENT_SKIP_IGNORE; + else if (rli->slave_skip_counter > 0) + return EVENT_SKIP_COUNT; + else + return EVENT_SKIP_NOT; } @@ -743,7 +757,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, ulong data_len; int result=0; char buf[LOG_EVENT_MINIMAL_HEADER_LEN]; - DBUG_ENTER("read_log_event"); + DBUG_ENTER("Log_event::read_log_event"); if (log_lock) pthread_mutex_lock(log_lock); @@ -818,7 +832,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, const Format_description_log_event *description_event) #endif { - DBUG_ENTER("Log_event::read_log_event(IO_CACHE *, Format_description_log_event *"); + DBUG_ENTER("Log_event::read_log_event"); DBUG_ASSERT(description_event != 0); char head[LOG_EVENT_MINIMAL_HEADER_LEN]; /* @@ -998,10 +1012,14 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len, ev = new Begin_load_query_log_event(buf, event_len, description_event); break; case EXECUTE_LOAD_QUERY_EVENT: - ev = new Execute_load_query_log_event(buf, event_len, description_event); + ev= new Execute_load_query_log_event(buf, event_len, description_event); + break; + case INCIDENT_EVENT: + ev = new Incident_log_event(buf, event_len, description_event); break; default: - DBUG_PRINT("error",("Unknown evernt code: %d",(int) buf[EVENT_TYPE_OFFSET])); + DBUG_PRINT("error",("Unknown event code: %d", + (int) buf[EVENT_TYPE_OFFSET])); ev= NULL; break; } @@ -1888,27 +1906,28 @@ void Query_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) /* - Query_log_event::exec_event() + Query_log_event::do_apply_event() */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Query_log_event::exec_event(struct st_relay_log_info* rli) +int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { - return exec_event(rli, query, q_len); + return do_apply_event(rli, query, q_len); } -int Query_log_event::exec_event(struct st_relay_log_info* rli, - const char *query_arg, uint32 q_len_arg) +int Query_log_event::do_apply_event(RELAY_LOG_INFO const *rli, + const char *query_arg, uint32 q_len_arg) { LEX_STRING new_db; int expected_error,actual_error= 0; /* - Colleagues: please never free(thd->catalog) in MySQL. This would lead to - bugs as here thd->catalog is a part of an alloced block, not an entire - alloced block (see Query_log_event::exec_event()). Same for thd->db. - Thank you. + Colleagues: please never free(thd->catalog) in MySQL. This would + lead to bugs as here thd->catalog is a part of an alloced block, + not an entire alloced block (see + Query_log_event::do_apply_event()). Same for thd->db. Thank + you. */ thd->catalog= catalog_len ? (char *) catalog : (char *)""; new_db.length= db_len; @@ -1927,11 +1946,11 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, END of the current log event (COMMIT). We save it in rli so that InnoDB can access it. */ - rli->future_group_master_log_pos= log_pos; + const_cast(rli)->future_group_master_log_pos= log_pos; DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); - clear_all_errors(thd, rli); - rli->clear_tables_to_lock(); + clear_all_errors(thd, const_cast(rli)); + const_cast(rli)->clear_tables_to_lock(); /* Note: We do not need to execute reset_one_shot_variables() if this @@ -1940,8 +1959,8 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, its companion query. If the SET is ignored because of db_ok(), the companion query will also be ignored, and if the companion query is ignored in the db_ok() test of - ::exec_event(), then the companion SET also have so we - don't need to reset_one_shot_variables(). + ::do_apply_event(), then the companion SET also have so + we don't need to reset_one_shot_variables(). */ if (rpl_filter->db_ok(thd->db)) { @@ -2056,7 +2075,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli, to check/fix it. */ if (mysql_test_parse_for_slave(thd, thd->query, thd->query_length)) - clear_all_errors(thd, rli); /* Can ignore query */ + clear_all_errors(thd, const_cast(rli)); /* Can ignore query */ else { slave_print_msg(ERROR_LEVEL, rli, expected_error, @@ -2107,7 +2126,7 @@ Default database: '%s'. Query: '%s'", ignored_error_code(actual_error)) { DBUG_PRINT("info",("error ignored")); - clear_all_errors(thd, rli); + clear_all_errors(thd, const_cast(rli)); } /* Other cases: mostly we expected no error and get one. @@ -2174,16 +2193,26 @@ end: thd->first_successful_insert_id_in_prev_stmt= 0; thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); - /* - If there was an error we stop. Otherwise we increment positions. Note that - we will not increment group* positions if we are just after a SET - ONE_SHOT, because SET ONE_SHOT should not be separated from its following - updating query. - */ - return (thd->query_error ? thd->query_error : - (thd->one_shot_set ? (rli->inc_event_relay_log_pos(),0) : - Log_event::exec_event(rli))); + return thd->query_error; } + +int Query_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ + /* + Note that we will not increment group* positions if we are just + after a SET ONE_SHOT, because SET ONE_SHOT should not be separated + from its following updating query. + */ + if (thd->one_shot_set) + { + rli->inc_event_relay_log_pos(); + return 0; + } + else + return Log_event::do_update_pos(rli); +} + + #endif @@ -2312,7 +2341,7 @@ bool Start_log_event_v3::write(IO_CACHE* file) /* - Start_log_event_v3::exec_event() + Start_log_event_v3::do_apply_event() The master started @@ -2331,9 +2360,9 @@ bool Start_log_event_v3::write(IO_CACHE* file) */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Start_log_event_v3::exec_event(struct st_relay_log_info* rli) +int Start_log_event_v3::do_apply_event(RELAY_LOG_INFO const *rli) { - DBUG_ENTER("Start_log_event_v3::exec_event"); + DBUG_ENTER("Start_log_event_v3::do_apply_event"); switch (binlog_version) { case 3: @@ -2375,7 +2404,7 @@ int Start_log_event_v3::exec_event(struct st_relay_log_info* rli) /* this case is impossible */ DBUG_RETURN(1); } - DBUG_RETURN(Log_event::exec_event(rli)); + DBUG_RETURN(0); } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -2456,6 +2485,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[DELETE_ROWS_EVENT-1]= 6;); post_header_len[BEGIN_LOAD_QUERY_EVENT-1]= post_header_len[APPEND_BLOCK_EVENT-1]; post_header_len[EXECUTE_LOAD_QUERY_EVENT-1]= EXECUTE_LOAD_QUERY_HEADER_LEN; + post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN; } break; @@ -2566,24 +2596,10 @@ bool Format_description_log_event::write(IO_CACHE* file) } #endif -/* - SYNOPSIS - Format_description_log_event::exec_event() - - IMPLEMENTATION - Save the information which describes the binlog's format, to be able to - read all coming events. - Call Start_log_event_v3::exec_event(). -*/ - #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Format_description_log_event::exec_event(struct st_relay_log_info* rli) +int Format_description_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { - DBUG_ENTER("Format_description_log_event::exec_event"); - - /* save the information describing this binlog */ - delete rli->relay_log.description_event_for_exec; - rli->relay_log.description_event_for_exec= this; + DBUG_ENTER("Format_description_log_event::do_apply_event"); #ifdef USING_TRANSACTIONS /* @@ -2605,14 +2621,36 @@ int Format_description_log_event::exec_event(struct st_relay_log_info* rli) "or ROLLBACK in relay log). A probable cause is that " "the master died while writing the transaction to " "its binary log, thus rolled back too."); - rli->cleanup_context(thd, 1); + const_cast(rli)->cleanup_context(thd, 1); } #endif /* - If this event comes from ourselves, there is no cleaning task to perform, - we don't call Start_log_event_v3::exec_event() (this was just to update the - log's description event). + If this event comes from ourselves, there is no cleaning task to + perform, we don't call Start_log_event_v3::do_apply_event() + (this was just to update the log's description event). */ + if (server_id != (uint32) ::server_id) + { + /* + If the event was not requested by the slave i.e. the master sent + it while the slave asked for a position >4, the event will make + rli->group_master_log_pos advance. Say that the slave asked for + position 1000, and the Format_desc event's end is 96. Then in + the beginning of replication rli->group_master_log_pos will be + 0, then 96, then jump to first really asked event (which is + >96). So this is ok. + */ + DBUG_RETURN(Start_log_event_v3::do_apply_event(rli)); + } + DBUG_RETURN(0); +} + +int Format_description_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ + /* save the information describing this binlog */ + delete rli->relay_log.description_event_for_exec; + rli->relay_log.description_event_for_exec= this; + if (server_id == (uint32) ::server_id) { /* @@ -2629,19 +2667,20 @@ int Format_description_log_event::exec_event(struct st_relay_log_info* rli) the Intvar_log_event respectively. */ rli->inc_event_relay_log_pos(); - DBUG_RETURN(0); + return 0; + } + else + { + return Log_event::do_update_pos(rli); } - - /* - If the event was not requested by the slave i.e. the master sent it while - the slave asked for a position >4, the event will make - rli->group_master_log_pos advance. Say that the slave asked for position - 1000, and the Format_desc event's end is 96. Then in the beginning of - replication rli->group_master_log_pos will be 0, then 96, then jump to - first really asked event (which is >96). So this is ok. - */ - DBUG_RETURN(Start_log_event_v3::exec_event(rli)); } + +Log_event::enum_skip_reason +Format_description_log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + return Log_event::EVENT_SKIP_NOT; +} + #endif @@ -3155,30 +3194,32 @@ void Load_log_event::set_fields(const char* affected_db, Does the data loading job when executing a LOAD DATA on the slave SYNOPSIS - Load_log_event::exec_event - net - rli - use_rli_only_for_errors - if set to 1, rli is provided to - Load_log_event::exec_event only for this - function to have RPL_LOG_NAME and - rli->last_slave_error, both being used by - error reports. rli's position advancing - is skipped (done by the caller which is - Execute_load_log_event::exec_event). - - if set to 0, rli is provided for full use, - i.e. for error reports and position - advancing. + Load_log_event::do_apply_event + net + rli + use_rli_only_for_errors - if set to 1, rli is provided to + Load_log_event::do_apply_event + only for this function to have + RPL_LOG_NAME and + rli->last_slave_error, both being + used by error reports. rli's + position advancing is skipped (done + by the caller which is + Execute_load_log_event::do_apply_event). + - if set to 0, rli is provided for + full use, i.e. for error reports and + position advancing. DESCRIPTION Does the data loading job when executing a LOAD DATA on the slave - + RETURN VALUE - 0 Success + 0 Success 1 Failure */ -int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, - bool use_rli_only_for_errors) +int Load_log_event::do_apply_event(NET* net, RELAY_LOG_INFO const *rli, + bool use_rli_only_for_errors) { LEX_STRING new_db; new_db.length= db_len; @@ -3187,9 +3228,9 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, DBUG_ASSERT(thd->query == 0); thd->query_length= 0; // Should not be needed thd->query_error= 0; - clear_all_errors(thd, rli); + clear_all_errors(thd, const_cast(rli)); - /* see Query_log_event::exec_event() and BUG#13360 */ + /* see Query_log_event::do_apply_event() and BUG#13360 */ DBUG_ASSERT(!rli->m_table_map.count()); /* Usually mysql_init_query() is called by mysql_parse(), but we need it here @@ -3198,22 +3239,26 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, mysql_init_query(thd, 0, 0); if (!use_rli_only_for_errors) { - /* Saved for InnoDB, see comment in Query_log_event::exec_event() */ - rli->future_group_master_log_pos= log_pos; + /* + Saved for InnoDB, see comment in + Query_log_event::do_apply_event() + */ + const_cast(rli)->future_group_master_log_pos= log_pos; DBUG_PRINT("info", ("log_pos: %lu", (ulong) log_pos)); } /* - We test replicate_*_db rules. Note that we have already prepared the file - to load, even if we are going to ignore and delete it now. So it is - possible that we did a lot of disk writes for nothing. In other words, a - big LOAD DATA INFILE on the master will still consume a lot of space on - the slave (space in the relay log + space of temp files: twice the space - of the file to load...) even if it will finally be ignored. - TODO: fix this; this can be done by testing rules in - Create_file_log_event::exec_event() and then discarding Append_block and - al. Another way is do the filtering in the I/O thread (more efficient: no - disk writes at all). + We test replicate_*_db rules. Note that we have already prepared + the file to load, even if we are going to ignore and delete it + now. So it is possible that we did a lot of disk writes for + nothing. In other words, a big LOAD DATA INFILE on the master will + still consume a lot of space on the slave (space in the relay log + + space of temp files: twice the space of the file to load...) + even if it will finally be ignored. TODO: fix this; this can be + done by testing rules in Create_file_log_event::do_apply_event() + and then discarding Append_block and al. Another way is do the + filtering in the I/O thread (more efficient: no disk writes at + all). Note: We do not need to execute reset_one_shot_variables() if this @@ -3222,8 +3267,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, its companion query. If the SET is ignored because of db_ok(), the companion query will also be ignored, and if the companion query is ignored in the db_ok() test of - ::exec_event(), then the companion SET also have so we - don't need to reset_one_shot_variables(). + ::do_apply_event(), then the companion SET also have so + we don't need to reset_one_shot_variables(). */ if (rpl_filter->db_ok(thd->db)) { @@ -3419,7 +3464,7 @@ Fatal error running LOAD DATA INFILE on table '%s'. Default database: '%s'", return 1; } - return ( use_rli_only_for_errors ? 0 : Log_event::exec_event(rli) ); + return ( use_rli_only_for_errors ? 0 : Log_event::do_apply_event(rli) ); } #endif @@ -3513,6 +3558,7 @@ Rotate_log_event::Rotate_log_event(const char* buf, uint event_len, ident_offset = post_header_len; set_if_smaller(ident_len,FN_REFLEN-1); new_log_ident= my_strndup(buf + ident_offset, (uint) ident_len, MYF(MY_WME)); + DBUG_PRINT("debug", ("new_log_ident: '%s'", new_log_ident)); DBUG_VOID_RETURN; } @@ -3532,8 +3578,20 @@ bool Rotate_log_event::write(IO_CACHE* file) } #endif +/** + Helper function to detect if the event is inside a group. + */ +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) +static bool is_in_group(THD *const thd, RELAY_LOG_INFO *const rli) +{ + return (thd->options & OPTION_BEGIN) != 0 || + (rli->last_event_start_time > 0); +} +#endif + + /* - Rotate_log_event::exec_event() + Rotate_log_event::do_apply_event() Got a rotate log event from the master @@ -3550,34 +3608,49 @@ bool Rotate_log_event::write(IO_CACHE* file) */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Rotate_log_event::exec_event(struct st_relay_log_info* rli) +int Rotate_log_event::do_update_pos(RELAY_LOG_INFO *rli) { - DBUG_ENTER("Rotate_log_event::exec_event"); + DBUG_ENTER("Rotate_log_event::do_update_pos"); +#ifndef DBUG_OFF + char buf[32]; +#endif + + DBUG_PRINT("info", ("server_id=%lu; ::server_id=%lu", + (ulong) this->server_id, (ulong) ::server_id)); + DBUG_PRINT("info", ("new_log_ident: %s", this->new_log_ident)); + DBUG_PRINT("info", ("pos: %s", llstr(this->pos, buf))); pthread_mutex_lock(&rli->data_lock); rli->event_relay_log_pos= my_b_tell(rli->cur_log); /* - If we are in a transaction: the only normal case is when the I/O thread was - copying a big transaction, then it was stopped and restarted: we have this - in the relay log: + If we are in a transaction or in a group: the only normal case is + when the I/O thread was copying a big transaction, then it was + stopped and restarted: we have this in the relay log: + BEGIN ... ROTATE (a fake one) ... COMMIT or ROLLBACK - In that case, we don't want to touch the coordinates which correspond to - the beginning of the transaction. - Starting from 5.0.0, there also are some rotates from the slave itself, in - the relay log. + + In that case, we don't want to touch the coordinates which + correspond to the beginning of the transaction. Starting from + 5.0.0, there also are some rotates from the slave itself, in the + relay log, which shall not change the group positions. */ - if (!(thd->options & OPTION_BEGIN)) + if ((server_id != ::server_id || rli->replicate_same_server_id) && + !is_in_group(thd, rli)) { + DBUG_PRINT("info", ("old group_master_log_name: '%s' " + "old group_master_log_pos: %lu", + rli->group_master_log_name, + (ulong) rli->group_master_log_pos)); memcpy(rli->group_master_log_name, new_log_ident, ident_len+1); rli->notify_group_master_log_name_update(); rli->group_master_log_pos= pos; rli->group_relay_log_pos= rli->event_relay_log_pos; - DBUG_PRINT("info", ("group_master_log_name: '%s' " - "group_master_log_pos: %lu", + DBUG_PRINT("info", ("new group_master_log_name: '%s' " + "new group_master_log_pos: %lu", rli->group_master_log_name, (ulong) rli->group_master_log_pos)); /* @@ -3596,8 +3669,28 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) pthread_mutex_unlock(&rli->data_lock); pthread_cond_broadcast(&rli->data_cond); flush_relay_log_info(rli); + DBUG_RETURN(0); } + + +Log_event::enum_skip_reason +Rotate_log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + enum_skip_reason reason= Log_event::do_shall_skip(rli); + + switch (reason) { + case Log_event::EVENT_SKIP_NOT: + case Log_event::EVENT_SKIP_COUNT: + return Log_event::EVENT_SKIP_NOT; + + case Log_event::EVENT_SKIP_IGNORE: + return Log_event::EVENT_SKIP_IGNORE; + } + DBUG_ASSERT(0); + return Log_event::EVENT_SKIP_NOT; // To keep compiler happy +} + #endif @@ -3704,11 +3797,11 @@ void Intvar_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) /* - Intvar_log_event::exec_event() + Intvar_log_event::do_apply_event() */ #if defined(HAVE_REPLICATION)&& !defined(MYSQL_CLIENT) -int Intvar_log_event::exec_event(struct st_relay_log_info* rli) +int Intvar_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { switch (type) { case LAST_INSERT_ID_EVENT: @@ -3719,9 +3812,33 @@ int Intvar_log_event::exec_event(struct st_relay_log_info* rli) thd->force_one_auto_inc_interval(val); break; } + return 0; +} + +int Intvar_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ rli->inc_event_relay_log_pos(); return 0; } + + +Log_event::enum_skip_reason +Intvar_log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + /* + It is a common error to set the slave skip counter to 1 instead of + 2 when recovering from an insert which used a auto increment, + rand, or user var. Therefore, if the slave skip counter is 1, we + just say that this event should be skipped by ignoring it, meaning + that we do not change the value of the slave skip counter since it + will be decreased by the following insert event. + */ + if (rli->slave_skip_counter == 1) + return Log_event::EVENT_SKIP_IGNORE; + else + return Log_event::do_shall_skip(rli); +} + #endif @@ -3784,13 +3901,37 @@ void Rand_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Rand_log_event::exec_event(struct st_relay_log_info* rli) +int Rand_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { thd->rand.seed1= (ulong) seed1; thd->rand.seed2= (ulong) seed2; + return 0; +} + +int Rand_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ rli->inc_event_relay_log_pos(); return 0; } + + +Log_event::enum_skip_reason +Rand_log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + /* + It is a common error to set the slave skip counter to 1 instead of + 2 when recovering from an insert which used a auto increment, + rand, or user var. Therefore, if the slave skip counter is 1, we + just say that this event should be skipped by ignoring it, meaning + that we do not change the value of the slave skip counter since it + will be decreased by the following insert event. + */ + if (rli->slave_skip_counter == 1) + return Log_event::EVENT_SKIP_IGNORE; + else + return Log_event::do_shall_skip(rli); +} + #endif /* !MYSQL_CLIENT */ @@ -3857,12 +3998,12 @@ void Xid_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Xid_log_event::exec_event(struct st_relay_log_info* rli) +int Xid_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { /* For a slave Xid_log_event is COMMIT */ general_log_print(thd, COM_QUERY, "COMMIT /* implicit, from Xid_log_event */"); - return end_trans(thd, COMMIT) || Log_event::exec_event(rli); + return end_trans(thd, COMMIT); } #endif /* !MYSQL_CLIENT */ @@ -4140,11 +4281,11 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) /* - User_var_log_event::exec_event() + User_var_log_event::do_apply_event() */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int User_var_log_event::exec_event(struct st_relay_log_info* rli) +int User_var_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { Item *it= 0; CHARSET_INFO *charset; @@ -4206,9 +4347,31 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) e.update_hash(val, val_len, type, charset, DERIVATION_IMPLICIT, 0); free_root(thd->mem_root,0); + return 0; +} + +int User_var_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ rli->inc_event_relay_log_pos(); return 0; } + +Log_event::enum_skip_reason +User_var_log_event::do_shall_skip(RELAY_LOG_INFO *rli) +{ + /* + It is a common error to set the slave skip counter to 1 instead + of 2 when recovering from an insert which used a auto increment, + rand, or user var. Therefore, if the slave skip counter is 1, we + just say that this event should be skipped by ignoring it, meaning + that we do not change the value of the slave skip counter since it + will be decreased by the following insert event. + */ + if (rli->slave_skip_counter == 1) + return Log_event::EVENT_SKIP_IGNORE; + else + return Log_event::do_shall_skip(rli); +} #endif /* !MYSQL_CLIENT */ @@ -4248,7 +4411,7 @@ void Slave_log_event::pack_info(Protocol *protocol) #ifndef MYSQL_CLIENT Slave_log_event::Slave_log_event(THD* thd_arg, - struct st_relay_log_info* rli) + RELAY_LOG_INFO* rli) :Log_event(thd_arg, 0, 0) , mem_pool(0), master_host(0) { DBUG_ENTER("Slave_log_event"); @@ -4358,11 +4521,11 @@ Slave_log_event::Slave_log_event(const char* buf, uint event_len) #ifndef MYSQL_CLIENT -int Slave_log_event::exec_event(struct st_relay_log_info* rli) +int Slave_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { if (mysql_bin_log.is_open()) mysql_bin_log.write(this); - return Log_event::exec_event(rli); + return 0; } #endif /* !MYSQL_CLIENT */ @@ -4391,21 +4554,21 @@ void Stop_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) /* - Stop_log_event::exec_event() + Stop_log_event::do_apply_event() - The master stopped. - We used to clean up all temporary tables but this is useless as, as the - master has shut down properly, it has written all DROP TEMPORARY TABLE - (prepared statements' deletion is TODO only when we binlog prep stmts). - We used to clean up slave_load_tmpdir, but this is useless as it has been - cleared at the end of LOAD DATA INFILE. - So we have nothing to do here. - The place were we must do this cleaning is in Start_log_event_v3::exec_event(), - not here. Because if we come here, the master was sane. + The master stopped. We used to clean up all temporary tables but + this is useless as, as the master has shut down properly, it has + written all DROP TEMPORARY TABLE (prepared statements' deletion is + TODO only when we binlog prep stmts). We used to clean up + slave_load_tmpdir, but this is useless as it has been cleared at the + end of LOAD DATA INFILE. So we have nothing to do here. The place + were we must do this cleaning is in + Start_log_event_v3::do_apply_event(), not here. Because if we come + here, the master was sane. */ #ifndef MYSQL_CLIENT -int Stop_log_event::exec_event(struct st_relay_log_info* rli) +int Stop_log_event::do_update_pos(RELAY_LOG_INFO *rli) { /* We do not want to update master_log pos because we get a rotate event @@ -4423,6 +4586,7 @@ int Stop_log_event::exec_event(struct st_relay_log_info* rli) } return 0; } + #endif /* !MYSQL_CLIENT */ #endif /* HAVE_REPLICATION */ @@ -4613,11 +4777,11 @@ void Create_file_log_event::pack_info(Protocol *protocol) /* - Create_file_log_event::exec_event() + Create_file_log_event::do_apply_event() */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Create_file_log_event::exec_event(struct st_relay_log_info* rli) +int Create_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { char proc_info[17+FN_REFLEN+10], *fname_buf; char *ext; @@ -4679,7 +4843,7 @@ err: if (fd >= 0) my_close(fd, MYF(0)); thd->proc_info= 0; - return error ? 1 : Log_event::exec_event(rli); + return error == 0; } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -4787,15 +4951,15 @@ int Append_block_log_event::get_create_or_append() const } /* - Append_block_log_event::exec_event() + Append_block_log_event::do_apply_event() */ -int Append_block_log_event::exec_event(struct st_relay_log_info* rli) +int Append_block_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { char proc_info[17+FN_REFLEN+10], *fname= proc_info+17; int fd; int error = 1; - DBUG_ENTER("Append_block_log_event::exec_event"); + DBUG_ENTER("Append_block_log_event::do_apply_event"); fname= strmov(proc_info, "Making temp file "); slave_load_file_stem(fname, file_id, server_id, ".data"); @@ -4834,7 +4998,7 @@ err: if (fd >= 0) my_close(fd, MYF(0)); thd->proc_info= 0; - DBUG_RETURN(error ? error : Log_event::exec_event(rli)); + DBUG_RETURN(error); } #endif @@ -4918,18 +5082,18 @@ void Delete_file_log_event::pack_info(Protocol *protocol) #endif /* - Delete_file_log_event::exec_event() + Delete_file_log_event::do_apply_event() */ #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) -int Delete_file_log_event::exec_event(struct st_relay_log_info* rli) +int Delete_file_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { char fname[FN_REFLEN+10]; char *ext= slave_load_file_stem(fname, file_id, server_id, ".data"); (void) my_delete(fname, MYF(MY_WME)); strmov(ext, ".info"); (void) my_delete(fname, MYF(MY_WME)); - return Log_event::exec_event(rli); + return 0; } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -5015,10 +5179,10 @@ void Execute_load_log_event::pack_info(Protocol *protocol) /* - Execute_load_log_event::exec_event() + Execute_load_log_event::do_apply_event() */ -int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) +int Execute_load_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { char fname[FN_REFLEN+10]; char *ext; @@ -5049,14 +5213,15 @@ int Execute_load_log_event::exec_event(struct st_relay_log_info* rli) lev->thd = thd; /* - lev->exec_event should use rli only for errors - i.e. should not advance rli's position. - lev->exec_event is the place where the table is loaded (it calls - mysql_load()). + lev->do_apply_event should use rli only for errors i.e. should + not advance rli's position. + + lev->do_apply_event is the place where the table is loaded (it + calls mysql_load()). */ - rli->future_group_master_log_pos= log_pos; - if (lev->exec_event(0,rli,1)) + const_cast(rli)->future_group_master_log_pos= log_pos; + if (lev->do_apply_event(0,rli,1)) { /* We want to indicate the name of the file that could not be loaded @@ -5099,7 +5264,7 @@ err: my_close(fd, MYF(0)); end_io_cache(&file); } - return error ? error : Log_event::exec_event(rli); + return error; } #endif /* defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) */ @@ -5267,7 +5432,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol) int -Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli) +Execute_load_query_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { char *p; char *buf; @@ -5304,7 +5469,7 @@ Execute_load_query_log_event::exec_event(struct st_relay_log_info* rli) p= strmake(p, STRING_WITH_LEN(" INTO")); p= strmake(p, query+fn_pos_end, q_len-fn_pos_end); - error= Query_log_event::exec_event(rli, buf, p-buf); + error= Query_log_event::do_apply_event(rli, buf, p-buf); /* Forging file name for deletion in same buffer */ *fname_end= 0; @@ -5360,7 +5525,7 @@ bool sql_ex_info::write_data(IO_CACHE* file) sql_ex_info::init() */ -char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format) +char *sql_ex_info::init(char *buf, char *buf_end, bool use_new_format) { cached_new_format = use_new_format; if (use_new_format) @@ -5373,11 +5538,12 @@ char* sql_ex_info::init(char* buf,char* buf_end,bool use_new_format) the case when we have old format because we will be reusing net buffer to read the actual file before we write out the Create_file event. */ - if (read_str(&buf, buf_end, &field_term, &field_term_len) || - read_str(&buf, buf_end, &enclosed, &enclosed_len) || - read_str(&buf, buf_end, &line_term, &line_term_len) || - read_str(&buf, buf_end, &line_start, &line_start_len) || - read_str(&buf, buf_end, &escaped, &escaped_len)) + const char *ptr= buf; + if (read_str(&ptr, buf_end, (const char **) &field_term, &field_term_len) || + read_str(&ptr, buf_end, (const char **) &enclosed, &enclosed_len) || + read_str(&ptr, buf_end, (const char **) &line_term, &line_term_len) || + read_str(&ptr, buf_end, (const char **) &line_start, &line_start_len) || + read_str(&ptr, buf_end, (const char **) &escaped, &escaped_len)) return 0; opt_flags = *buf++; } @@ -5445,7 +5611,10 @@ Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid, memcpy(m_cols.bitmap, cols->bitmap, no_bytes_in_map(cols)); } else - m_cols.bitmap= 0; // to not free it + { + // Needed because bitmap_init() does not set it to null on failure + m_cols.bitmap= 0; + } } #endif @@ -5482,14 +5651,57 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, m_flags= uint2korr(post_start); - byte const *const var_start= (const byte *)buf + common_header_len + - post_header_len; + byte const *const var_start= + (const byte *)buf + common_header_len + post_header_len; byte const *const ptr_width= var_start; uchar *ptr_after_width= (uchar*) ptr_width; + DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); m_width = net_field_length(&ptr_after_width); + DBUG_PRINT("debug", ("m_width=%lu", m_width)); + /* if bitmap_init fails, catched in is_valid() */ + if (likely(!bitmap_init(&m_cols, + m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, + (m_width + 7) & ~7UL, + false))) + { + DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); + memcpy(m_cols.bitmap, ptr_after_width, (m_width + 7) / 8); + ptr_after_width+= (m_width + 7) / 8; + DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols)); + } + else + { + // Needed because bitmap_init() does not set it to null on failure + m_cols.bitmap= NULL; + DBUG_VOID_RETURN; + } - const uint byte_count= (m_width + 7) / 8; - const byte* const ptr_rows_data= var_start + byte_count + 1; + m_cols_ai.bitmap= m_cols.bitmap; /* See explanation in is_valid() */ + + if (event_type == UPDATE_ROWS_EVENT) + { + DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); + + /* if bitmap_init fails, catched in is_valid() */ + if (likely(!bitmap_init(&m_cols_ai, + m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL, + (m_width + 7) & ~7UL, + false))) + { + DBUG_PRINT("debug", ("Reading from %p", ptr_after_width)); + memcpy(m_cols_ai.bitmap, ptr_after_width, (m_width + 7) / 8); + ptr_after_width+= (m_width + 7) / 8; + DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); + } + else + { + // Needed because bitmap_init() does not set it to null on failure + m_cols_ai.bitmap= 0; + DBUG_VOID_RETURN; + } + } + + const byte* const ptr_rows_data= (const byte*) ptr_after_width; my_size_t const data_size= event_len - (ptr_rows_data - (const byte *) buf); DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu", @@ -5498,12 +5710,6 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, m_rows_buf= (byte*)my_malloc(data_size, MYF(MY_WME)); if (likely((bool)m_rows_buf)) { - /* if bitmap_init fails, catched in is_valid() */ - if (likely(!bitmap_init(&m_cols, - m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, - (m_width + 7) & ~7UL, - false))) - memcpy(m_cols.bitmap, ptr_after_width, byte_count); m_rows_end= m_rows_buf + data_size; m_rows_cur= m_rows_end; memcpy(m_rows_buf, ptr_rows_data, data_size); @@ -5522,6 +5728,29 @@ Rows_log_event::~Rows_log_event() my_free((gptr)m_rows_buf, MYF(MY_ALLOW_ZERO_PTR)); } +int Rows_log_event::get_data_size() +{ + int const type_code= get_type_code(); + + char buf[sizeof(m_width)+1]; + char *end= net_store_length(buf, (m_width + 7) / 8); + + DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", + return 6 + no_bytes_in_map(&m_cols) + (end - buf) + + (type_code == UPDATE_ROWS_EVENT ? no_bytes_in_map(&m_cols_ai) : 0) + + (m_rows_cur - m_rows_buf);); + int data_size= ROWS_HEADER_LEN; + data_size+= no_bytes_in_map(&m_cols); + data_size+= end - buf; + + if (type_code == UPDATE_ROWS_EVENT) + data_size+= no_bytes_in_map(&m_cols_ai); + + data_size+= (m_rows_cur - m_rows_buf); + return data_size; +} + + #ifndef MYSQL_CLIENT int Rows_log_event::do_add_row_data(byte *const row_data, my_size_t const length) @@ -5595,10 +5824,10 @@ int Rows_log_event::do_add_row_data(byte *const row_data, row_end Pointer to variable that will hold the value of the one-after-end position for the row master_reclength - Pointer to variable that will be set to the length of the - record on the master side - rw_set Pointer to bitmap that holds either the read_set or the - write_set of the table + Pointer to variable that will be set to the length of the + record on the master side + rw_set Pointer to bitmap that holds either the read_set or the + write_set of the table DESCRIPTION @@ -5624,70 +5853,80 @@ int Rows_log_event::do_add_row_data(byte *const row_data, the master does not have a default value (and isn't nullable) */ static int -unpack_row(RELAY_LOG_INFO *rli, +unpack_row(RELAY_LOG_INFO const *rli, TABLE *table, uint const colcnt, - char const *row, MY_BITMAP const *cols, - char const **row_end, ulong *master_reclength, + char const *const row_data, MY_BITMAP const *cols, + char const **const row_end, ulong *const master_reclength, MY_BITMAP* const rw_set, Log_event_type const event_type) { - byte *const record= table->record[0]; DBUG_ENTER("unpack_row"); - DBUG_ASSERT(record && row); - DBUG_PRINT("enter", ("row: 0x%lx table->record[0]: 0x%lx", (long) row, (long) record)); - my_size_t master_null_bytes= table->s->null_bytes; - - if (colcnt != table->s->fields) - { - Field **fptr= &table->field[colcnt-1]; - do - master_null_bytes= (*fptr)->last_null_byte(); - while (master_null_bytes == Field::LAST_NULL_BYTE_UNDEF && - fptr-- > table->field); - - /* - If master_null_bytes is LAST_NULL_BYTE_UNDEF (0) at this time, - there were no nullable fields nor BIT fields at all in the - columns that are common to the master and the slave. In that - case, there is only one null byte holding the X bit. - - OBSERVE! There might still be nullable columns following the - common columns, so table->s->null_bytes might be greater than 1. - */ - if (master_null_bytes == Field::LAST_NULL_BYTE_UNDEF) - master_null_bytes= 1; - } - - DBUG_ASSERT(master_null_bytes <= table->s->null_bytes); - memcpy(record, row, master_null_bytes); // [1] + DBUG_ASSERT(row_data); + my_size_t const master_null_byte_count= (bitmap_bits_set(cols) + 7) / 8; int error= 0; - bitmap_set_all(rw_set); + char const *null_ptr= row_data; + char const *pack_ptr= row_data + master_null_byte_count; + + bitmap_clear_all(rw_set); + + empty_record(table); Field **const begin_ptr = table->field; Field **field_ptr; - char const *ptr= row + master_null_bytes; Field **const end_ptr= begin_ptr + colcnt; + + DBUG_ASSERT(null_ptr < row_data + master_null_byte_count); + + // Mask to mask out the correct bit among the null bits + unsigned int null_mask= 1U; + // The "current" null bits + unsigned int null_bits= *null_ptr++; for (field_ptr= begin_ptr ; field_ptr < end_ptr ; ++field_ptr) { Field *const f= *field_ptr; + /* + No need to bother about columns that does not exist: they have + gotten default values when being emptied above. + */ if (bitmap_is_set(cols, field_ptr - begin_ptr)) { - DBUG_ASSERT((const char *)table->record[0] <= f->ptr); - DBUG_ASSERT(f->ptr < (char*)(table->record[0] + table->s->reclength + - (f->pack_length_in_rec() == 0))); + if ((null_mask & 0xFF) == 0) + { + DBUG_ASSERT(null_ptr < row_data + master_null_byte_count); + null_mask= 1U; + null_bits= *null_ptr++; + } + + DBUG_ASSERT(null_mask & 0xFF); // One of the 8 LSB should be set - DBUG_PRINT("info", ("unpacking column '%s' to 0x%lx", f->field_name, - (long) f->ptr)); - ptr= f->unpack(f->ptr, ptr); /* Field...::unpack() cannot return 0 */ - DBUG_ASSERT(ptr != NULL); + DBUG_ASSERT(pack_ptr != NULL); + + if ((null_bits & null_mask) && f->maybe_null()) + f->set_null(); + else + { + f->set_notnull(); + + /* + We only unpack the field if it was non-null + */ + pack_ptr= f->unpack(f->ptr, pack_ptr); + } + + bitmap_set_bit(rw_set, f->field_index); + null_mask <<= 1; } - else - bitmap_clear_bit(rw_set, field_ptr - begin_ptr); } - *row_end = ptr; + /* + We should now have read all the null bytes, otherwise something is + really wrong. + */ + DBUG_ASSERT(null_ptr == row_data + master_null_byte_count); + + *row_end = pack_ptr; if (master_reclength) { if (*field_ptr) @@ -5712,9 +5951,8 @@ unpack_row(RELAY_LOG_INFO *rli, uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG; Field *const f= *field_ptr; - DBUG_PRINT("info", ("processing column '%s' @ 0x%lx", f->field_name, - (long) f->ptr)); - if (event_type == WRITE_ROWS_EVENT && (f->flags & mask) == mask) + if (event_type == WRITE_ROWS_EVENT && + ((*field_ptr)->flags & mask) == mask) { slave_print_msg(ERROR_LEVEL, rli, ER_NO_DEFAULT_FOR_FIELD, "Field `%s` of table `%s`.`%s` " @@ -5730,17 +5968,17 @@ unpack_row(RELAY_LOG_INFO *rli, DBUG_RETURN(error); } -int Rows_log_event::exec_event(st_relay_log_info *rli) +int Rows_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { - DBUG_ENTER("Rows_log_event::exec_event(st_relay_log_info*)"); + DBUG_ENTER("Rows_log_event::do_apply_event(st_relay_log_info*)"); int error= 0; char const *row_start= (char const *)m_rows_buf; /* - If m_table_id == ~0UL, then we have a dummy event that does - not contain any data. In that case, we just remove all tables in - the tables_to_lock list, close the thread tables, step the relay - log position, and return with success. + If m_table_id == ~0UL, then we have a dummy event that does not + contain any data. In that case, we just remove all tables in the + tables_to_lock list, close the thread tables, and return with + success. */ if (m_table_id == ~0UL) { @@ -5750,16 +5988,16 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) */ DBUG_ASSERT(get_flags(STMT_END_F)); - rli->clear_tables_to_lock(); + const_cast(rli)->clear_tables_to_lock(); close_thread_tables(thd); thd->clear_error(); - rli->inc_event_relay_log_pos(); DBUG_RETURN(0); } /* 'thd' has been set by exec_relay_log_event(), just before calling - exec_event(). We still check here to prevent future coding errors. + do_apply_event(). We still check here to prevent future coding + errors. */ DBUG_ASSERT(rli->sql_thd == thd); @@ -5775,8 +6013,9 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) /* lock_tables() reads the contents of thd->lex, so they must be - initialized. Contrary to in Table_map_log_event::exec_event() we don't - call mysql_init_query() as that may reset the binlog format. + initialized. Contrary to in + Table_map_log_event::do_apply_event() we don't call + mysql_init_query() as that may reset the binlog format. */ lex_start(thd, NULL, 0); @@ -5805,7 +6044,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) "Error in %s event: when locking tables", get_type_str()); } - rli->clear_tables_to_lock(); + const_cast(rli)->clear_tables_to_lock(); DBUG_RETURN(error); } @@ -5826,7 +6065,8 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) TABLE_LIST *tables= rli->tables_to_lock; close_tables_for_reopen(thd, &tables); - if ((error= open_tables(thd, &tables, &rli->tables_to_lock_count, 0))) + uint tables_count= rli->tables_to_lock_count; + if ((error= open_tables(thd, &tables, &tables_count, 0))) { if (thd->query_error || thd->is_fatal_error) { @@ -5841,7 +6081,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) "unexpected success or fatal error")); thd->query_error= 1; } - rli->clear_tables_to_lock(); + const_cast(rli)->clear_tables_to_lock(); DBUG_RETURN(error); } } @@ -5863,7 +6103,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) mysql_unlock_tables(thd, thd->lock); thd->lock= 0; thd->query_error= 1; - rli->clear_tables_to_lock(); + const_cast(rli)->clear_tables_to_lock(); DBUG_RETURN(ERR_BAD_TABLE_DEF); } } @@ -5885,24 +6125,24 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) */ for (TABLE_LIST *ptr= rli->tables_to_lock ; ptr ; ptr= ptr->next_global) { - rli->m_table_map.set_table(ptr->table_id, ptr->table); + const_cast(rli)->m_table_map.set_table(ptr->table_id, ptr->table); } #ifdef HAVE_QUERY_CACHE query_cache.invalidate_locked_for_write(rli->tables_to_lock); #endif - rli->clear_tables_to_lock(); + const_cast(rli)->clear_tables_to_lock(); } DBUG_ASSERT(rli->tables_to_lock == NULL && rli->tables_to_lock_count == 0); - TABLE* table= rli->m_table_map.get_table(m_table_id); + TABLE* table= const_cast(rli)->m_table_map.get_table(m_table_id); if (table) { /* table == NULL means that this table should not be replicated - (this was set up by Table_map_log_event::exec_event() which - tested replicate-* rules). + (this was set up by Table_map_log_event::do_apply_event() + which tested replicate-* rules). */ /* @@ -5959,7 +6199,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) break; default: - slave_print_msg(ERROR_LEVEL, rli, error, + slave_print_msg(ERROR_LEVEL, rli, thd->net.last_errno, "Error in %s event: row application failed", get_type_str()); thd->query_error= 1; @@ -5969,7 +6209,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) row_start= row_end; } DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", - rli->abort_slave=1;); + const_cast(rli)->abort_slave= 1;); error= do_after_row_operations(table, error); if (!cache_stmt) { @@ -5980,11 +6220,12 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) if (error) { /* error has occured during the transaction */ - slave_print_msg(ERROR_LEVEL, rli, error, + slave_print_msg(ERROR_LEVEL, rli, thd->net.last_errno, "Error in %s event: error during transaction execution " "on table %s.%s", get_type_str(), table->s->db.str, table->s->table_name.str); + /* If one day we honour --skip-slave-errors in row-based replication, and the error should be skipped, then we would clear mappings, rollback, @@ -5997,7 +6238,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) rollback at the caller along with sbr. */ thd->reset_current_stmt_binlog_row_based(); - rli->cleanup_context(thd, 0); /* rollback at caller in step with sbr */ + const_cast(rli)->cleanup_context(thd, error); thd->query_error= 1; DBUG_RETURN(error); } @@ -6041,8 +6282,7 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) */ thd->reset_current_stmt_binlog_row_based(); - rli->cleanup_context(thd, 0); - rli->transaction_end(thd); + const_cast(rli)->cleanup_context(thd, 0); if (error == 0) { @@ -6055,7 +6295,6 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) do not become visible. We still prefer to wipe them out. */ thd->clear_error(); - error= Log_event::exec_event(rli); } else slave_print_msg(ERROR_LEVEL, rli, error, @@ -6082,17 +6321,17 @@ int Rows_log_event::exec_event(st_relay_log_info *rli) wait (reached end of last relay log and nothing gets appended there), we timeout after one minute, and notify DBA about the problem. When WL#2975 is implemented, just remove the member - st_relay_log_info::unsafe_to_stop_at and all its occurences. + st_relay_log_info::last_event_start_time and all its occurences. */ - rli->unsafe_to_stop_at= time(0); + const_cast(rli)->last_event_start_time= time(0); } DBUG_ASSERT(error == 0); thd->clear_error(); - rli->inc_event_relay_log_pos(); - + DBUG_RETURN(0); } + #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #ifndef MYSQL_CLIENT @@ -6119,15 +6358,35 @@ bool Rows_log_event::write_data_body(IO_CACHE*file) */ char sbuf[sizeof(m_width)]; my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf; + bool res= false; char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width); DBUG_ASSERT(static_cast(sbuf_end - sbuf) <= sizeof(sbuf)); - return (my_b_safe_write(file, reinterpret_cast(sbuf), - sbuf_end - sbuf) || - my_b_safe_write(file, reinterpret_cast(m_cols.bitmap), - no_bytes_in_map(&m_cols)) || - my_b_safe_write(file, m_rows_buf, (uint) data_size)); + DBUG_DUMP("m_width", sbuf, sbuf_end - sbuf); + res= res || my_b_safe_write(file, + reinterpret_cast(sbuf), + sbuf_end - sbuf); + + DBUG_DUMP("m_cols", (char*) m_cols.bitmap, no_bytes_in_map(&m_cols)); + res= res || my_b_safe_write(file, + reinterpret_cast(m_cols.bitmap), + no_bytes_in_map(&m_cols)); + /* + TODO[refactor write]: Remove the "down cast" here (and elsewhere). + */ + if (get_type_code() == UPDATE_ROWS_EVENT) + { + DBUG_DUMP("m_cols_ai", (char*) m_cols_ai.bitmap, no_bytes_in_map(&m_cols_ai)); + res= res || my_b_safe_write(file, + reinterpret_cast(m_cols_ai.bitmap), + no_bytes_in_map(&m_cols_ai)); + } + DBUG_DUMP("rows", m_rows_buf, data_size); + res= res || my_b_safe_write(file, m_rows_buf, (uint) data_size); + + return res; + } #endif @@ -6160,10 +6419,8 @@ void Rows_log_event::print_helper(FILE *file, if (get_flags(STMT_END_F)) { - my_b_copy_to_file(head, file); - my_b_copy_to_file(body, file); - reinit_io_cache(head, WRITE_CACHE, 0, FALSE, TRUE); - reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE); + copy_event_cache_to_file_and_reinit(head, file); + copy_event_cache_to_file_and_reinit(body, file); } } #endif @@ -6272,15 +6529,15 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len, const char *const vpart= buf + common_header_len + post_header_len; /* Extract the length of the various parts from the buffer */ - byte const* const ptr_dblen= (byte const*)vpart + 0; + byte const *const ptr_dblen= (byte const*)vpart + 0; m_dblen= *(uchar*) ptr_dblen; /* Length of database name + counter + terminating null */ - byte const* const ptr_tbllen= ptr_dblen + m_dblen + 2; + byte const *const ptr_tbllen= ptr_dblen + m_dblen + 2; m_tbllen= *(uchar*) ptr_tbllen; /* Length of table name + counter + terminating null */ - byte const* const ptr_colcnt= ptr_tbllen + m_tbllen + 2; + byte const *const ptr_colcnt= ptr_tbllen + m_tbllen + 2; uchar *ptr_after_colcnt= (uchar*) ptr_colcnt; m_colcnt= net_field_length(&ptr_after_colcnt); @@ -6325,9 +6582,9 @@ Table_map_log_event::~Table_map_log_event() */ #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -int Table_map_log_event::exec_event(st_relay_log_info *rli) +int Table_map_log_event::do_apply_event(RELAY_LOG_INFO const *rli) { - DBUG_ENTER("Table_map_log_event::exec_event(st_relay_log_info*)"); + DBUG_ENTER("Table_map_log_event::do_apply_event(st_relay_log_info*)"); DBUG_ASSERT(rli->sql_thd == thd); @@ -6450,29 +6707,24 @@ int Table_map_log_event::exec_event(st_relay_log_info *rli) locked by linking the table into the list of tables to lock. */ table_list->next_global= table_list->next_local= rli->tables_to_lock; - rli->tables_to_lock= table_list; - rli->tables_to_lock_count++; + const_cast(rli)->tables_to_lock= table_list; + const_cast(rli)->tables_to_lock_count++; /* 'memory' is freed in clear_tables_to_lock */ } - /* - We explicitly do not call Log_event::exec_event() here since we do not - want the relay log position to be flushed to disk. The flushing will be - done by the last Rows_log_event that either ends a statement (outside a - transaction) or a transaction. - - A table map event can *never* end a transaction or a statement, so we - just step the relay log position. - */ - - if (likely(!error)) - rli->inc_event_relay_log_pos(); DBUG_RETURN(error); err: my_free((gptr) memory, MYF(MY_WME)); DBUG_RETURN(error); } + +int Table_map_log_event::do_update_pos(RELAY_LOG_INFO *rli) +{ + rli->inc_event_relay_log_pos(); + return 0; +} + #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ #ifndef MYSQL_CLIENT @@ -6637,7 +6889,7 @@ int Write_rows_log_event::do_after_row_operations(TABLE *table, int error) return error; } -int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli, +int Write_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, char const *const row_start, char const **const row_end) @@ -6778,6 +7030,42 @@ copy_extra_record_fields(TABLE *table, return 0; // All OK } +#define DBUG_PRINT_BITSET(N,FRM,BS) \ + do { \ + char buf[256]; \ + for (uint i = 0 ; i < (BS)->n_bits ; ++i) \ + buf[i] = bitmap_is_set((BS), i) ? '1' : '0'; \ + buf[(BS)->n_bits] = '\0'; \ + DBUG_PRINT((N), ((FRM), buf)); \ + } while (0) + + +/** + Check if an error is a duplicate key error. + + This function is used to check if an error code is one of the + duplicate key error, i.e., and error code for which it is sensible + to do a get_dup_key() to retrieve the duplicate key. + + @param errcode The error code to check. + + @return true if the error code is such that + get_dup_key() will return true, false + otherwise. + */ +bool +is_duplicate_key_error(int errcode) +{ + switch (errcode) + { + case HA_ERR_FOUND_DUPP_KEY: + case HA_ERR_FOUND_DUPP_UNIQUE: + return true; + } + return false; +} + + /* Replace the provided record in the database. @@ -6810,6 +7098,12 @@ replace_record(THD *thd, TABLE *table, int keynum; auto_afree_ptr key(NULL); +#ifndef DBUG_OFF + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + DBUG_PRINT_BITSET("debug", "write_set = %s", table->write_set); + DBUG_PRINT_BITSET("debug", "read_set = %s", table->read_set); +#endif + while ((error= table->file->ha_write_row(table->record[0]))) { if (error == HA_ERR_LOCK_DEADLOCK || error == HA_ERR_LOCK_WAIT_TIMEOUT) @@ -6820,7 +7114,7 @@ replace_record(THD *thd, TABLE *table, if ((keynum= table->file->get_dup_key(error)) < 0) { /* We failed to retrieve the duplicate key */ - DBUG_RETURN(HA_ERR_FOUND_DUPP_KEY); + DBUG_RETURN(error); } /* @@ -6837,7 +7131,10 @@ replace_record(THD *thd, TABLE *table, { error= table->file->rnd_pos(table->record[1], table->file->dup_ref); if (error) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } } else { @@ -6855,10 +7152,14 @@ replace_record(THD *thd, TABLE *table, key_copy((byte*)key.get(), table->record[0], table->key_info + keynum, 0); error= table->file->index_read_idx(table->record[1], keynum, - (const byte*)key.get(), HA_WHOLE_KEY, + (const byte*)key.get(), + HA_WHOLE_KEY, HA_READ_KEY_EXACT); if (error) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } } /* @@ -6891,15 +7192,21 @@ replace_record(THD *thd, TABLE *table, { error=table->file->ha_update_row(table->record[1], table->record[0]); + if (error) + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); } else { if ((error= table->file->ha_delete_row(table->record[1]))) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } /* Will retry ha_write_row() with the offending row removed. */ } } + DBUG_RETURN(error); } @@ -6930,20 +7237,75 @@ void Write_rows_log_event::print(FILE *file, PRINT_EVENT_INFO* print_event_info) */ static bool record_compare(TABLE *table) { + /* + Need to set the X bit and the filler bits in both records since + there are engines that do not set it correctly. + + In addition, since MyISAM checks that one hasn't tampered with the + record, it is necessary to restore the old bytes into the record + after doing the comparison. + + TODO[record format ndb]: Remove it once NDB returns correct + records. Check that the other engines also return correct records. + */ + + bool result= FALSE; + byte saved_x[2], saved_filler[2]; + + if (table->s->null_bytes > 0) + { + for (int i = 0 ; i < 2 ; ++i) + { + saved_x[i]= table->record[i][0]; + saved_filler[i]= table->record[i][table->s->null_bytes - 1]; + table->record[i][0]|= 1U; + table->record[i][table->s->null_bytes - 1]|= + 256U - (1U << table->s->last_null_bit_pos); + } + } + if (table->s->blob_fields + table->s->varchar_fields == 0) - return cmp_record(table,record[1]); + { + result= cmp_record(table,record[1]); + goto record_compare_exit; + } + /* Compare null bits */ if (memcmp(table->null_flags, table->null_flags+table->s->rec_buff_length, table->s->null_bytes)) - return TRUE; // Diff in NULL value + { + result= TRUE; // Diff in NULL value + goto record_compare_exit; + } + /* Compare updated fields */ for (Field **ptr=table->field ; *ptr ; ptr++) { if ((*ptr)->cmp_binary_offset(table->s->rec_buff_length)) - return TRUE; + { + result= TRUE; + goto record_compare_exit; + } } - return FALSE; + +record_compare_exit: + /* + Restore the saved bytes. + + TODO[record format ndb]: Remove this code once NDB returns the + correct record format. + */ + if (table->s->null_bytes > 0) + { + for (int i = 0 ; i < 2 ; ++i) + { + table->record[i][0]= saved_x[i]; + table->record[i][table->s->null_bytes - 1]= saved_filler[i]; + } + } + + return result; } @@ -6979,6 +7341,8 @@ static int find_and_fetch_row(TABLE *table, byte *key) DBUG_ASSERT(table->in_use != NULL); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + if ((table->file->ha_table_flags() & HA_PRIMARY_KEY_REQUIRED_FOR_POSITION) && table->s->primary_key < MAX_KEY) { @@ -7078,15 +7442,22 @@ static int find_and_fetch_row(TABLE *table, byte *key) while (record_compare(table)) { int error; + /* We need to set the null bytes to ensure that the filler bit are all set when returning. There are storage engines that just set the necessary bits on the bytes and don't set the filler bits correctly. + + TODO[record format ndb]: Remove this code once NDB returns the + correct record format. */ - my_ptrdiff_t const pos= - table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; - table->record[1][pos]= 0xFF; + if (table->s->null_bytes > 0) + { + table->record[1][table->s->null_bytes - 1]|= + 256U - (1U << table->s->last_null_bit_pos); + } + if ((error= table->file->index_next(table->record[1]))) { table->file->print_error(error, MYF(0)); @@ -7112,17 +7483,11 @@ static int find_and_fetch_row(TABLE *table, byte *key) /* Continue until we find the right record or have made a full loop */ do { - /* - We need to set the null bytes to ensure that the filler bit - are all set when returning. There are storage engines that - just set the necessary bits on the bytes and don't set the - filler bits correctly. - */ - my_ptrdiff_t const pos= - table->s->null_bytes > 0 ? table->s->null_bytes - 1 : 0; - table->record[1][pos]= 0xFF; error= table->file->rnd_next(table->record[1]); + DBUG_DUMP("record[0]", table->record[0], table->s->reclength); + DBUG_DUMP("record[1]", table->record[1], table->s->reclength); + switch (error) { case 0: @@ -7136,6 +7501,7 @@ static int find_and_fetch_row(TABLE *table, byte *key) default: table->file->print_error(error, MYF(0)); + DBUG_PRINT("info", ("Record not found")); table->file->ha_rnd_end(); DBUG_RETURN(error); } @@ -7145,6 +7511,7 @@ static int find_and_fetch_row(TABLE *table, byte *key) /* Have to restart the scan to be able to fetch the next row. */ + DBUG_PRINT("info", ("Record %sfound", restart_count == 2 ? "not " : "")); table->file->ha_rnd_end(); DBUG_ASSERT(error == HA_ERR_END_OF_FILE || error == 0); @@ -7237,7 +7604,7 @@ int Delete_rows_log_event::do_after_row_operations(TABLE *table, int error) return error; } -int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli, +int Delete_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, char const *const row_start, char const **const row_end) @@ -7303,16 +7670,55 @@ void Delete_rows_log_event::print(FILE *file, */ #if !defined(MYSQL_CLIENT) Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, - ulong tid, MY_BITMAP const *cols, + ulong tid, + MY_BITMAP const *cols_bi, + MY_BITMAP const *cols_ai, + bool is_transactional) +: Rows_log_event(thd_arg, tbl_arg, tid, cols_bi, is_transactional) +#ifdef HAVE_REPLICATION + , m_memory(NULL), m_key(NULL) + +#endif +{ + init(cols_ai); +} + +Update_rows_log_event::Update_rows_log_event(THD *thd_arg, TABLE *tbl_arg, + ulong tid, + MY_BITMAP const *cols, bool is_transactional) : Rows_log_event(thd_arg, tbl_arg, tid, cols, is_transactional) #ifdef HAVE_REPLICATION , m_memory(NULL), m_key(NULL) #endif { + init(cols); +} + +void Update_rows_log_event::init(MY_BITMAP const *cols) +{ + /* if bitmap_init fails, catched in is_valid() */ + if (likely(!bitmap_init(&m_cols_ai, + m_width <= sizeof(m_bitbuf_ai)*8 ? m_bitbuf_ai : NULL, + (m_width + 7) & ~7UL, + false))) + { + /* Cols can be zero if this is a dummy binrows event */ + if (likely(cols != NULL)) + memcpy(m_cols_ai.bitmap, cols->bitmap, no_bytes_in_map(cols)); + } } #endif /* !defined(MYSQL_CLIENT) */ + +Update_rows_log_event::~Update_rows_log_event() +{ + if (m_cols_ai.bitmap == m_bitbuf_ai) // no my_malloc happened + m_cols_ai.bitmap= 0; // so no my_free in bitmap_free + bitmap_free(&m_cols_ai); // To pair with bitmap_init(). +} + + /* Constructor used by slave to read the event from the binary log. */ @@ -7372,7 +7778,7 @@ int Update_rows_log_event::do_after_row_operations(TABLE *table, int error) return error; } -int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli, +int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO const *rli, TABLE *table, char const *const row_start, char const **const row_end) @@ -7397,7 +7803,7 @@ int Update_rows_log_event::do_prepare_row(THD *thd, RELAY_LOG_INFO *rli, store_record(table, record[1]); char const *next_start = *row_end; /* m_after_image is the after image for the update */ - error= unpack_row(rli, table, m_width, next_start, &m_cols, row_end, + error= unpack_row(rli, table, m_width, next_start, &m_cols_ai, row_end, &m_master_reclength, table->write_set, UPDATE_ROWS_EVENT); bmove_align(m_after_image, table->record[0], table->s->reclength); restore_record(table, record[1]); @@ -7469,3 +7875,113 @@ void Update_rows_log_event::print(FILE *file, } #endif + +Incident_log_event::Incident_log_event(const char *buf, uint event_len, + const Format_description_log_event *descr_event) + : Log_event(buf, descr_event) +{ + DBUG_ENTER("Incident_log_event::Incident_log_event"); + uint8 const common_header_len= + descr_event->common_header_len; + uint8 const post_header_len= + descr_event->post_header_len[INCIDENT_EVENT-1]; + + DBUG_PRINT("info",("event_len: %u; common_header_len: %d; post_header_len: %d", + event_len, common_header_len, post_header_len)); + + m_incident= static_cast(uint2korr(buf + common_header_len)); + char const *ptr= buf + common_header_len + post_header_len; + char const *const str_end= buf + event_len; + uint8 len= 0; // Assignment to keep compiler happy + const char *str= NULL; // Assignment to keep compiler happy + read_str(&ptr, str_end, &str, &len); + m_message.str= const_cast(str); + m_message.length= len; + DBUG_PRINT("info", ("m_incident: %d", m_incident)); + DBUG_VOID_RETURN; +} + + +Incident_log_event::~Incident_log_event() +{ +} + + +const char * +Incident_log_event::description() const +{ + static const char *const description[]= { + "NOTHING", // Not used + "LOST_EVENTS" + }; + + DBUG_PRINT("info", ("m_incident: %d", m_incident)); + + DBUG_ASSERT(0 <= m_incident); + DBUG_ASSERT((my_size_t) m_incident <= sizeof(description)/sizeof(*description)); + + return description[m_incident]; +} + + +#ifndef MYSQL_CLIENT +void Incident_log_event::pack_info(Protocol *protocol) +{ + char buf[256]; + my_size_t bytes; + if (m_message.length > 0) + bytes= my_snprintf(buf, sizeof(buf), "#%d (%s)", + m_incident, description()); + else + bytes= my_snprintf(buf, sizeof(buf), "#%d (%s): %s", + m_incident, description(), m_message.str); + protocol->store(buf, bytes, &my_charset_bin); +} +#endif + + +#ifdef MYSQL_CLIENT +void +Incident_log_event::print(FILE *file, + PRINT_EVENT_INFO *print_event_info) +{ + if (print_event_info->short_form) + return; + + Write_on_release_cache cache(&print_event_info->head_cache, file); + print_header(&cache, print_event_info, FALSE); + my_b_printf(&cache, "\n# Incident: %s", description()); +} +#endif + +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) +int +Incident_log_event::do_apply_event(RELAY_LOG_INFO const *rli) +{ + DBUG_ENTER("Incident_log_event::do_apply_event"); + slave_print_msg(ERROR_LEVEL, rli, ER_SLAVE_INCIDENT, + ER(ER_SLAVE_INCIDENT), + description(), + m_message.length > 0 ? m_message.str : ""); + DBUG_RETURN(1); +} +#endif + +bool +Incident_log_event::write_data_header(IO_CACHE *file) +{ + DBUG_ENTER("Incident_log_event::write_data_header"); + DBUG_PRINT("enter", ("m_incident: %d", m_incident)); + byte buf[sizeof(int16)]; + int2store(buf, (int16) m_incident); + DBUG_RETURN(my_b_safe_write(file, buf, sizeof(buf))); +} + +bool +Incident_log_event::write_data_body(IO_CACHE *file) +{ + DBUG_ENTER("Incident_log_event::write_data_body"); + DBUG_RETURN(write_str(file, m_message.str, m_message.length)); +} + + diff --git a/sql/log_event.h b/sql/log_event.h index 7cbe8925d9a..51543291621 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -22,6 +22,7 @@ #endif #include +#include "rpl_constants.h" #define LOG_READ_EOF -1 #define LOG_READ_BOGUS -2 @@ -198,7 +199,7 @@ struct sql_ex_info #define TABLE_MAP_HEADER_LEN 8 #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) #define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN) - +#define INCIDENT_HEADER_LEN 2 /* Max number of possible extra bytes in a replication event compared to a packet (i.e. a query) sent from client to master; @@ -468,10 +469,28 @@ enum Log_event_type XID_EVENT= 16, BEGIN_LOAD_QUERY_EVENT= 17, EXECUTE_LOAD_QUERY_EVENT= 18, + TABLE_MAP_EVENT = 19, - WRITE_ROWS_EVENT = 20, - UPDATE_ROWS_EVENT = 21, - DELETE_ROWS_EVENT = 22, + + /* + These event numbers were used for 5.1.0 to 5.1.15 and are + therefore obsolete. + */ + PRE_GA_WRITE_ROWS_EVENT = 20, + PRE_GA_UPDATE_ROWS_EVENT = 21, + PRE_GA_DELETE_ROWS_EVENT = 22, + + /* + These event numbers are used from 5.1.16 and forward + */ + WRITE_ROWS_EVENT = 23, + UPDATE_ROWS_EVENT = 24, + DELETE_ROWS_EVENT = 25, + + /* + Something out of the ordinary happened on the master + */ + INCIDENT_EVENT= 26, /* Add new events here - right above this comment! @@ -503,6 +522,7 @@ class THD; class Format_description_log_event; struct st_relay_log_info; +typedef st_relay_log_info RELAY_LOG_INFO; #ifdef MYSQL_CLIENT /* @@ -591,6 +611,33 @@ typedef struct st_print_event_info class Log_event { public: + /** + Enumeration of what kinds of skipping (and non-skipping) that can + occur when the slave executes an event. + + @see shall_skip + @see do_shall_skip + */ + enum enum_skip_reason { + /** + Don't skip event. + */ + EVENT_SKIP_NOT, + + /** + Skip event by ignoring it. + + This means that the slave skip counter will not be changed. + */ + EVENT_SKIP_IGNORE, + + /** + Skip event and decrease skip counter. + */ + EVENT_SKIP_COUNT + }; + + /* The following type definition is to be used whenever data is placed and manipulated in a common buffer. Use this typedef for buffers @@ -672,16 +719,14 @@ public: static void init_show_field_list(List* field_list); #ifdef HAVE_REPLICATION int net_send(Protocol *protocol, const char* log_name, my_off_t pos); + /* pack_info() is used by SHOW BINLOG EVENTS; as print() it prepares and sends a string to display to the user, so it resembles print(). */ + virtual void pack_info(Protocol *protocol); - /* - The SQL slave thread calls exec_event() to execute the event; this is where - the slave's data is modified. - */ - virtual int exec_event(struct st_relay_log_info* rli); + #endif /* HAVE_REPLICATION */ virtual const char* get_db() { @@ -754,6 +799,127 @@ public: *description_event); /* returns the human readable name of the event's type */ const char* get_type_str(); + +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) +public: + + /** + Apply the event to the database. + + This function represents the public interface for applying an + event. + + @see do_apply_event + */ + int apply_event(RELAY_LOG_INFO const *rli) { + return do_apply_event(rli); + } + + + /** + Update the relay log position. + + This function represents the public interface for "stepping over" + the event and will update the relay log information. + + @see do_update_pos + */ + int update_pos(RELAY_LOG_INFO *rli) + { + return do_update_pos(rli); + } + + /** + Decide if the event shall be skipped, and the reason for skipping + it. + + @see do_shall_skip + */ + enum_skip_reason shall_skip(RELAY_LOG_INFO *rli) + { + return do_shall_skip(rli); + } + +protected: + /** + Primitive to apply an event to the database. + + This is where the change to the database is made. + + @note The primitive is protected instead of private, since there + is a hierarchy of actions to be performed in some cases. + + @see Format_description_log_event::do_apply_event() + + @param rli Pointer to relay log info structure + + @retval 0 Event applied successfully + @retval errno Error code if event application failed + */ + virtual int do_apply_event(RELAY_LOG_INFO const *rli) + { + return 0; /* Default implementation does nothing */ + } + + + /** + Advance relay log coordinates. + + This function is called to advance the relay log coordinates to + just after the event. It is essential that both the relay log + coordinate and the group log position is updated correctly, since + this function is used also for skipping events. + + Normally, each implementation of do_update_pos() shall: + + - Update the event position to refer to the position just after + the event. + + - Update the group log position to refer to the position just + after the event if the event is last in a group + + @param rli Pointer to relay log info structure + + @retval 0 Coordinates changed successfully + @retval errno Error code if advancing failed (usually just + 1). Observe that handler errors are returned by the + do_apply_event() function, and not by this one. + */ + virtual int do_update_pos(RELAY_LOG_INFO *rli); + + + /** + Decide if this event shall be skipped or not and the reason for + skipping it. + + The default implementation decide that the event shall be skipped + if either: + + - the server id of the event is the same as the server id of the + server and rli->replicate_same_server_id is true, + or + + - if rli->slave_skip_counter is greater than zero. + + @see do_apply_event + @see do_update_pos + + @retval Log_event::EVENT_SKIP_NOT + The event shall not be skipped and should be applied. + + @retval Log_event::EVENT_SKIP_IGNORE + The event shall be skipped by just ignoring it, i.e., the slave + skip counter shall not be changed. This happends if, for example, + the originating server id of the event is the same as the server + id of the slave. + + @retval Log_event::EVENT_SKIP_COUNT + The event shall be skipped because the slave skip counter was + non-zero. The caller shall decrease the counter by one. + */ + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); + +#endif }; /* @@ -794,10 +960,10 @@ public: uint16 error_code; ulong thread_id; /* - For events created by Query_log_event::exec_event (and - Load_log_event::exec_event()) we need the *original* thread id, to be able - to log the event with the original (=master's) thread id (fix for - BUG#1686). + For events created by Query_log_event::do_apply_event (and + Load_log_event::do_apply_event()) we need the *original* thread + id, to be able to log the event with the original (=master's) + thread id (fix for BUG#1686). */ ulong slave_proxy_id; @@ -860,9 +1026,6 @@ public: const char* get_db() { return db; } #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); - int exec_event(struct st_relay_log_info* rli, const char *query_arg, - uint32 q_len_arg); #endif /* HAVE_REPLICATION */ #else void print_query_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info); @@ -891,6 +1054,16 @@ public: */ virtual ulong get_post_header_size_for_derived() { return 0; } /* Writes derived event-specific part of post header. */ + +public: /* !!! Public in this patch to allow old usage */ +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); + + int do_apply_event(RELAY_LOG_INFO const *rli, + const char *query_arg, + uint32 q_len_arg); +#endif /* HAVE_REPLICATION */ }; @@ -939,9 +1112,8 @@ public: uint16 master_port; #ifndef MYSQL_CLIENT - Slave_log_event(THD* thd_arg, struct st_relay_log_info* rli); + Slave_log_event(THD* thd_arg, RELAY_LOG_INFO* rli); void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif @@ -954,6 +1126,11 @@ public: #ifndef MYSQL_CLIENT bool write(IO_CACHE* file); #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const* rli); +#endif }; #endif /* HAVE_REPLICATION */ @@ -1023,12 +1200,6 @@ public: const char* get_db() { return db; } #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli) - { - return exec_event(thd->slave_net,rli,0); - } - int exec_event(NET* net, struct st_relay_log_info* rli, - bool use_rli_only_for_errors); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1060,6 +1231,17 @@ public: + LOAD_HEADER_LEN + sql_ex.data_size() + field_block_len + num_fields); } + +public: /* !!! Public in this patch to allow old usage */ +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const* rli) + { + return do_apply_event(thd->slave_net,rli,0); + } + + int do_apply_event(NET *net, RELAY_LOG_INFO const *rli, + bool use_rli_only_for_errors); +#endif }; extern char server_version[SERVER_VERSION_LENGTH]; @@ -1117,7 +1299,6 @@ public: Start_log_event_v3(); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else Start_log_event_v3() {} @@ -1137,6 +1318,22 @@ public: return START_V3_HEADER_LEN; //no variable-sized part } virtual bool is_artificial_event() { return artificial_event; } + +protected: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO*) + { + /* + Events from ourself should be skipped, but they should not + decrease the slave skip counter. + */ + if (this->server_id == ::server_id) + return Log_event::EVENT_SKIP_IGNORE; + else + return Log_event::EVENT_SKIP_NOT; + } +#endif }; @@ -1162,13 +1359,6 @@ public: uchar server_version_split[3]; Format_description_log_event(uint8 binlog_ver, const char* server_ver=0); - -#ifndef MYSQL_CLIENT -#ifdef HAVE_REPLICATION - int exec_event(struct st_relay_log_info* rli); -#endif /* HAVE_REPLICATION */ -#endif - Format_description_log_event(const char* buf, uint event_len, const Format_description_log_event* description_event); ~Format_description_log_event() { my_free((gptr)post_header_len, MYF(0)); } @@ -1191,7 +1381,15 @@ public: */ return FORMAT_DESCRIPTION_HEADER_LEN; } + void calc_server_version_split(); + +protected: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); +#endif }; @@ -1215,7 +1413,6 @@ public: {} #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1230,6 +1427,13 @@ public: bool write(IO_CACHE* file); #endif bool is_valid() const { return 1; } + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); +#endif }; @@ -1256,7 +1460,6 @@ class Rand_log_event: public Log_event {} #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1270,6 +1473,13 @@ class Rand_log_event: public Log_event bool write(IO_CACHE* file); #endif bool is_valid() const { return 1; } + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); +#endif }; /***************************************************************************** @@ -1293,7 +1503,6 @@ class Xid_log_event: public Log_event Xid_log_event(THD* thd_arg, my_xid x): Log_event(thd_arg,0,0), xid(x) {} #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1307,6 +1516,11 @@ class Xid_log_event: public Log_event bool write(IO_CACHE* file); #endif bool is_valid() const { return 1; } + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif }; /***************************************************************************** @@ -1336,7 +1550,6 @@ public: val_len(val_len_arg), type(type_arg), charset_number(charset_number_arg) { is_null= !val; } void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif @@ -1348,6 +1561,13 @@ public: bool write(IO_CACHE* file); #endif bool is_valid() const { return 1; } + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); +#endif }; @@ -1362,7 +1582,6 @@ public: #ifndef MYSQL_CLIENT Stop_log_event() :Log_event() {} - int exec_event(struct st_relay_log_info* rli); #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); #endif @@ -1373,6 +1592,22 @@ public: ~Stop_log_event() {} Log_event_type get_type_code() { return STOP_EVENT;} bool is_valid() const { return 1; } + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli) + { + /* + Events from ourself should be skipped, but they should not + decrease the slave skip counter. + */ + if (this->server_id == ::server_id) + return Log_event::EVENT_SKIP_IGNORE; + else + return Log_event::EVENT_SKIP_NOT; + } +#endif }; /***************************************************************************** @@ -1399,7 +1634,6 @@ public: ulonglong pos_arg, uint flags); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1418,6 +1652,12 @@ public: #ifndef MYSQL_CLIENT bool write(IO_CACHE* file); #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_update_pos(RELAY_LOG_INFO *rli); + virtual enum_skip_reason do_shall_skip(RELAY_LOG_INFO *rli); +#endif }; @@ -1452,7 +1692,6 @@ public: bool using_trans); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1486,6 +1725,11 @@ public: */ bool write_base(IO_CACHE* file); #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif }; @@ -1518,7 +1762,6 @@ public: Append_block_log_event(THD* thd, const char* db_arg, char* block_arg, uint block_len_arg, bool using_trans); #ifdef HAVE_REPLICATION - int exec_event(struct st_relay_log_info* rli); void pack_info(Protocol* protocol); virtual int get_create_or_append() const; #endif /* HAVE_REPLICATION */ @@ -1536,6 +1779,11 @@ public: bool write(IO_CACHE* file); const char* get_db() { return db; } #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif }; @@ -1555,7 +1803,6 @@ public: Delete_file_log_event(THD* thd, const char* db_arg, bool using_trans); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1572,6 +1819,11 @@ public: bool write(IO_CACHE* file); const char* get_db() { return db; } #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif }; @@ -1591,7 +1843,6 @@ public: Execute_load_log_event(THD* thd, const char* db_arg, bool using_trans); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1607,6 +1858,11 @@ public: bool write(IO_CACHE* file); const char* get_db() { return db; } #endif + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif }; @@ -1676,7 +1932,6 @@ public: bool using_trans, bool suppress_use); #ifdef HAVE_REPLICATION void pack_info(Protocol* protocol); - int exec_event(struct st_relay_log_info* rli); #endif /* HAVE_REPLICATION */ #else void print(FILE* file, PRINT_EVENT_INFO* print_event_info); @@ -1695,7 +1950,12 @@ public: #ifndef MYSQL_CLIENT bool write_post_header_for_derived(IO_CACHE* file); #endif - }; + +private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif +}; #ifdef MYSQL_CLIENT @@ -1793,7 +2053,6 @@ public: #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int exec_event(struct st_relay_log_info *rli); virtual void pack_info(Protocol *protocol); #endif @@ -1803,6 +2062,11 @@ public: private: +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + virtual int do_update_pos(RELAY_LOG_INFO *rli); +#endif + #ifndef MYSQL_CLIENT TABLE *m_table; #endif @@ -1886,7 +2150,6 @@ public: flag_set get_flags(flag_set flags) const { return m_flags & flags; } #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) - virtual int exec_event(struct st_relay_log_info *rli); virtual void pack_info(Protocol *protocol); #endif @@ -1903,14 +2166,7 @@ public: #endif /* Member functions to implement superclass interface */ - virtual int get_data_size() - { - DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master", - return 6 + 1 + no_bytes_in_map(&m_cols) + - (m_rows_cur - m_rows_buf);); - return ROWS_HEADER_LEN + 1 + no_bytes_in_map(&m_cols) + - (m_rows_cur - m_rows_buf); - } + virtual int get_data_size(); MY_BITMAP const *get_cols() const { return &m_cols; } my_size_t get_width() const { return m_width; } @@ -1921,9 +2177,14 @@ public: virtual bool write_data_body(IO_CACHE *file); virtual const char *get_db() { return m_table->s->db.str; } #endif + /* + Check that malloc() succeeded in allocating memory for the rows + buffer and the COLS vector. Checking that an Update_rows_log_event + is valid is done in the Update_rows_log_event::is_valid() + function. + */ virtual bool is_valid() const { - /* that's how we check malloc() succeeded */ return m_rows_buf && m_cols.bitmap; } @@ -1956,10 +2217,20 @@ protected: ulong m_table_id; /* Table ID */ MY_BITMAP m_cols; /* Bitmap denoting columns available */ ulong m_width; /* The width of the columns bitmap */ + /* + Bitmap for columns available in the after image, if present. These + fields are only available for Update_rows events. Observe that the + width of both the before image COLS vector and the after image + COLS vector is the same: the number of columns of the table on the + master. + */ + MY_BITMAP m_cols_ai; + ulong m_master_reclength; /* Length of record on master side */ - /* Bit buffer in the same memory as the class */ + /* Bit buffers in the same memory as the class */ uint32 m_bitbuf[128/(sizeof(uint32)*8)]; + uint32 m_bitbuf_ai[128/(sizeof(uint32)*8)]; byte *m_rows_buf; /* The rows in packed format */ byte *m_rows_cur; /* One-after the end of the data */ @@ -1970,6 +2241,8 @@ protected: private: #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); + /* Primitive to prepare for a sequence of row executions. @@ -2017,7 +2290,7 @@ private: RETURN VALUE Error code, if something went wrong, 0 otherwise. */ - virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*, + virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, char const *row_start, char const **row_end) = 0; /* @@ -2088,7 +2361,7 @@ private: virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*, + virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, char const *row_start, char const **row_end); virtual int do_exec_row(TABLE *table); #endif @@ -2117,10 +2390,20 @@ public: }; #ifndef MYSQL_CLIENT - Update_rows_log_event(THD*, TABLE*, ulong table_id, - MY_BITMAP const *cols, bool is_transactional); + Update_rows_log_event(THD*, TABLE*, ulong table_id, + MY_BITMAP const *cols_bi, + MY_BITMAP const *cols_ai, + bool is_transactional); + + Update_rows_log_event(THD*, TABLE*, ulong table_id, + MY_BITMAP const *cols, + bool is_transactional); + + void init(MY_BITMAP const *cols); #endif + virtual ~Update_rows_log_event(); + #ifdef HAVE_REPLICATION Update_rows_log_event(const char *buf, uint event_len, const Format_description_log_event *description_event); @@ -2139,6 +2422,11 @@ public: } #endif + virtual bool is_valid() const + { + return Rows_log_event::is_valid() && m_cols_ai.bitmap; + } + private: virtual Log_event_type get_type_code() { return (Log_event_type)TYPE_CODE; } @@ -2153,7 +2441,7 @@ private: virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*, + virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, char const *row_start, char const **row_end); virtual int do_exec_row(TABLE *table); #endif /* !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) */ @@ -2224,10 +2512,108 @@ private: virtual int do_before_row_operations(TABLE *table); virtual int do_after_row_operations(TABLE *table, int error); - virtual int do_prepare_row(THD*, RELAY_LOG_INFO*, TABLE*, + virtual int do_prepare_row(THD*, RELAY_LOG_INFO const*, TABLE*, char const *row_start, char const **row_end); virtual int do_exec_row(TABLE *table); #endif }; + +/** + Class representing an incident, an occurance out of the ordinary, + that happened on the master. + + The event is used to inform the slave that something out of the + ordinary happened on the master that might cause the database to be + in an inconsistent state. + + + + + + + + + + + + + + + + + + + + + + + +
Incident event format
SymbolSize
(bytes)
Description
INCIDENT2Incident number as an unsigned integer
MSGLEN1Message length as an unsigned integer
MESSAGEMSGLENThe message, if present. Not null terminated.
+ */ +class Incident_log_event : public Log_event { +public: +#ifndef MYSQL_CLIENT + Incident_log_event(THD *thd_arg, Incident incident) + : Log_event(thd_arg, 0, FALSE), m_incident(incident) + { + DBUG_ENTER("Incident_log_event::Incident_log_event"); + DBUG_PRINT("enter", ("m_incident: %d", m_incident)); + m_message.str= NULL; /* Just as a precaution */ + m_message.length= 0; + DBUG_VOID_RETURN; + } + + Incident_log_event(THD *thd_arg, Incident incident, LEX_STRING const msg) + : Log_event(thd_arg, 0, FALSE), m_incident(incident) + { + DBUG_ENTER("Incident_log_event::Incident_log_event"); + DBUG_PRINT("enter", ("m_incident: %d", m_incident)); + m_message= msg; + DBUG_VOID_RETURN; + } +#endif + +#ifndef MYSQL_CLIENT + void pack_info(Protocol*); +#endif + + Incident_log_event(const char *buf, uint event_len, + const Format_description_log_event *descr_event); + + virtual ~Incident_log_event(); + +#ifdef MYSQL_CLIENT + virtual void print(FILE *file, PRINT_EVENT_INFO *print_event_info); +#endif + +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) + virtual int do_apply_event(RELAY_LOG_INFO const *rli); +#endif + + virtual bool write_data_header(IO_CACHE *file); + virtual bool write_data_body(IO_CACHE *file); + + virtual Log_event_type get_type_code() { return INCIDENT_EVENT; } + + virtual bool is_valid() const { return 1; } + virtual int get_data_size() { + return INCIDENT_HEADER_LEN + 1 + m_message.length; + } + +private: + const char *description() const; + + Incident m_incident; + LEX_STRING m_message; +}; + +static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, + FILE *file) +{ + return + my_b_copy_to_file(cache, file) || + reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE); +} + #endif /* _log_event_h */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 51feb197713..9efe389a11f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6454,12 +6454,12 @@ The minimum value for this variable is 4096.", (gptr*) &max_system_variables.tmp_table_size, 0, GET_ULL, REQUIRED_ARG, 16*1024*1024L, 1024, MAX_MEM_TABLE_SIZE, 0, 1, 0}, {"transaction_alloc_block_size", OPT_TRANS_ALLOC_BLOCK_SIZE, - "Allocation block size for transactions to be stored in binary log", + "Allocation block size for various transaction-related structures", (gptr*) &global_system_variables.trans_alloc_block_size, (gptr*) &max_system_variables.trans_alloc_block_size, 0, GET_ULONG, REQUIRED_ARG, QUERY_ALLOC_BLOCK_SIZE, 1024, ~0L, 0, 1024, 0}, {"transaction_prealloc_size", OPT_TRANS_PREALLOC_SIZE, - "Persistent buffer for transactions to be stored in binary log", + "Persistent buffer for various transaction-related structures", (gptr*) &global_system_variables.trans_prealloc_size, (gptr*) &max_system_variables.trans_prealloc_size, 0, GET_ULONG, REQUIRED_ARG, TRANS_ALLOC_PREALLOC_SIZE, 1024, ~0L, 0, 1024, 0}, diff --git a/sql/records.cc b/sql/records.cc index 0923ab1d75e..0fb9f4f9650 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -150,7 +150,8 @@ void init_read_record(READ_RECORD *info,THD *thd, TABLE *table, info->file= table->file; info->forms= &info->table; /* Only one table */ - if (table->s->tmp_table == TMP_TABLE && !table->sort.addon_field) + if (table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE && + !table->sort.addon_field) VOID(table->file->extra(HA_EXTRA_MMAP)); if (table->sort.addon_field) diff --git a/sql/rpl_constants.h b/sql/rpl_constants.h new file mode 100644 index 00000000000..426e80a328d --- /dev/null +++ b/sql/rpl_constants.h @@ -0,0 +1,18 @@ +#ifndef RPL_CONSTANTS_H +#define RPL_CONSTANTS_H + +/** + Enumeration of the incidents that can occur for the server. + */ +enum Incident { + /** No incident */ + INCIDENT_NONE, + + /** There are possibly lost events in the replication stream */ + INCIDENT_LOST_EVENTS, + + /** Shall be last event of the enumeration */ + INCIDENT_COUNT +}; + +#endif /* RPL_CONSTANTS_H */ diff --git a/sql/rpl_injector.cc b/sql/rpl_injector.cc index 95b5ecba895..b22b052a105 100644 --- a/sql/rpl_injector.cc +++ b/sql/rpl_injector.cc @@ -188,3 +188,21 @@ void injector::new_trans(THD *thd, injector::transaction *ptr) DBUG_VOID_RETURN; } + +int injector::record_incident(THD *thd, Incident incident) +{ + Incident_log_event ev(thd, incident); + if (int error= mysql_bin_log.write(&ev)) + return error; + mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE); + return 0; +} + +int injector::record_incident(THD *thd, Incident incident, LEX_STRING message) +{ + Incident_log_event ev(thd, incident, message); + if (int error= mysql_bin_log.write(&ev)) + return error; + mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE); + return 0; +} diff --git a/sql/rpl_injector.h b/sql/rpl_injector.h index 61c2e0ecebc..eabf374857a 100644 --- a/sql/rpl_injector.h +++ b/sql/rpl_injector.h @@ -18,9 +18,10 @@ /* Pull in 'byte', 'my_off_t', and 'uint32' */ #include - #include +#include "rpl_constants.h" + /* Forward declarations */ class handler; class MYSQL_BIN_LOG; @@ -322,6 +323,9 @@ public: transaction new_trans(THD *); void new_trans(THD *, transaction *); + int record_incident(THD*, Incident incident); + int record_incident(THD*, Incident incident, LEX_STRING message); + private: explicit injector(); ~injector() { } /* Nothing needs to be done */ diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 8a051195dba..b0db355154e 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -29,14 +29,15 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, st_relay_log_info::st_relay_log_info() - :no_storage(FALSE), info_fd(-1), cur_log_fd(-1), save_temporary_tables(0), + :no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), + info_fd(-1), cur_log_fd(-1), save_temporary_tables(0), cur_log_old_open_count(0), group_master_log_pos(0), log_space_total(0), ignore_log_space_limit(0), last_master_timestamp(0), slave_skip_counter(0), abort_pos_wait(0), slave_run_id(0), sql_thd(0), last_slave_errno(0), inited(0), abort_slave(0), slave_running(0), until_condition(UNTIL_NONE), until_log_pos(0), retried_trans(0), tables_to_lock(0), tables_to_lock_count(0), - unsafe_to_stop_at(0) + last_event_start_time(0) { DBUG_ENTER("st_relay_log_info::st_relay_log_info"); @@ -968,7 +969,7 @@ err: strtol() conversions needed for log names comparison. We don't need to compare them each time this function is called, we only need to do this when current log name changes. If we have UNTIL_MASTER_POS condition we - need to do this only after Rotate_log_event::exec_event() (which is + need to do this only after Rotate_log_event::do_apply_event() (which is rare, so caching gives real benifit), and if we have UNTIL_RELAY_POS condition then we should invalidate cached comarison value after inc_group_relay_log_pos() which called for each group of events (so we @@ -1001,6 +1002,22 @@ bool st_relay_log_info::is_until_satisfied() log_pos= group_relay_log_pos; } +#ifndef DBUG_OFF + { + char buf[32]; + DBUG_PRINT("info", ("group_master_log_name='%s', group_master_log_pos=%s", + group_master_log_name, llstr(group_master_log_pos, buf))); + DBUG_PRINT("info", ("group_relay_log_name='%s', group_relay_log_pos=%s", + group_relay_log_name, llstr(group_relay_log_pos, buf))); + DBUG_PRINT("info", ("(%s) log_name='%s', log_pos=%s", + until_condition == UNTIL_MASTER_POS ? "master" : "relay", + log_name, llstr(log_pos, buf))); + DBUG_PRINT("info", ("(%s) until_log_name='%s', until_log_pos=%s", + until_condition == UNTIL_MASTER_POS ? "master" : "relay", + until_log_name, llstr(until_log_pos, buf))); + } +#endif + if (until_log_names_cmp_result == UNTIL_LOG_NAMES_CMP_UNKNOWN) { /* @@ -1056,30 +1073,19 @@ void st_relay_log_info::cached_charset_invalidate() } -bool st_relay_log_info::cached_charset_compare(char *charset) +bool st_relay_log_info::cached_charset_compare(char *charset) const { DBUG_ENTER("st_relay_log_info::cached_charset_compare"); if (bcmp(cached_charset, charset, sizeof(cached_charset))) { - memcpy(cached_charset, charset, sizeof(cached_charset)); + memcpy(const_cast(cached_charset), charset, sizeof(cached_charset)); DBUG_RETURN(1); } DBUG_RETURN(0); } -void st_relay_log_info::transaction_end(THD* thd) -{ - DBUG_ENTER("st_relay_log_info::transaction_end"); - - /* - Nothing to do here right now. - */ - - DBUG_VOID_RETURN; -} - #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) void st_relay_log_info::cleanup_context(THD *thd, bool error) { @@ -1087,12 +1093,12 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error) DBUG_ASSERT(sql_thd == thd); /* - 1) Instances of Table_map_log_event, if ::exec_event() was called on them, + 1) Instances of Table_map_log_event, if ::do_apply_event() was called on them, may have opened tables, which we cannot be sure have been closed (because maybe the Rows_log_event have not been found or will not be, because slave SQL thread is stopping, or relay log has a missing tail etc). So we close all thread's tables. And so the table mappings have to be cancelled. - 2) Rows_log_event::exec_event() may even have started statements or + 2) Rows_log_event::do_apply_event() may even have started statements or transactions on them, which we need to rollback in case of error. 3) If finding a Format_description_log_event after a BEGIN, we also need to rollback before continuing with the next events. @@ -1106,7 +1112,7 @@ void st_relay_log_info::cleanup_context(THD *thd, bool error) m_table_map.clear_tables(); close_thread_tables(thd); clear_tables_to_lock(); - unsafe_to_stop_at= 0; + last_event_start_time= 0; DBUG_VOID_RETURN; } diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 45c9fb1cf96..3f06e108f6d 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -58,6 +58,15 @@ typedef struct st_relay_log_info */ bool no_storage; + /* + If true, events with the same server id should be replicated. This + field is set on creation of a relay log info structure by copying + the value of ::replicate_same_server_id and can be overridden if + necessary. For example of when this is done, check sql_binlog.cc, + where the BINLOG statement can be used to execute "raw" events. + */ + bool replicate_same_server_id; + /*** The following variables can only be read when protect by data lock ****/ /* @@ -292,14 +301,19 @@ typedef struct st_relay_log_info When the 6 bytes are equal to 0 is used to mean "cache is invalidated". */ void cached_charset_invalidate(); - bool cached_charset_compare(char *charset); - - void transaction_end(THD*); + bool cached_charset_compare(char *charset) const; void cleanup_context(THD *, bool); void clear_tables_to_lock(); - time_t unsafe_to_stop_at; + /* + Used by row-based replication to detect that it should not stop at + this event, but give it a chance to send more events. The time + where the last event inside a group started is stored here. If the + variable is zero, we are not in a group (but may be in a + transaction). + */ + time_t last_event_start_time; } RELAY_LOG_INFO; diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 65a44a4947b..1d7cc808f0c 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -108,7 +108,7 @@ field_length_from_packed(enum_field_types const field_type, */ int -table_def::compatible_with(RELAY_LOG_INFO *rli, TABLE *table) +table_def::compatible_with(RELAY_LOG_INFO const *rli_arg, TABLE *table) const { /* @@ -116,6 +116,7 @@ table_def::compatible_with(RELAY_LOG_INFO *rli, TABLE *table) */ uint const cols_to_check= min(table->s->fields, size()); int error= 0; + RELAY_LOG_INFO const *rli= const_cast(rli_arg); TABLE_SHARE const *const tsh= table->s; diff --git a/sql/rpl_utility.h b/sql/rpl_utility.h index b1aa642619c..17879a9ecfc 100644 --- a/sql/rpl_utility.h +++ b/sql/rpl_utility.h @@ -117,7 +117,7 @@ public: @retval 1 if the table definition is not compatible with @c table @retval 0 if the table definition is compatible with @c table */ - int compatible_with(RELAY_LOG_INFO *rli, TABLE *table) const; + int compatible_with(RELAY_LOG_INFO const *rli, TABLE *table) const; private: my_size_t m_size; // Number of elements in the types array diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 8159f014e93..a42f94760ab 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6055,3 +6055,5 @@ ER_EVENT_CANNOT_CREATE_IN_THE_PAST eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been created" ER_EVENT_CANNOT_ALTER_IN_THE_PAST eng "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. Event has not been altered" +ER_SLAVE_INCIDENT + eng "The incident %s occured on the master. Message: %-.64s" diff --git a/sql/slave.cc b/sql/slave.cc index 1622f0f93a2..bc6cef95fc6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -522,11 +522,11 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) really one minute of idleness, we don't timeout if the slave SQL thread is actively working. */ - if (!rli->unsafe_to_stop_at) + if (rli->last_event_start_time == 0) DBUG_RETURN(1); DBUG_PRINT("info", ("Slave SQL thread is in an unsafe situation, giving " "it some grace period")); - if (difftime(time(0), rli->unsafe_to_stop_at) > 60) + if (difftime(time(0), rli->last_event_start_time) > 60) { slave_print_msg(ERROR_LEVEL, rli, 0, "SQL thread had to stop in an unsafe situation, in " @@ -560,7 +560,7 @@ static bool sql_slave_killed(THD* thd, RELAY_LOG_INFO* rli) void */ -void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli, +void slave_print_msg(enum loglevel level, RELAY_LOG_INFO const *rli, int err_code, const char* msg, ...) { void (*report_function)(const char *, ...); @@ -582,9 +582,9 @@ void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli, It's an error, it must be reported in Last_error and Last_errno in SHOW SLAVE STATUS. */ - pbuff= rli->last_slave_error; + pbuff= const_cast(rli)->last_slave_error; pbuffsize= sizeof(rli->last_slave_error); - rli->last_slave_errno = err_code; + const_cast(rli)->last_slave_errno = err_code; report_function= sql_print_error; break; case WARNING_LEVEL: @@ -816,7 +816,7 @@ do not trust column Seconds_Behind_Master of SHOW SLAVE STATUS"); { if ((master_row= mysql_fetch_row(master_res)) && (::server_id == strtoul(master_row[1], 0, 10)) && - !replicate_same_server_id) + !mi->rli.replicate_same_server_id) errmsg= "The slave I/O thread stops because master and slave have equal \ MySQL server ids; these ids must be different for replication to work (or \ the --replicate-same-server-id option must be used on slave but this does \ @@ -1393,7 +1393,7 @@ void set_slave_thread_options(THD* thd) DBUG_VOID_RETURN; } -void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli) +void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO const *rli) { DBUG_ENTER("set_slave_thread_default_charset"); @@ -1404,7 +1404,14 @@ void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli) thd->variables.collation_server= global_system_variables.collation_server; thd->update_charset(); - rli->cached_charset_invalidate(); + + /* + We use a const cast here since the conceptual (and externally + visible) behavior of the function is to set the default charset of + the thread. That the cache has to be invalidated is a secondary + effect. + */ + const_cast(rli)->cached_charset_invalidate(); DBUG_VOID_RETURN; } @@ -1612,7 +1619,8 @@ static ulong read_event(MYSQL* mysql, MASTER_INFO *mi, bool* suppress_warnings) } -int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error) +int check_expected_error(THD* thd, RELAY_LOG_INFO const *rli, + int expected_error) { DBUG_ENTER("check_expected_error"); @@ -1717,78 +1725,43 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) } if (ev) { - int type_code = ev->get_type_code(); - int exec_res; + int const type_code= ev->get_type_code(); + int exec_res= 0; /* - Queries originating from this server must be skipped. - Low-level events (Format_desc, Rotate, Stop) from this server - must also be skipped. But for those we don't want to modify - group_master_log_pos, because these events did not exist on the master. - Format_desc is not completely skipped. - Skip queries specified by the user in slave_skip_counter. - We can't however skip events that has something to do with the - log files themselves. - Filtering on own server id is extremely important, to ignore execution of - events created by the creation/rotation of the relay log (remember that - now the relay log starts with its Format_desc, has a Rotate etc). */ - DBUG_PRINT("info",("type_code=%d, server_id=%d",type_code,ev->server_id)); + DBUG_PRINT("info",("type_code=%d (%s), server_id=%d", + type_code, ev->get_type_str(), ev->server_id)); + DBUG_PRINT("info", ("thd->options={ %s%s}", + FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), + FLAGSTR(thd->options, OPTION_BEGIN))); - if ((ev->server_id == (uint32) ::server_id && - !replicate_same_server_id && - type_code != FORMAT_DESCRIPTION_EVENT) || - (rli->slave_skip_counter && - type_code != ROTATE_EVENT && type_code != STOP_EVENT && - type_code != START_EVENT_V3 && type_code!= FORMAT_DESCRIPTION_EVENT)) - { - DBUG_PRINT("info", ("event skipped")); - /* - We only skip the event here and do not increase the group log - position. In the event that we have to restart, this means - that we might have to skip the event again, but that is a - minor issue. - If we were to increase the group log position when skipping an - event, it might be that we are restarting at the wrong - position and have events before that we should have executed, - so not increasing the group log position is a sure bet in this - case. - In this way, we just step the group log position when we - *know* that we are at the end of a group. - */ - rli->inc_event_relay_log_pos(); + /* + Execute the event to change the database and update the binary + log coordinates, but first we set some data that is needed for + the thread. - /* - Protect against common user error of setting the counter to 1 - instead of 2 while recovering from an insert which used auto_increment, - rand or user var. - */ - if (rli->slave_skip_counter && - !((type_code == INTVAR_EVENT || - type_code == RAND_EVENT || - type_code == USER_VAR_EVENT) && - rli->slave_skip_counter == 1) && - /* - The events from ourselves which have something to do with the relay - log itself must be skipped, true, but they mustn't decrement - rli->slave_skip_counter, because the user is supposed to not see - these events (they are not in the master's binlog) and if we - decremented, START SLAVE would for example decrement when it sees - the Rotate, so the event which the user probably wanted to skip - would not be skipped. - */ - !(ev->server_id == (uint32) ::server_id && - (type_code == ROTATE_EVENT || type_code == STOP_EVENT || - type_code == START_EVENT_V3 || type_code == FORMAT_DESCRIPTION_EVENT))) - --rli->slave_skip_counter; - pthread_mutex_unlock(&rli->data_lock); - delete ev; - DBUG_RETURN(0); // avoid infinite update loops - } - pthread_mutex_unlock(&rli->data_lock); + The event will be executed unless it is supposed to be skipped. + + Queries originating from this server must be skipped. Low-level + events (Format_description_log_event, Rotate_log_event, + Stop_log_event) from this server must also be skipped. But for + those we don't want to modify 'group_master_log_pos', because + these events did not exist on the master. + Format_description_log_event is not completely skipped. + + Skip queries specified by the user in 'slave_skip_counter'. We + can't however skip events that has something to do with the log + files themselves. + + Filtering on own server id is extremely important, to ignore + execution of events created by the creation/rotation of the relay + log (remember that now the relay log starts with its Format_desc, + has a Rotate etc). + */ thd->server_id = ev->server_id; // use the original server id for logging thd->set_time(); // time the query @@ -1796,19 +1769,69 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) if (!ev->when) ev->when = time(NULL); ev->thd = thd; // because up to this point, ev->thd == 0 - DBUG_PRINT("info", ("thd->options={ %s%s}", - FLAGSTR(thd->options, OPTION_NOT_AUTOCOMMIT), - FLAGSTR(thd->options, OPTION_BEGIN))); - exec_res = ev->exec_event(rli); - DBUG_PRINT("info", ("exec_event result: %d", exec_res)); - DBUG_ASSERT(rli->sql_thd==thd); + int reason= ev->shall_skip(rli); + if (reason == Log_event::EVENT_SKIP_COUNT) + --rli->slave_skip_counter; + pthread_mutex_unlock(&rli->data_lock); + if (reason == Log_event::EVENT_SKIP_NOT) + exec_res= ev->apply_event(rli); +#ifndef DBUG_OFF + else + { + /* + This only prints information to the debug trace. + + TODO: Print an informational message to the error log? + */ + static const char *const explain[] = { + "event was not skipped", // EVENT_SKIP_NOT, + "event originated from this server", // EVENT_SKIP_IGNORE, + "event skip counter was non-zero" // EVENT_SKIP_COUNT + }; + DBUG_PRINT("info", ("%s was skipped because %s", + ev->get_type_str(), explain[reason])); + } +#endif + + DBUG_PRINT("info", ("apply_event error = %d", exec_res)); + if (exec_res == 0) + { + int error= ev->update_pos(rli); + char buf[22]; + DBUG_PRINT("info", ("update_pos error = %d", error)); + DBUG_PRINT("info", ("group %s %s", + llstr(rli->group_relay_log_pos, buf), + rli->group_relay_log_name)); + DBUG_PRINT("info", ("event %s %s", + llstr(rli->event_relay_log_pos, buf), + rli->event_relay_log_name)); + /* + The update should not fail, so print an error message and + return an error code. + + TODO: Replace this with a decent error message when merged + with BUG#24954 (which adds several new error message). + */ + if (error) + { + slave_print_msg(ERROR_LEVEL, rli, ER_UNKNOWN_ERROR, + "It was not possible to update the positions" + " of the relay log information: the slave may" + " be in an inconsistent state." + " Stopped in %s position %s", + rli->group_relay_log_name, + llstr(rli->group_relay_log_pos, buf)); + DBUG_RETURN(1); + } + } + /* Format_description_log_event should not be deleted because it will be used to read info about the relay log's format; it will be deleted when the SQL thread does not need it, i.e. when this thread terminates. */ - if (ev->get_type_code() != FORMAT_DESCRIPTION_EVENT) + if (type_code != FORMAT_DESCRIPTION_EVENT) { DBUG_PRINT("info", ("Deleting the event after it has been executed")); delete ev; @@ -2369,13 +2392,17 @@ Slave SQL thread aborted. Can't execute init_slave query"); THD_CHECK_SENTRY(thd); if (exec_relay_log_event(thd,rli)) { + DBUG_PRINT("info", ("exec_relay_log_event() failed")); // do not scare the user if SQL thread was simply killed or stopped if (!sql_slave_killed(thd,rli)) { /* - retrieve as much info as possible from the thd and, error codes and warnings - and print this to the error log as to allow the user to locate the error + retrieve as much info as possible from the thd and, error + codes and warnings and print this to the error log as to + allow the user to locate the error */ + DBUG_PRINT("info", ("thd->net.last_errno=%d; rli->last_slave_errno=%d", + thd->net.last_errno, rli->last_slave_errno)); if (thd->net.last_errno != 0) { if (rli->last_slave_errno == 0) @@ -2396,10 +2423,25 @@ Slave SQL thread aborted. Can't execute init_slave query"); /* Print any warnings issued */ List_iterator_fast it(thd->warn_list); MYSQL_ERROR *err; + /* + Added controlled slave thread cancel for replication + of user-defined variables. + */ + bool udf_error = false; while ((err= it++)) + { + if (err->code == ER_CANT_OPEN_LIBRARY) + udf_error = true; sql_print_warning("Slave: %s Error_code: %d",err->msg, err->code); - - sql_print_error("\ + } + if (udf_error) + sql_print_error("Error loading user-defined library, slave SQL " + "thread aborted. Install the missing library, and restart the " + "slave SQL thread with \"SLAVE START\". We stopped at log '%s' " + "position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, + llbuff)); + else + sql_print_error("\ Error running query, slave SQL thread aborted. Fix the problem, and restart \ the slave SQL thread with \"SLAVE START\". We stopped at log \ '%s' position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, llbuff)); @@ -2702,6 +2744,7 @@ static int queue_binlog_ver_1_event(MASTER_INFO *mi, const char *buf, my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(1); } + pthread_mutex_lock(&mi->data_lock); ev->log_pos= mi->master_log_pos; /* 3.23 events don't contain log_pos */ switch (ev->get_type_code()) { @@ -2965,7 +3008,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len) pthread_mutex_lock(log_lock); if ((uint4korr(buf + SERVER_ID_OFFSET) == ::server_id) && - !replicate_same_server_id) + !mi->rli.replicate_same_server_id) { /* Do not write it to the relay log. diff --git a/sql/slave.h b/sql/slave.h index f21266bbee4..107b74c09dd 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -162,9 +162,9 @@ bool show_binlog_info(THD* thd); bool rpl_master_has_bug(RELAY_LOG_INFO *rli, uint bug_id); const char *print_slave_db_safe(const char *db); -int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int error_code); +int check_expected_error(THD* thd, RELAY_LOG_INFO const *rli, int error_code); void skip_load_data_infile(NET* net); -void slave_print_msg(enum loglevel level, RELAY_LOG_INFO* rli, +void slave_print_msg(enum loglevel level, RELAY_LOG_INFO const *rli, int err_code, const char* msg, ...) ATTRIBUTE_FORMAT(printf, 4, 5); @@ -182,7 +182,7 @@ int init_relay_log_pos(RELAY_LOG_INFO* rli,const char* log,ulonglong pos, int purge_relay_logs(RELAY_LOG_INFO* rli, THD *thd, bool just_reset, const char** errmsg); void set_slave_thread_options(THD* thd); -void set_slave_thread_default_charset(THD* thd, RELAY_LOG_INFO *rli); +void set_slave_thread_default_charset(THD *thd, RELAY_LOG_INFO const *rli); void rotate_relay_log(MASTER_INFO* mi); pthread_handler_t handle_slave_io(void *arg); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f01f539ec51..4ab4dbe30ba 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1394,10 +1394,10 @@ void close_temporary_tables(THD *thd) due to special characters in the names */ append_identifier(thd, &s_query, table->s->db.str, strlen(table->s->db.str)); - s_query.q_append('.'); + s_query.append('.'); append_identifier(thd, &s_query, table->s->table_name.str, strlen(table->s->table_name.str)); - s_query.q_append(','); + s_query.append(','); next= table->next; close_temporary(table, 1, 1); } @@ -3812,7 +3812,7 @@ TABLE *open_temporary_table(THD *thd, const char *path, const char *db, tmp_table->reginfo.lock_type= TL_WRITE; // Simulate locked share->tmp_table= (tmp_table->file->has_transactions() ? - TRANSACTIONAL_TMP_TABLE : TMP_TABLE); + TRANSACTIONAL_TMP_TABLE : NON_TRANSACTIONAL_TMP_TABLE); if (link_in_list) { diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index b0a54bec664..6f7bbda96de 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -163,9 +163,17 @@ void mysql_client_binlog_statement(THD* thd) (ulong) uint4korr(bufptr+EVENT_LEN_OFFSET))); #endif ev->thd= thd; - if (IF_DBUG(int err= ) ev->exec_event(thd->rli_fake)) + /* + We go directly to the application phase, since we don't need + to check if the event shall be skipped or not. + + Neither do we have to update the log positions, since that is + not used at all: the rli_fake instance is used only for error + reporting. + */ + if (IF_DBUG(int err= ) ev->apply_event(thd->rli_fake)) { - DBUG_PRINT("error", ("exec_event() returned: %d", err)); + DBUG_PRINT("info", ("apply_event() returned: %d", err)); /* TODO: Maybe a better error message since the BINLOG statement now contains several events. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index d8371bef446..cc38d63c9f9 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -679,11 +679,22 @@ bool THD::store_globals() void THD::cleanup_after_query() { + /* + Reset rand_used so that detection of calls to rand() will save random + seeds if needed by the slave. + + Do not reset rand_used if inside a stored function or trigger because + only the call to these operations is logged. Thus only the calling + statement needs to detect rand() calls made by its substatements. These + substatements must not set rand_used to 0 because it would remove the + detection of rand() by the calling statement. + */ if (!in_sub_stmt) /* stored functions and triggers are a special case */ { /* Forget those values, for next binlogger: */ stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0; auto_inc_intervals_in_cur_stmt_for_binlog.empty(); + rand_used= 0; } if (first_successful_insert_id_in_cur_stmt > 0) { @@ -2542,30 +2553,111 @@ my_size_t THD::max_row_length_blob(TABLE *table, const byte *data) const } -my_size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data, - const byte *record) const +/* + Pack a record of data for a table into a format suitable for + transfer via the binary log. + + SYNOPSIS + THD::pack_row() + table Table describing the format of the record + cols Bitmap with a set bit for each column that should be + stored in the row + row_data Pointer to memory where row will be written + record Pointer to record that should be packed. It is assumed + that the pointer refers to either record[0] or + record[1], but no such check is made since the code does + not rely on that. + + DESCRIPTION + + The format for a row in transfer with N fields is the following: + + ceil(N/8) null bytes: + One null bit for every column *regardless of whether it can be + null or not*. This simplifies the decoding. Observe that the + number of null bits is equal to the number of set bits in the + 'cols' bitmap. The number of null bytes is the smallest number + of bytes necessary to store the null bits. + + Padding bits are 1. + + N packets: + Each field is stored in packed format. + + + RETURN VALUE + + The number of bytes written at 'row_data'. + */ +my_size_t +THD::pack_row(TABLE *table, MY_BITMAP const* cols, + byte *const row_data, const byte *record) const { Field **p_field= table->field, *field; - int n_null_bytes= table->s->null_bytes; - byte *ptr; - uint i; + int const null_byte_count= (bitmap_bits_set(cols) + 7) / 8; + byte *pack_ptr = row_data + null_byte_count; + byte *null_ptr = row_data; my_ptrdiff_t const rec_offset= record - table->record[0]; my_ptrdiff_t const def_offset= table->s->default_values - table->record[0]; - memcpy(row_data, record, n_null_bytes); - ptr= row_data+n_null_bytes; - for (i= 0 ; (field= *p_field) ; i++, p_field++) + /* + We write the null bits and the packed records using one pass + through all the fields. The null bytes are written little-endian, + i.e., the first fields are in the first byte. + */ + unsigned int null_bits= (1U << 8) - 1; + // Mask to mask out the correct but among the null bits + unsigned int null_mask= 1U; + for ( ; (field= *p_field) ; p_field++) { - if (bitmap_is_set(cols,i)) + DBUG_PRINT("debug", ("null_mask=%d; null_ptr=%p; row_data=%p; null_byte_count=%d", + null_mask, null_ptr, row_data, null_byte_count)); + if (bitmap_is_set(cols, p_field - table->field)) { - my_ptrdiff_t const offset= - field->is_null((uint) rec_offset) ? def_offset : rec_offset; - field->move_field_offset(offset); - ptr= (byte*)field->pack((char *) ptr, field->ptr); - field->move_field_offset(-offset); + my_ptrdiff_t offset; + if (field->is_null(rec_offset)) + { + offset= def_offset; + null_bits |= null_mask; + } + else + { + offset= rec_offset; + null_bits &= ~null_mask; + + /* + We only store the data of the field if it is non-null + */ + pack_ptr= (byte*)field->pack((char *) pack_ptr, field->ptr + offset); + } + + null_mask <<= 1; + if ((null_mask & 0xFF) == 0) + { + DBUG_ASSERT(null_ptr < row_data + null_byte_count); + null_mask = 1U; + *null_ptr++ = null_bits; + null_bits= (1U << 8) - 1; + } } } - return (static_cast(ptr - row_data)); + + /* + Write the last (partial) byte, if there is one + */ + if ((null_mask & 0xFF) > 1) + { + DBUG_ASSERT(null_ptr < row_data + null_byte_count); + *null_ptr++ = null_bits; + } + + /* + The null pointer should now point to the first byte of the + packed data. If it doesn't, something is very wrong. + */ + DBUG_ASSERT(null_ptr == row_data + null_byte_count); + + return static_cast(pack_ptr - row_data); } diff --git a/sql/sql_class.h b/sql/sql_class.h index a9915fce4ef..dc282586c86 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1270,7 +1270,7 @@ public: return first_successful_insert_id_in_prev_stmt; } /* - Used by Intvar_log_event::exec_event() and by "SET INSERT_ID=#" + Used by Intvar_log_event::do_apply_event() and by "SET INSERT_ID=#" (mysqlbinlog). We'll soon add a variant which can take many intervals in argument. */ diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 5712fbceac8..89bd7958c86 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -179,7 +179,7 @@ exit: orig_table_list->table_name= table->s->table_name.str; orig_table_list->table_name_length= table->s->table_name.length; table->derived_select_number= first_select->select_number; - table->s->tmp_table= TMP_TABLE; + table->s->tmp_table= NON_TRANSACTIONAL_TMP_TABLE; #ifndef NO_EMBEDDED_ACCESS_CHECKS if (orig_table_list->referencing_view) table->grant= orig_table_list->grant; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c94b43e231d..17f1c73dbcb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2595,6 +2595,36 @@ end_with_restore_list: break; } case SQLCOM_REPLACE: +#ifndef DBUG_OFF + if (mysql_bin_log.is_open()) + { + /* + Generate an incident log event before writing the real event + to the binary log. We put this event is before the statement + since that makes it simpler to check that the statement was + not executed on the slave (since incidents usually stop the + slave). + + Observe that any row events that are generated will be + generated before. + + This is only for testing purposes and will not be present in a + release build. + */ + + Incident incident= INCIDENT_NONE; + DBUG_PRINT("debug", ("Just before generate_incident()")); + DBUG_EXECUTE_IF("incident_database_resync_on_replace", + incident= INCIDENT_LOST_EVENTS;); + if (incident) + { + Incident_log_event ev(thd, incident); + mysql_bin_log.write(&ev); + mysql_bin_log.rotate_and_purge(RP_FORCE_ROTATE); + } + DBUG_PRINT("debug", ("Just after generate_incident()")); + } +#endif case SQLCOM_INSERT: { DBUG_ASSERT(first_table == all_tables && first_table != 0); @@ -3923,7 +3953,6 @@ create_sp_error: if (check_access(thd, DELETE_ACL, "mysql", 0, 1, 0, 0)) goto error; - /* Does NOT write to binlog */ if (!(res = mysql_drop_function(thd, &lex->spname->m_name))) { send_ok(thd); @@ -5194,6 +5223,7 @@ void mysql_init_multi_delete(LEX *lex) lex->query_tables_last= &lex->query_tables; } + /* When you modify mysql_parse(), you may need to mofify mysql_test_parse_for_slave() in this same file. @@ -5206,6 +5236,7 @@ void mysql_parse(THD *thd, char *inBuf, uint length) DBUG_EXECUTE_IF("parser_debug", turn_parser_debug_on();); mysql_init_query(thd, (uchar*) inBuf, length); + if (query_cache_send_result_to_client(thd, inBuf, length) <= 0) { LEX *lex= thd->lex; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ea9b835df4d..445890adedb 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -53,7 +53,8 @@ enum enum_i_s_events_fields ISE_CREATED, ISE_LAST_ALTERED, ISE_LAST_EXECUTED, - ISE_EVENT_COMMENT + ISE_EVENT_COMMENT, + ISE_ORIGINATOR }; @@ -4403,10 +4404,23 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table) } /* status */ - if (et.status == Event_timed::ENABLED) - sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("ENABLED"), scs); - else - sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("DISABLED"), scs); + + switch (et.status) + { + case Event_timed::ENABLED: + sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("ENABLED"), scs); + break; + case Event_timed::SLAVESIDE_DISABLED: + sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("SLAVESIDE_DISABLED"), + scs); + break; + case Event_timed::DISABLED: + sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("DISABLED"), scs); + break; + default: + DBUG_ASSERT(0); + } + sch_table->field[ISE_ORIGINATOR]->store(et.originator, TRUE); /* on_completion */ if (et.on_completion == Event_timed::ON_COMPLETION_DROP) @@ -4945,9 +4959,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) TABLE *table; DBUG_ENTER("mysql_schema_table"); if (!(table= table_list->schema_table->create_table(thd, table_list))) - { DBUG_RETURN(1); - } table->s->tmp_table= SYSTEM_TMP_TABLE; table->grant.privilege= SELECT_ACL; /* @@ -5445,13 +5457,14 @@ ST_FIELD_INFO events_fields_info[]= {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0}, {"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts"}, {"ENDS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Ends"}, - {"STATUS", 8, MYSQL_TYPE_STRING, 0, 0, "Status"}, + {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status"}, {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0}, {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0}, {"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0}, {"LAST_EXECUTED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0}, {"EVENT_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0}, - {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} + {"ORIGINATOR", 10, MYSQL_TYPE_LONG, 0, 0, "Originator"}, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0} }; diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 4c584bff72a..da5c1b0bc66 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -403,6 +403,13 @@ int mysql_create_function(THD *thd,udf_func *udf) DBUG_RETURN(1); } + /* + Turn off row binlogging of this statement and use statement-based + so that all supporting tables are updated for CREATE FUNCTION command. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + rw_wrlock(&THR_LOCK_udf); if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length))) { @@ -466,6 +473,15 @@ int mysql_create_function(THD *thd,udf_func *udf) goto err; } rw_unlock(&THR_LOCK_udf); + + /* Binlog the create function. */ + if (mysql_bin_log.is_open()) + { + thd->clear_error(); + thd->binlog_query(THD::MYSQL_QUERY_TYPE, + thd->query, thd->query_length, FALSE, FALSE); + } + DBUG_RETURN(0); err: @@ -484,11 +500,20 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) char *exact_name_str; uint exact_name_len; DBUG_ENTER("mysql_drop_function"); + if (!initialized) { my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); DBUG_RETURN(1); } + + /* + Turn off row binlogging of this statement and use statement-based + so that all supporting tables are updated for DROP FUNCTION command. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + rw_wrlock(&THR_LOCK_udf); if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str, (uint) udf_name->length))) @@ -524,6 +549,15 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name) close_thread_tables(thd); rw_unlock(&THR_LOCK_udf); + + /* Binlog the drop function. */ + if (mysql_bin_log.is_open()) + { + thd->clear_error(); + thd->binlog_query(THD::MYSQL_QUERY_TYPE, + thd->query, thd->query_length, FALSE, FALSE); + } + DBUG_RETURN(0); err: rw_unlock(&THR_LOCK_udf); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b7894e9ce04..36b09224796 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -948,6 +948,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token SIGNED_SYM %token SIMPLE_SYM /* SQL-2003-N */ %token SLAVE +%token SLAVESIDE_DISABLE_SYM %token SMALLINT /* SQL-2003-R */ %token SNAPSHOT_SYM %token SOCKET_SYM @@ -1770,12 +1771,17 @@ ev_schedule_time: EVERY_SYM expr interval opt_ev_status: /* empty */ { $$= 0; } | ENABLE_SYM { - Lex->event_parse_data->status= Event_parse_data::ENABLED; + Lex->event_parse_data->status= Event_basic::ENABLED; + $$= 1; + } + | DISABLE_SYM ON SLAVE + { + Lex->event_parse_data->status= Event_basic::SLAVESIDE_DISABLED; $$= 1; } | DISABLE_SYM { - Lex->event_parse_data->status= Event_parse_data::DISABLED; + Lex->event_parse_data->status= Event_basic::DISABLED; $$= 1; } ; @@ -1805,13 +1811,13 @@ ev_on_completion: ON COMPLETION_SYM PRESERVE_SYM { Lex->event_parse_data->on_completion= - Event_parse_data::ON_COMPLETION_PRESERVE; + Event_basic::ON_COMPLETION_PRESERVE; $$= 1; } | ON COMPLETION_SYM NOT_SYM PRESERVE_SYM { Lex->event_parse_data->on_completion= - Event_parse_data::ON_COMPLETION_DROP; + Event_basic::ON_COMPLETION_DROP; $$= 1; } ; @@ -9998,6 +10004,7 @@ keyword_sp: | SIMPLE_SYM {} | SHARE_SYM {} | SHUTDOWN {} + | SLAVESIDE_DISABLE_SYM {} | SNAPSHOT_SYM {} | SOUNDS_SYM {} | SQL_CACHE_SYM {} diff --git a/sql/table.h b/sql/table.h index aa053f207b3..6e435c9b3e3 100644 --- a/sql/table.h +++ b/sql/table.h @@ -58,7 +58,7 @@ typedef struct st_grant_info enum tmp_table_type { - NO_TMP_TABLE, TMP_TABLE, TRANSACTIONAL_TMP_TABLE, + NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE, INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE }; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 1292d7f5ede..1263882846d 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -6744,7 +6744,7 @@ typedef struct my_uca_scanner_handler_st int (*next)(my_uca_scanner *scanner); } my_uca_scanner_handler; -static uint16 nochar[]= {0}; +static uint16 nochar[]= {0,0}; #ifdef HAVE_CHARSET_ucs2 @@ -6769,13 +6769,32 @@ static void my_uca_scanner_init_ucs2(my_uca_scanner *scanner, CHARSET_INFO *cs __attribute__((unused)), const uchar *str, uint length) { - /* Note, no needs to initialize scanner->wbeg */ - scanner->sbeg= str; - scanner->send= str + length - 2; scanner->wbeg= nochar; - scanner->uca_length= cs->sort_order; - scanner->uca_weight= cs->sort_order_big; - scanner->contractions= cs->contractions; + if (length) + { + scanner->sbeg= str; + scanner->send= str + length - 2; + scanner->uca_length= cs->sort_order; + scanner->uca_weight= cs->sort_order_big; + scanner->contractions= cs->contractions; + return; + } + + /* + Sometimes this function is called with + str=NULL and length=0, which should be + considered as an empty string. + + The above initialization is unsafe for such cases, + because scanner->send is initialized to (NULL-2), which is 0xFFFFFFFE. + Then we fall into an endless loop in my_uca_scanner_next_ucs2(). + + Do special initialization for the case when length=0. + Initialize scanner->sbeg to an address greater than scanner->send. + Next call of my_uca_scanner_next_ucs2() will correctly return with -1. + */ + scanner->sbeg= (uchar*) &nochar[1]; + scanner->send= (uchar*) &nochar[0]; } diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 0536d445533..16882e9b25d 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2769,6 +2769,7 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, const uchar *te=t+tlen; int save_diff = 0; int diff; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; while ( s < se && t < te ) { @@ -2805,13 +2806,16 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs, static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs, const uchar *s, uint slen, - const uchar *t, uint tlen) + const uchar *t, uint tlen, + my_bool diff_if_only_endspace_difference + __attribute__((unused))) { int s_res,t_res; my_wc_t s_wc,t_wc; const uchar *se= s+slen; const uchar *te= t+tlen; int save_diff = 0; + MY_UNICASE_INFO **uni_plane= cs->caseinfo; while ( s < se && t < te ) { @@ -2880,6 +2884,7 @@ static MY_COLLATION_HANDLER my_collation_cs_handler = my_strnncoll_utf8_cs, my_strnncollsp_utf8_cs, my_strnxfrm_utf8, + my_strnxfrmlen_utf8, my_like_range_simple, my_wildcmp_mb, my_strcasecmp_utf8,