mariadb/mysql-test/suite/atomic/create_trigger.test
Monty e5b6db0179 Speed up atomic test suite by improving wait_until_connected_again.inc
and remove usage of RESET MASTER in loops.

- Remove sleep of 0.1 second that was done even when not needed.
- Don't call include/wait_wsrep_ready.inc if NO_WSREP is defined.
- Added NO_WSREP=1 to all atomic tests.
- Use 'select 1' instead of 'show status' to check is server is up.
- Changed RESET MASTER to FLUSH BINARY LOGS to speed up atomic tests.
  To be able to do this, added a new parameter variable to
  show_events.inc to allow one to specify the name of the binary log
  in the output.
2021-05-24 21:04:40 +03:00

137 lines
3.4 KiB
Text

--source include/have_debug.inc
--source include/have_log_bin.inc
--source include/not_valgrind.inc
# Speed up wait_until_connected_again.inc
let NO_WSREP=1;
RESET MASTER;
#
# Testing of atomic CREATE TRIGGER with crashes in a lot of different places
#
let $MYSQLD_DATADIR= `SELECT @@datadir`;
let $engine_count=1;
let $engines='aria';
let $crash_count=6;
let $crash_points='ddl_log_create_before_create_trigger', 'ddl_log_create_after_create_trigger', 'definition_file_after_create', 'ddl_log_drop_before_binlog', 'ddl_log_drop_after_binlog','ddl_log_drop_before_delete_tmp';
let $old_debug=`select @@debug_dbug`;
let $e=0;
let $keep_include_silent=1;
let $grep_script=CREATE.*TRIGGER;
let $drops=3;
--disable_query_log
while ($e < $engine_count)
{
inc $e;
let $engine=`select ELT($e, $engines)`;
let $default_engine=$engine;
let $extra_option=;
if ($engine == "aria")
{
let $extra_option=transactional=1;
}
if ($engine == "aria_notrans")
{
let $default_engine="aria";
let $extra_option=transactional=0;
}
--eval set @@default_storage_engine=$default_engine
--eval create table t1 (a int not null, b int not null) $extra_option;
insert into t1 values(1,1);
flush tables;
let $c=0;
while ($c < $crash_count)
{
inc $c;
let $crash=`select ELT($c, $crash_points)`;
let $r=0;
while ($r < $drops)
{
inc $r;
FLUSH BINARY LOGS;
--let $start_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
echo "engine: $engine crash point: $crash position: $r";
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--disable_reconnect
--eval set @@debug_dbug="+d,$crash",@debug_crash_counter=$r
let $errno=0;
delimiter |;
--error 0,2013
CREATE TRIGGER t1_trg before insert on t1 for each row
begin
if isnull(new.a) then
set new.a:= 1000;
end if;
end|
delimiter ;|
let $error=$errno;
if ($error == 0)
{
delimiter |;
--error 0,2013
CREATE OR REPLACE TRIGGER t2_trg before insert on t1 for each row
begin
if isnull(new.b) then
set new.b:= 2000;
end if;
end|
delimiter ;|
let $error=$errno;
}
if ($error == 0)
{
delimiter |;
--error 0,2013
CREATE OR REPLACE TRIGGER t2_trg before insert on t1 for each row
begin
if isnull(new.b) then
set new.b:= 3000;
end if;
end|
delimiter ;|
let $error=$errno;
}
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_query_log
--eval set @@debug_dbug="$old_debug"
if ($error == 0)
{
echo "No crash!";
}
# Check which tables still exists
--list_files $MYSQLD_DATADIR/test *TR*
--list_files $MYSQLD_DATADIR/test *sql*
--replace_column 7 #
--error 0,ER_TRG_DOES_NOT_EXIST
SHOW CREATE TRIGGER t1_trg;
--replace_column 7 #
--error 0,ER_TRG_DOES_NOT_EXIST
SHOW CREATE TRIGGER t2_trg;
--let $binlog_file=$start_binlog_file
--let $binlog_output_name=master-bin.000001
--source include/show_binlog_events.inc
--disable_warnings
drop trigger if exists t1_trg;
drop trigger if exists t2_trg;
--enable_warnings
}
}
}
drop table t1;
--enable_query_log