mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
cf5ebc5821
Clarified error messages related to unsafe statements: - avoid the internal technical term "row injection" - use 'binary log' instead of 'binlog' - avoid the word 'unsafeness' mysql-test/extra/binlog_tests/blackhole.test: updated suppression pattern mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_insert_id.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_loaddata.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_mixing_engines.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_start_stop_slave.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_stm_000001.test: updated suppression pattern mysql-test/extra/rpl_tests/rpl_stop_middle_group.test: updated suppression pattern mysql-test/r/archive.result: updated result file mysql-test/r/commit_1innodb.result: updated result file mysql-test/r/ctype_cp932_binlog_stm.result: updated result file mysql-test/r/partition_innodb_stmt.result: updated result file mysql-test/suite/binlog/r/binlog_innodb.result: updated result file mysql-test/suite/binlog/r/binlog_killed.result: updated result file mysql-test/suite/binlog/r/binlog_multi_engine.result: updated result file mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result: updated result file mysql-test/suite/binlog/r/binlog_statement_insert_delayed.result: updated result file mysql-test/suite/binlog/r/binlog_stm_blackhole.result: updated result file mysql-test/suite/binlog/r/binlog_stm_do_db.result: updated result file mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result: updated result file mysql-test/suite/binlog/r/binlog_stm_ps.result: updated result file mysql-test/suite/binlog/r/binlog_stm_row.result: updated result file mysql-test/suite/binlog/r/binlog_stm_unsafe_warning.result: updated result file mysql-test/suite/binlog/r/binlog_unsafe.result: updated result file mysql-test/suite/binlog/t/binlog_killed.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_multi_engine.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_statement_insert_delayed.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_stm_ps.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_stm_row.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_tmp_table.test: updated suppression pattern mysql-test/suite/binlog/t/binlog_unsafe.test: updated suppression pattern mysql-test/suite/ndb/r/ndb_binlog_format.result: updated result file mysql-test/suite/ndb/t/ndb_binlog_format.test: updated suppression pattern mysql-test/suite/perfschema/r/binlog_stmt.result: updated result file mysql-test/suite/perfschema/t/binlog_stmt.test: updated suppression pattern mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result: updated result file mysql-test/suite/rpl/r/rpl_blackhole.result: updated result file mysql-test/suite/rpl/r/rpl_concurrency_error.result: updated result file mysql-test/suite/rpl/r/rpl_get_lock.result: updated result file mysql-test/suite/rpl/r/rpl_insert_id.result: updated result file mysql-test/suite/rpl/r/rpl_insert_ignore.result: updated result file mysql-test/suite/rpl/r/rpl_misc_functions.result: updated result file mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result: updated result file mysql-test/suite/rpl/r/rpl_mixed_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_mysql_upgrade.result: updated result file mysql-test/suite/rpl/r/rpl_non_direct_mixed_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_non_direct_row_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_non_direct_stm_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_nondeterministic_functions.result: updated result file mysql-test/suite/rpl/r/rpl_read_only.result: updated result file mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result: updated result file mysql-test/suite/rpl/r/rpl_row_inexist_tbl.result: updated result file mysql-test/suite/rpl/r/rpl_row_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_slow_query_log.result: updated result file mysql-test/suite/rpl/r/rpl_sp.result: updated result file mysql-test/suite/rpl/r/rpl_stm_000001.result: updated result file mysql-test/suite/rpl/r/rpl_stm_auto_increment_bug33029.result: updated result file mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result: updated result file mysql-test/suite/rpl/r/rpl_stm_loadfile.result: updated result file mysql-test/suite/rpl/r/rpl_stm_mixing_engines.result: updated result file mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result: updated result file mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result: updated result file mysql-test/suite/rpl/r/rpl_temp_temporary.result: updated result file mysql-test/suite/rpl/r/rpl_variables_stm.result: updated result file mysql-test/suite/rpl/t/rpl000013.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_blackhole.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_concurrency_error.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_err_ignoredtable.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_get_lock.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_insert.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_insert_id.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_insert_ignore.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_invoked_features.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_misc_functions.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_mixed_bit_pk.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_mysql_upgrade.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_nondeterministic_functions.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_optimize.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_read_only.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_semi_sync.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_semi_sync_event.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_session_var.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_slow_query_log.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_sp.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_stm_auto_increment_bug33029.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_stm_found_rows.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_stm_insert_delayed.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_stm_loadfile.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_temp_table.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_temp_temporary.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_temporary.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_timezone.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_trigger.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_udf.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_user_variables.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_variables_stm.test: updated suppression pattern mysql-test/suite/rpl/t/rpl_view_multi.test: updated suppression pattern mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result: updated result file mysql-test/suite/rpl_ndb/t/rpl_ndb_binlog_format_errors.test: updated suppression pattern mysql-test/suite/rpl_ndb/t/rpl_ndb_stm_innodb.test: updated suppression pattern mysql-test/suite/sys_vars/t/rpl_init_slave_func.test: updated suppression pattern mysql-test/t/archive.test: updated suppression pattern mysql-test/t/commit_1innodb.test: updated suppression pattern mysql-test/t/create_select_tmp.test: updated suppression pattern mysql-test/t/ctype_cp932_binlog_stm.test: updated suppression pattern mysql-test/t/lock_sync.test: updated suppression pattern mysql-test/t/mysqlbinlog.test: updated suppression pattern mysql-test/t/mysqldump.test: updated suppression pattern mysql-test/t/sp_trans.test: updated suppression pattern sql/log_event.cc: Clarified error message. sql/share/errmsg-utf8.txt: Clarified error messages.
159 lines
4.2 KiB
Text
159 lines
4.2 KiB
Text
# ==== Purpose ====
|
|
#
|
|
# Test if statements used temporary tables are binlogged correctly
|
|
#
|
|
# ==== Method ====
|
|
#
|
|
# Use two connections, use temporary tables on both of them, and by
|
|
# switching connections between statements, the test can check if the
|
|
# statements are logged with the correct thread id.
|
|
#
|
|
# The statements current tested include:
|
|
# CREATE TEMPORARY TABLE
|
|
# CREATE TEMPORARY TABLE LIKE
|
|
# INSERT
|
|
# REPLACE
|
|
# UPDATE
|
|
# INSERT SELECT
|
|
# TRUNCATE
|
|
#
|
|
# Note: When adding new query statements, please add them between the
|
|
# two 'flush logs'. And aslo please make sure the connection is
|
|
# switched between each statement.
|
|
#
|
|
# ==== Related bugs ====
|
|
#
|
|
# BUG#35583 mysqlbinlog replay fails with ERROR 1146 when temp tables are used
|
|
#
|
|
source include/have_log_bin.inc;
|
|
source include/have_binlog_format_mixed_or_statement.inc;
|
|
|
|
RESET MASTER;
|
|
|
|
--disable_query_log
|
|
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
|
|
--enable_query_log
|
|
|
|
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
|
connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,);
|
|
|
|
create table foo (a int);
|
|
|
|
flush logs;
|
|
|
|
connection master;
|
|
create temporary table tmp1_foo like foo;
|
|
connection master1;
|
|
create temporary table tmp2_foo (a int);
|
|
|
|
connection master;
|
|
insert into tmp1_foo values (1), (2), (3), (4);
|
|
connection master1;
|
|
replace into tmp2_foo values (1), (2), (3), (4);
|
|
|
|
connection master;
|
|
update tmp1_foo set a=2*a-1;
|
|
connection master1;
|
|
update tmp2_foo set a=2*a;
|
|
|
|
connection master;
|
|
delete from tmp1_foo where a < 5;
|
|
connection master1;
|
|
delete from tmp2_foo where a < 5;
|
|
|
|
--disable_warnings
|
|
connection master;
|
|
insert into foo select * from tmp1_foo;
|
|
connection master1;
|
|
insert into foo select * from tmp2_foo;
|
|
--enable_warnings
|
|
|
|
connection master;
|
|
truncate table tmp1_foo;
|
|
connection master1;
|
|
truncate table tmp2_foo;
|
|
|
|
let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
|
|
|
|
flush logs;
|
|
|
|
connection default;
|
|
select * from foo;
|
|
|
|
# prepare for the replay
|
|
drop table foo;
|
|
create table foo (a int);
|
|
|
|
# replay from binary log
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file | $MYSQL;
|
|
select * from foo;
|
|
|
|
# clean up
|
|
drop table foo;
|
|
|
|
#################################################################
|
|
# BUG#51226
|
|
#################################################################
|
|
|
|
RESET MASTER;
|
|
|
|
-- let $dbname=b51226
|
|
|
|
connect (con1,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
|
connect (con2,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
|
|
|
|
#
|
|
# action: on con1 create the database and the tmp table
|
|
#
|
|
-- connection con1
|
|
-- eval create database $dbname
|
|
-- eval use $dbname
|
|
create temporary table t1(i int);
|
|
|
|
#
|
|
# action: on con1 create the tmp table
|
|
#
|
|
-- connection con2
|
|
-- eval use $dbname
|
|
create temporary table t1(i int);
|
|
|
|
# action: at this point, the last event binlogged contains the
|
|
# pseudo_thread_id from con2. So now we switch to con1, issue
|
|
# a statement that fails and close the connection (which logs
|
|
# implicitely a DROP TEMPORARY TABLE).
|
|
#
|
|
# Before the patch this would not log con1's pseudo_thread_id
|
|
# because the failing statement would reset THD context
|
|
# (unsetting the thread_specific_used flag, and consequently,
|
|
# causing the DROP event to be logged without pseudo_thread_id
|
|
# in its header).
|
|
|
|
-- connection con1
|
|
-- error 1050
|
|
create temporary table t1(i int);
|
|
-- disconnect con1
|
|
|
|
-- connection default
|
|
-- let $wait_binlog_event= DROP
|
|
-- source include/wait_for_binlog_event.inc
|
|
|
|
# action: insert in the t1. This would cause the the test to fail,
|
|
# because when replaying the binlog the previous implicit drop
|
|
# temp table would have been executed under the wrong
|
|
# pseudo_thread_id, dropping the tmp table on con2.
|
|
-- connection con2
|
|
insert into t1 values(1);
|
|
-- disconnect con2
|
|
|
|
-- connection default
|
|
-- let $wait_binlog_event= DROP
|
|
-- source include/wait_for_binlog_event.inc
|
|
|
|
-- eval DROP DATABASE $dbname
|
|
FLUSH LOGS;
|
|
|
|
# assertion: assert that when replaying the binary log will succeed,
|
|
# instead of failing with "Table 'XXX.YYY' doesn't exist"
|
|
-- let $MYSQLD_DATADIR= `select @@datadir`
|
|
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 | $MYSQL
|