1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
|
--echo #
--echo # InnoDB supports CREATE/ALTER/DROP UNDO TABLESPACE
--echo #
--source include/windows.inc
--source include/have_innodb_default_undo_tablespaces.inc
# Do a slow shutdown and restart to clear out the undo logs
SET GLOBAL innodb_fast_shutdown = 0;
--let $shutdown_server_timeout = 300
--source include/restart_mysqld.inc
--echo #
--echo # Try CREATE UNDO TABLESPACE commands that respond differently on Windows
--echo #
--echo # Cannot embed a newline character into windows file name
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_CREATE_FILEGROUP_FAILED
CREATE UNDO TABLESPACE undo_99 ADD DATAFILE 'undo_\n_99.ibu';
--replace_result \\ /
SHOW WARNINGS;
--echo # Cannot embed a CR character into windows file name
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_CREATE_FILEGROUP_FAILED
CREATE UNDO TABLESPACE undo_99 ADD DATAFILE 'undo_\r_99.ibu';
--replace_result \\ /
SHOW WARNINGS;
--echo # Cannot embed a tab character into a windows file name
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
--error ER_CREATE_FILEGROUP_FAILED
CREATE UNDO TABLESPACE undo_99 ADD DATAFILE 'undo_\t_99.ibu';
--replace_result \\ /
SHOW WARNINGS;
--echo #
--echo # Cleanup
--echo #
--disable_query_log
call mtr.add_suppression("\\[ERROR\\] .* File .*undo.*");
call mtr.add_suppression("\\[ERROR\\] .* Operating system error number 123 in a file operation");
call mtr.add_suppression("\\[ERROR\\] .* Can't create UNDO tablespace undo_99");
--enable_query_log
--echo #
--echo # InnoDB Test UNDO Tablespace truncation on Windows while the tablespace
--echo # file is externally opened with and without FILE_SHARE_DELETE flag.
--echo #
let $MYSQLD_DATADIR= `select @@datadir`;
let $lock_perl_script = $MYSQL_TMP_DIR\lock_tablespace.perl;
write_file $lock_perl_script;
use Win32API::File 0.08 qw( :ALL );
my $path = $ARGV[0];
my $share = $ARGV[1];
my $hFile = createFile($path, "re", $share) or die "Can't open $path file";
sleep(10);
CloseHandle($hFile);
EOF
CREATE TABLE t1 (id INT) ENGINE=InnoDB;
CREATE UNDO TABLESPACE undo_003 ADD DATAFILE 'undo_003.ibu';
# Test without FILE_SHARE_DELETE flag
--exec_in_background perl $lock_perl_script "$MYSQLD_DATADIR\\undo_003.ibu" "rw"
let $n=10;
begin;
while ($n > 0)
{
--error 0,1533
ALTER UNDO TABLESPACE undo_003 SET INACTIVE;
# We can't have the include/wait_until_undo_space_is_empty.inc here, as it
# requires the SET INACTIVE to succeed, while it should fail.
--sleep 1
# A write ensures the purge is executed and the tablespace truncation is
# re-attempted.
INSERT INTO t1 VALUES (1);
--error 0,1533
ALTER UNDO TABLESPACE undo_003 SET ACTIVE;
dec $n;
}
# Wait for the perl script's 10s sleep to finish.
--sleep 5
# Now the truncation and deletion should work just fine.
ALTER UNDO TABLESPACE undo_003 SET INACTIVE;
let $inactive_undo_space = undo_003;
source include/wait_until_undo_space_is_empty.inc;
ALTER UNDO TABLESPACE undo_003 SET ACTIVE;
# Test with FILE_SHARE_DELETE flag
--exec_in_background perl $lock_perl_script "$MYSQLD_DATADIR\\undo_003.ibu" "rwd"
let $n=10;
begin;
while ($n > 0)
{
# Alter should succeed, the file should be renamed and all operations work as
# intended.
ALTER UNDO TABLESPACE undo_003 SET INACTIVE;
# We can't have the include/wait_until_undo_space_is_empty.inc here, as it
# requires the SET INACTIVE to succeed, while it should fail.
--sleep 1
# A write ensures the purge is executed and the tablespace truncation is
# re-attempted.
INSERT INTO t1 VALUES (1);
ALTER UNDO TABLESPACE undo_003 SET ACTIVE;
dec $n;
}
# Wait for the perl script's 10s sleep to finish.
--sleep 5
# Now the truncation and deletion should work just fine.
ALTER UNDO TABLESPACE undo_003 SET INACTIVE;
let $inactive_undo_space = undo_003;
source include/wait_until_undo_space_is_empty.inc;
DROP UNDO TABLESPACE undo_003;
DROP TABLE t1;
--remove_file $lock_perl_script
--disable_query_log
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* \\[InnoDB\\] Operating system error number 32 in a file operation");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* \\[InnoDB\\] Operating system error number 80 in a file operation");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* \\[InnoDB\\] The error means that another program is using InnoDB's files.");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* \\[InnoDB\\] Cannot create file '\..undo_003.ibu'");
call mtr.add_suppression("\\[ERROR\\] .*MY-\\d+.* \\[InnoDB\\] The file '\..undo_003.ibu' already exists though the corresponding table did not exist.");
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* \\[InnoDB\\] Failed to delete file '\..undo_003.ibu'. Please check if any other process is using it.");
call mtr.add_suppression("\\[Warning\\] .*MY-\\d+.* \\[InnoDB\\] Failed to truncate undo tablespace 'undo_003'");
--enable_query_log
|