[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.147.56.105: ~ $
-- source include/have_innodb.inc
-- source include/have_binlog_format_statement.inc

call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");

# You cannot use `KILL' with the Embedded MySQL Server library,
# because the embedded server merely runs inside the threads of the host
# application. -- the docs

-- source include/not_embedded.inc

###
### bug#22725 : incorrect killed error in binlogged query
###

connect (con1, localhost, root,,);
connect (con2, localhost, root,,);

create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;

#
# effective test for bug#22725
#

connection con1;
select get_lock("a", 20);

connection con2;
let $ID= `select connection_id()`;

#
# reset master does not reset binlogging on the embedded server.
# the test is not run on the embedded for reason of using KILL query.
# `reset master' problem is to be addressed by bug#15580 fixes.
#
reset master;
send insert into t2 values (null, null), (null, get_lock("a", 10));


connection con1;

--disable_abort_on_error
--disable_warnings

let $wait_condition=
  select count(*) = 1 from information_schema.processlist
  where info like "%insert into t2 values%" and state like 'User lock';
--source include/wait_condition.inc

--replace_regex /[0-9]+/ID/
eval kill query $ID;

connection con2;
--error 0,ER_QUERY_INTERRUPTED
reap;
let $rows= `select count(*) from t2  /* must be 2 or 0 */`;
let $MYSQLD_DATADIR= `select @@datadir`;
--let $row_number=4
if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`)
{
  # if GTID_MODE=ON, there are two more events in the binary log:
  # 1. Previous_Gtids_Log_Event
  # 2. Gtid_log_event
  --let $row_number=`SELECT $row_number + 2`
}

--let $binlog_killed_pos=query_get_value(SHOW BINLOG EVENTS, Pos, $row_number)
--let $binlog_killed_end_log_pos=query_get_value(SHOW BINLOG EVENTS, End_log_pos, $row_number)
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_killed_pos --stop-position=$binlog_killed_end_log_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--disable_result_log
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
is not null;
--enable_result_log
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`;
let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`;
eval set @result= $rows - $error_code - $insert_binlogged;

--enable_warnings
--enable_abort_on_error

if (`SELECT @result != 0`)
{
  -- echo error_code:$error_code, insert:$insert_binlogged, rows:$rows
  SELECT * FROM t2;
  
  -- die
}

select @result /* must be zero either way */;


--remove_file $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
connection con1;
select RELEASE_LOCK("a");

#
# bug#27571 asynchronous setting mysql_`query`::error and Query_log_e::error_code
#

# checking that killing inside of select loops is safe as before
# killing after the loop can be only simulated - another test

delete from t1;
delete from t2;
insert into t1 values (1,1),(2,2);

#
# simple update
#
connection con1;
begin; update t1 set b=11 where a=2;

connection con2;
let $ID= `select connection_id()`;
begin;
send update t1 set b=b+10;

connection con1;
--replace_result $ID ID
eval kill query $ID;
rollback;

# Bug #32148  	killi query may be ineffective 
# forced to comment out the test's outcome 
# and mask out ineffective ER_QUERY_INTERRUPTED
# todo1: revert back upon fixing bug#32148
# todo2: the tests need refining in that
#        killing should wait till the victim requested
#        its lock (wait_condition available in 5.1 tests)

connection con2;
--error 0,ER_QUERY_INTERRUPTED
reap;
rollback;
select * from t1  order by a /* must be the same as before (1,1),(2,2) */;

#
# multi update
# commented out as Bug #31807 multi-update,delete killing does not report with ER_QUERY_INTERRUPTED
# in the way
#
# connection con1;
# begin; update t1 set b=b+10;

# connection con2;
# send update t1 as t_1,t1 as t_2 set t_1.b=11 where t_2.a=2;

# connection con1;
# --replace_result $ID ID
# eval kill query $ID;
# rollback;

# disable_abort_on_error;

# connection con2;
# --error HY000,ER_QUERY_INTERRUPTED
# reap;
# select * from t1 /* must be the same as before (1,1),(2,2) */;

# enable_abort_on_error;
#
# simple delete
#
connection con1;
begin; delete from t1 where a=2;

connection con2;
let $ID= `select connection_id()`;
begin;
send delete from t1 where a=2;

connection con1;
--replace_result $ID ID
eval kill query $ID;
rollback;

connection con2;
--error 0,ER_QUERY_INTERRUPTED
reap;
rollback;
# todo1,2 above
select * from t1 order by a /* must be the same as before (1,1),(2,2) */;


#
# multi delete
# the same as for multi-update
#
# connection con1;
# begin; delete from t1 where a=2;

# connection con2;
# send delete t1 from t1 where t1.a=2;

# connection con1;
# --replace_result $ID ID
# eval kill query $ID;
# rollback;

# connection con2;
# --error 0,ER_QUERY_INTERRUPTED
# reap;
# select * from t1 /* must be the same as before (1,1),(2,2) */;
#
# insert select
#
connection con1;
--disable_warnings
drop table if exists t4;
--enable_warnings
create table t4 (a int, b int) engine=innodb;
insert into t4 values (3, 3);
begin; insert into t1 values (3, 3);

connection con2;
let $ID= `select connection_id()`;
begin;
send insert into t1 select * from t4 for update;

connection con1;
--replace_result $ID ID
eval kill query $ID;
rollback;

connection con2;
--error 0,ER_QUERY_INTERRUPTED
reap;
# todo 1,2 above
rollback;
select * from t1 /* must be the same as before (1,1),(2,2) */;

drop table t4; # cleanup for the sub-case

###
## non-ta table case: killing must be recorded in binlog
###
create table t4 (a int, b int) ENGINE=MyISAM /* for killing update and delete */;

delimiter |;
create function bug27563(n int) 
RETURNS int(11)
DETERMINISTIC
begin
  if @b > 0 then
     select get_lock("a", 20)  into @a;
  else 
     set @b= 1;
  end if;
  return n;
end|
delimiter ;|

#
# update
#

delete from t4;
insert into t4 values (1,1), (1,1);
reset master;
connection con1;
select get_lock("a", 20);

connection con2;
let $ID= `select connection_id()`;
set @b= 0;
send update t4 set b=b + bug27563(b);

connection con1;
let $wait_condition= select count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
source include/wait_condition.inc;
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';

--replace_result $ID ID
eval kill query $ID;

connection con2;
--error ER_QUERY_INTERRUPTED
reap;
select * from t4 order by b /* must be (1,1), (1,2) */;
select @b  /* must be 1 at the end of a stmt calling bug27563() */;
--echo must have the update query event on the 4th line
source include/show_binlog_events.inc;
--let $row_number= 4
if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`)
{
  # if GTID_MODE=ON, there are two more events in the binary log:
  # 1. Previous_Gtids_Log_Event
  # 2. Gtid_log_event
  --let $row_number=`SELECT $row_number + 2`
}

--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, $row_number)
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, $row_number)

--echo *** a proof the query is binlogged with an error ***

--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_killed_pos --stop-position=$binlog_killed_end_log_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null AS Loaded;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
eval select $error_code /* must return 0 to mean the killed update is in */;

# cleanup for the sub-case
connection con1;
select RELEASE_LOCK("a");
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog

#
# delete
#

delete from t4;
insert into t4 values (1,1), (2,2);
reset master;
connection con1;
select get_lock("a", 20);

connection con2;
let $ID= `select connection_id()`;
set @b= 0;
send delete from t4 where b=bug27563(1) or b=bug27563(2);

connection con1;
let $wait_condition= select count(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
source include/wait_condition.inc;
select count(*) FROM INFORMATION_SCHEMA.PROCESSLIST where state='User lock';
--replace_result $ID ID
eval kill query $ID;

connection con2;
--error ER_QUERY_INTERRUPTED
reap;
select count(*) from t4 /* must be 1 */;
select @b  /* must be 1 at the end of a stmt calling bug27563() */;
--echo must have the delete query event on the 4th line
source include/show_binlog_events.inc;

--let $row_number= 4
if (!`SELECT COUNT(*) = 0 OR VARIABLE_VALUE != 'ON' FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'GTID_MODE'`)
{
  # if GTID_MODE=ON, there are two more events in the binary log:
  # 1. Previous_Gtids_Log_Event
  # 2. Gtid_log_event
  --let $row_number=`SELECT $row_number + 2`
}

--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, $row_number)
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, $row_number)

# a proof the query is binlogged with an error

--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_killed_pos --stop-position=$binlog_killed_end_log_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval select
(@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog"))
is not null AS Loaded;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
let $error_code= `select @a like "%#%error_code=0%" /* must return 0*/`;
eval select $error_code /* must return 0 to mean the killed delete is in */;

# cleanup for the sub-case
connection con1;
select RELEASE_LOCK("a");
--remove_file $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog

drop table t4;

#
# load data - see simulation tests
#


# bug#27571 cleanup

drop function bug27563;


#
# common cleanup 
#

connection con1;
disconnect con1;
--source include/wait_until_disconnected.inc
connection con2;
disconnect con2;
--source include/wait_until_disconnected.inc
connection default;

drop table t1,t2,t3;

--echo end of the tests

Filemanager

Name Type Size Permission Actions
binlog_base64_flag.test File 5.53 KB 0644
binlog_bug23533.test File 1.48 KB 0644
binlog_bug36391-master.opt File 32 B 0644
binlog_bug36391.test File 1.14 KB 0644
binlog_cache_write_failure-master.opt File 97 B 0644
binlog_cache_write_failure.test File 5.43 KB 0644
binlog_checksum.test File 1.04 KB 0644
binlog_crash_safe_master_checksum-master.opt File 51 B 0644
binlog_crash_safe_master_checksum.test File 2.56 KB 0644
binlog_database.test File 369 B 0644
binlog_delete_and_flush_index.test File 3.53 KB 0644
binlog_dmls_on_tmp_tables_readonly.test File 2.25 KB 0644
binlog_drop_if_exists.test File 3.47 KB 0644
binlog_enforce_gtid_consistency.test File 5.72 KB 0644
binlog_error_action-master.opt File 88 B 0644
binlog_error_action.test File 16.82 KB 0644
binlog_format_switch_in_tmp_table.test File 2.77 KB 0644
binlog_grant.test File 1.7 KB 0644
binlog_gtid_cache-master.opt File 117 B 0644
binlog_gtid_cache.test File 569 B 0644
binlog_gtid_errors-master.opt File 149 B 0644
binlog_gtid_errors.test File 7.28 KB 0644
binlog_gtid_exhausted-master.opt File 17 B 0644
binlog_gtid_exhausted.test File 2.34 KB 0644
binlog_gtid_implicit_commit.test File 121 B 0644
binlog_gtid_innodb.test File 132 B 0644
binlog_gtid_mysqlbinlog_row.test File 197 B 0644
binlog_gtid_mysqlbinlog_row_innodb.test File 707 B 0644
binlog_gtid_mysqlbinlog_row_myisam.test File 662 B 0644
binlog_gtid_mysqlbinlog_start_stop.test File 445 B 0644
binlog_gtid_row_ctype_ucs.test File 265 B 0644
binlog_gtid_simple_recovery.test File 4.7 KB 0644
binlog_gtid_stm_ctype_ucs.test File 280 B 0644
binlog_gtid_utils.test File 3.11 KB 0644
binlog_hexdump.test File 219 B 0644
binlog_implicit_commit.test File 290 B 0644
binlog_incident-master.opt File 53 B 0644
binlog_incident.test File 1.05 KB 0644
binlog_incident_ignore-master.opt File 77 B 0644
binlog_incident_ignore.test File 151 B 0644
binlog_index-master.opt File 16 B 0644
binlog_index.test File 16.48 KB 0644
binlog_innodb.test File 139 B 0644
binlog_innodb_row.test File 2.69 KB 0644
binlog_killed.test File 10.52 KB 0644
binlog_killed_simulate-master.opt File 39 B 0644
binlog_killed_simulate.test File 2.67 KB 0644
binlog_max_extension.test File 2.57 KB 0644
binlog_mixed_cache_stat.test File 276 B 0644
binlog_mixed_load_data.test File 501 B 0644
binlog_multi_engine.test File 3.18 KB 0644
binlog_mysqlbinlog-cp932-master.opt File 23 B 0644
binlog_mysqlbinlog-cp932.test File 1.07 KB 0644
binlog_mysqlbinlog_base64.test File 2.59 KB 0644
binlog_mysqlbinlog_concat.test File 4.1 KB 0644
binlog_mysqlbinlog_filter.test File 2.07 KB 0644
binlog_mysqlbinlog_raw.test File 3.53 KB 0644
binlog_mysqlbinlog_row.test File 204 B 0644
binlog_mysqlbinlog_row_innodb.test File 714 B 0644
binlog_mysqlbinlog_row_myisam.test File 669 B 0644
binlog_mysqlbinlog_row_trans.test File 4.55 KB 0644
binlog_mysqlbinlog_start_stop.test File 452 B 0644
binlog_mysqlbinlog_start_stop_slave_server_id.test File 1.96 KB 0644
binlog_old_versions.test File 5.6 KB 0644
binlog_query_filter_rules-master.opt File 40 B 0644
binlog_query_filter_rules.test File 854 B 0644
binlog_reset_master.test File 998 B 0644
binlog_rewrite.test File 3.01 KB 0644
binlog_rotate_bgc_sync.test File 3.62 KB 0644
binlog_row_binlog-master.opt File 55 B 0644
binlog_row_binlog.test File 782 B 0644
binlog_row_cache_stat.test File 273 B 0644
binlog_row_ctype_cp932.test File 267 B 0644
binlog_row_ctype_ucs.test File 272 B 0644
binlog_row_drop_tbl.test File 214 B 0644
binlog_row_drop_tmp_tbl.test File 232 B 0644
binlog_row_innodb_stat-master.opt File 26 B 0644
binlog_row_insert_select.test File 510 B 0644
binlog_row_mix_innodb_myisam-master.opt File 97 B 0644
binlog_row_mix_innodb_myisam.test File 584 B 0644
binlog_row_mysqlbinlog_db_filter.test File 4.1 KB 0644
binlog_row_mysqlbinlog_verbose.test File 5.59 KB 0644
binlog_row_query_log_events.test File 1.18 KB 0644
binlog_server_id.test File 1 KB 0644
binlog_server_start_options.test File 3.63 KB 0644
binlog_sf.test File 2.67 KB 0644
binlog_simplified_binlog_gtid_recovery-master.opt File 16 B 0644
binlog_spurious_ddl_errors-master.opt File 29 B 0644
binlog_spurious_ddl_errors.test File 4.16 KB 0644
binlog_sql_mode.test File 4.75 KB 0644
binlog_start_comment.test File 1.01 KB 0644
binlog_statement_insert_delayed.test File 500 B 0644
binlog_stm_binlog-master.opt File 55 B 0644
binlog_stm_binlog.test File 740 B 0644
binlog_stm_blackhole.test File 267 B 0644
binlog_stm_cache_stat.test File 279 B 0644
binlog_stm_ctype_cp932.test File 317 B 0644
binlog_stm_ctype_ucs.test File 287 B 0644
binlog_stm_do_db-master.opt File 38 B 0644
binlog_stm_do_db.test File 2.8 KB 0644
binlog_stm_drop_tbl.test File 229 B 0644
binlog_stm_drop_tmp_tbl.test File 247 B 0644
binlog_stm_innodb_stat-master.opt File 26 B 0644
binlog_stm_insert_select.test File 291 B 0644
binlog_stm_mix_innodb_myisam-master.opt File 145 B 0644
binlog_stm_mix_innodb_myisam.test File 551 B 0644
binlog_stm_ps.test File 866 B 0644
binlog_stm_row.test File 3.12 KB 0644
binlog_stm_unsafe_warning-master.opt File 38 B 0644
binlog_stm_unsafe_warning.test File 5.61 KB 0644
binlog_stm_user_variables.test File 3.16 KB 0644
binlog_switch_inside_trans.test File 7.6 KB 0644
binlog_tmp_table.test File 4.43 KB 0644
binlog_truncate_innodb-master.opt File 15 B 0644
binlog_truncate_kill.test File 1.96 KB 0644
binlog_truncate_myisam.test File 316 B 0644
binlog_unsafe-master.opt File 65 B 0644
binlog_unsafe.test File 26.31 KB 0644
binlog_unsafe_stmt_capable_engine-master.opt File 41 B 0644
binlog_unsafe_stmt_capable_engine.test File 12.55 KB 0644
binlog_use_gtid_skip.test File 1.03 KB 0644
binlog_variables_log_bin-master.opt File 16 B 0644
binlog_variables_log_bin.test File 135 B 0644
binlog_variables_log_bin_index-master.opt File 70 B 0644
binlog_variables_log_bin_index.test File 135 B 0644
binlog_variables_relay_log-master.opt File 24 B 0644
binlog_variables_relay_log.test File 183 B 0644
binlog_variables_relay_log_index-master.opt File 86 B 0644
binlog_variables_relay_log_index.test File 183 B 0644
binlog_write_error.test File 2.37 KB 0644
binlog_xa_handling.test File 769 B 0644
disabled.def File 404 B 0644
show_binlog_events_no_lock.test File 2.27 KB 0644