2012-02-07 16:22:36 +01:00
|
|
|
--source include/have_innodb.inc
|
2010-11-03 16:54:38 +01:00
|
|
|
# Testing group commit by crashing a few times.
|
|
|
|
# Test adapted from the Facebook patch: lp:mysqlatfacebook
|
|
|
|
--source include/not_embedded.inc
|
|
|
|
# Don't test this under valgrind, memory leaks will occur
|
|
|
|
--source include/not_valgrind.inc
|
|
|
|
|
|
|
|
# Binary must be compiled with debug for crash to occur
|
|
|
|
--source include/have_debug.inc
|
|
|
|
--source include/have_log_bin.inc
|
|
|
|
|
|
|
|
CREATE TABLE t1(a CHAR(255),
|
|
|
|
b CHAR(255),
|
|
|
|
c CHAR(255),
|
|
|
|
d CHAR(255),
|
2012-03-28 01:04:46 +02:00
|
|
|
id INT,
|
2010-11-03 16:54:38 +01:00
|
|
|
PRIMARY KEY(id)) ENGINE=InnoDB;
|
|
|
|
create table t2 like t1;
|
|
|
|
delimiter //;
|
2017-11-28 09:40:13 +01:00
|
|
|
create procedure setcrash(IN i INT)
|
2010-11-03 16:54:38 +01:00
|
|
|
begin
|
|
|
|
CASE i
|
2017-11-28 09:40:13 +01:00
|
|
|
WHEN 1 THEN SET SESSION debug_dbug="d,crash_commit_after_prepare";
|
|
|
|
WHEN 2 THEN SET SESSION debug_dbug="d,crash_commit_after_log";
|
|
|
|
WHEN 3 THEN SET SESSION debug_dbug="d,crash_commit_before_unlog";
|
|
|
|
WHEN 4 THEN SET SESSION debug_dbug="d,crash_commit_after";
|
|
|
|
WHEN 5 THEN SET SESSION debug_dbug="d,crash_commit_before";
|
2010-11-03 16:54:38 +01:00
|
|
|
ELSE BEGIN END;
|
|
|
|
END CASE;
|
|
|
|
end //
|
|
|
|
delimiter ;//
|
|
|
|
# Avoid getting a crashed mysql.proc table.
|
|
|
|
FLUSH TABLES;
|
|
|
|
|
|
|
|
let $numtests = 5;
|
|
|
|
|
|
|
|
let $numinserts = 10;
|
|
|
|
while ($numinserts)
|
|
|
|
{
|
|
|
|
dec $numinserts;
|
2012-03-28 01:04:46 +02:00
|
|
|
eval INSERT INTO t2(a, b, c, d, id) VALUES ('a', 'b', 'c', 'd', $numinserts+1);
|
2010-11-03 16:54:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
--enable_reconnect
|
|
|
|
|
|
|
|
while ($numtests)
|
|
|
|
{
|
2010-11-08 09:11:44 +01:00
|
|
|
SET binlog_format= mixed;
|
2010-11-03 16:54:38 +01:00
|
|
|
RESET MASTER;
|
|
|
|
|
|
|
|
START TRANSACTION;
|
|
|
|
insert into t1 select * from t2;
|
|
|
|
# Write file to make mysql-test-run.pl expect crash
|
MDEV-16944 Fix file sharing issues on Windows in mysqltest
On Windows systems, occurrences of ERROR_SHARING_VIOLATION due to
conflicting share modes between processes accessing the same file can
result in CreateFile failures.
mysys' my_open() already incorporates a workaround by implementing
wait/retry logic on Windows.
But this does not help if files are opened using shell redirection like
mysqltest traditionally did it, i.e via
--echo exec "some text" > output_file
In such cases, it is cmd.exe, that opens the output_file, and it
won't do any sharing-violation retries.
This commit addresses the issue by introducing a new built-in command,
'write_line', in mysqltest. This new command serves as a brief alternative
to 'write_file', with a single line output, that also resolves variables
like "exec" would.
Internally, this command will use my_open(), and therefore retry-on-error
logic.
Hopefully this will eliminate the very sporadic "can't open file because
it is used by another process" error on CI.
2024-04-15 15:46:50 +02:00
|
|
|
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
|
2010-11-03 16:54:38 +01:00
|
|
|
|
2017-11-28 09:40:13 +01:00
|
|
|
eval call setcrash($numtests);
|
|
|
|
|
2010-11-03 16:54:38 +01:00
|
|
|
# Run the crashing query
|
|
|
|
--error 2006,2013
|
|
|
|
COMMIT;
|
|
|
|
|
|
|
|
# Poll the server waiting for it to be back online again.
|
|
|
|
--source include/wait_until_connected_again.inc
|
|
|
|
|
|
|
|
# table and binlog should be in sync.
|
|
|
|
SELECT * FROM t1 ORDER BY id;
|
2011-01-27 15:56:44 +01:00
|
|
|
--replace_column 2 # 5 #
|
2013-03-26 10:35:34 +01:00
|
|
|
SHOW BINLOG EVENTS LIMIT 4,1;
|
2010-11-03 16:54:38 +01:00
|
|
|
|
|
|
|
delete from t1;
|
|
|
|
|
|
|
|
dec $numtests;
|
|
|
|
}
|
|
|
|
|
|
|
|
# final cleanup
|
|
|
|
DROP TABLE t1;
|
|
|
|
DROP TABLE t2;
|
2017-11-28 09:40:13 +01:00
|
|
|
DROP PROCEDURE setcrash;
|