Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions mysql-test/suite/rds/r/feature_file_purge_issue56496.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# File purge
#
SET @old_log_error_verbosity = @@global.log_error_verbosity;
SET @@global.log_error_verbosity=3;
SET @old_innodb_data_file_purge = @@global.innodb_data_file_purge;
SET @@global.innodb_data_file_purge = ON;
SET @old_innodb_print_data_file_purge_process = @@global.innodb_print_data_file_purge_process;
SET @@global.innodb_print_data_file_purge_process = ON;
SHOW GLOBAL VARIABLES LIKE '%data_file_purge%';
Variable_name Value
innodb_data_file_purge ON
innodb_data_file_purge_all_at_shutdown OFF
innodb_data_file_purge_dir
innodb_data_file_purge_immediate OFF
innodb_data_file_purge_interval 100
innodb_data_file_purge_max_size 512
innodb_print_data_file_purge_process ON
FLUSH LOGS;
#
# normal table
#
create database db_1;
use db_1;
create table t(id int, col1 int)engine = innodb;
drop table t;
drop database db_1;
#
# drop database
#
create database db_1;
use db_1;
create table t1(id int, col1 int)engine = innodb;
create table t2(id int, col1 int)engine = innodb;
drop database db_1;
#
# tablespace
#
create tablespace ts_1 add datafile 'ts_1.ibd' FILE_BLOCK_SIZE=1k;
drop tablespace ts_1;
#
# data directory
#
create database db_1;
use db_1;
CREATE TABLE t_3 (a int, b text) KEY_BLOCK_SIZE=1 DATA DIRECTORY='MYSQL_TMP_DIR';
drop table t_3;
drop database db_1;
File purge record:
SET @@global.log_error_verbosity=@old_log_error_verbosity;
SET @@global.innodb_data_file_purge=@old_innodb_data_file_purge;
SET @@global.innodb_print_data_file_purge_process = @old_innodb_print_data_file_purge_process;

###
### done
###
89 changes: 89 additions & 0 deletions mysql-test/suite/rds/r/feature_file_purge_issue56496_basic.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
SET global innodb_print_data_file_purge_process = ON;
SET global innodb_data_file_purge = ON;
SHOW GLOBAL VARIABLES LIKE '%data_file_purge%';
Variable_name Value
innodb_data_file_purge ON
innodb_data_file_purge_all_at_shutdown OFF
innodb_data_file_purge_dir
innodb_data_file_purge_immediate OFF
innodb_data_file_purge_interval 100
innodb_data_file_purge_max_size 512
innodb_print_data_file_purge_process ON
FLUSH LOGS;
SET SESSION debug= '+d, skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
# Test normal case.
CREATE TABLE t1(a INT, b INT, c INT, key(a), key(b));
TRUNCATE TABLE t1;
DROP TABLE t1;
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
# Test drop table crash/recovery rollback(before purge file)
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_crash_before_purge_file_log_counter_1';
CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
DROP TABLE t1;;
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
# Test drop table crash/recovery rollback(after purge file)
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_crash_after_purge_file_log_counter_1';
CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
DROP TABLE t1;;
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
# Test truncate table crash/recovery rollback(before purge file)
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_crash_before_purge_file_log_counter_1';
CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
TRUNCATE TABLE t1;;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
# Test drop table crash/recovery rollback(after purge file)
set global innodb_ddl_log_crash_reset_debug = 1;
set session debug = '+d, ddl_log_crash_after_purge_file_log_counter_1';
CREATE TABLE t1 (a INT, b INT, c INT, key(a), key(b));
TRUNCATE TABLE t1;;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
drop table t1;
SET SESSION debug= '+d,skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
SET GLOBAL innodb_ddl_log_crash_reset_debug = 0;
SET GLOBAL innodb_data_file_purge= 0;
SET GLOBAL innodb_print_data_file_purge_process = 0;

###
### done
###
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
call mtr.add_suppression("Cannot open temp data file for read-write");
SET global innodb_print_data_file_purge_process = ON;
SET global innodb_data_file_purge = ON;
SET global innodb_data_file_purge_all_at_shutdown = ON;
create database db_1;
use db_1;
SHOW GLOBAL VARIABLES LIKE '%data_file_purge%';
Variable_name Value
innodb_data_file_purge ON
innodb_data_file_purge_all_at_shutdown ON
innodb_data_file_purge_dir
innodb_data_file_purge_immediate OFF
innodb_data_file_purge_interval 100
innodb_data_file_purge_max_size 512
innodb_print_data_file_purge_process ON
FLUSH LOGS;
SET SESSION debug= '+d, skip_dd_table_access_check';
SELECT count(*) AS `Expected as 0` FROM mysql.innodb_ddl_log;
Expected as 0
0
# Test normal case.
CREATE TABLE t1(a INT, b INT, c INT, key(a), key(b)) engine = innodb;
TRUNCATE TABLE t1;
DROP TABLE t1;
show create table t1;
ERROR 42S02: Table 'db_1.t1' doesn't exist
# Test rename error
SET DEBUG='+d,Data_file_purge_rename_fail';
CREATE TABLE t1(a INT, b INT, c INT, key(a), key(b)) engine = innodb;
DROP TABLE t1;
show create table t1;
ERROR 42S02: Table 'db_1.t1' doesn't exist
SET DEBUG='-d,Data_file_purge_rename_fail';
CREATE TABLE t1(a INT, b INT, c INT, key(a), key(b)) engine = innodb;
DROP TABLE t1;
File purge cleanup completely
SET GLOBAL innodb_data_file_purge= 0;
SET GLOBAL innodb_data_file_purge_all_at_shutdown= 0;
SET GLOBAL innodb_print_data_file_purge_process = 0;
drop database db_1;

###
### done
###
95 changes: 95 additions & 0 deletions mysql-test/suite/rds/t/feature_file_purge_issue56496.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
--echo #
--echo # File purge
--echo #

SET @old_log_error_verbosity = @@global.log_error_verbosity;
SET @@global.log_error_verbosity=3;

SET @old_innodb_data_file_purge = @@global.innodb_data_file_purge;
SET @@global.innodb_data_file_purge = ON;

SET @old_innodb_print_data_file_purge_process = @@global.innodb_print_data_file_purge_process;
SET @@global.innodb_print_data_file_purge_process = ON;

SHOW GLOBAL VARIABLES LIKE '%data_file_purge%';

let $log_error_= `SELECT @@GLOBAL.log_error`;
if($log_error_ == "stderr")
{
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
FLUSH LOGS;


--echo #
--echo # normal table
--echo #

create database db_1;
use db_1;
create table t(id int, col1 int)engine = innodb;
drop table t;
drop database db_1;



--echo #
--echo # drop database
--echo #
create database db_1;
use db_1;
create table t1(id int, col1 int)engine = innodb;
create table t2(id int, col1 int)engine = innodb;
drop database db_1;

--echo #
--echo # tablespace
--echo #
create tablespace ts_1 add datafile 'ts_1.ibd' FILE_BLOCK_SIZE=1k;
drop tablespace ts_1;

--echo #
--echo # data directory
--echo #
create database db_1;
use db_1;

--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t_3 (a int, b text) KEY_BLOCK_SIZE=1 DATA DIRECTORY='$MYSQL_TMP_DIR';
drop table t_3;
drop database db_1;

--rmdir $MYSQL_TMP_DIR/db_1

let GREP_FILE=$log_error_;

--sleep 10

perl;
use strict;
use File::stat;
my $file= $ENV{'GREP_FILE'} or die("grep file not set");
my $pattern="File purge";
my $cnt = 0;

open(FILE, "$file") or die("Unable to open $file: $!");
while (<FILE>) {
my $line = $_;
if ($line =~ /$pattern/) {
$cnt++;
}
}
if ($cnt > 10) {
print "File purge record:\n";
}
close(FILE);
EOF

SET @@global.log_error_verbosity=@old_log_error_verbosity;
SET @@global.innodb_data_file_purge=@old_innodb_data_file_purge;
SET @@global.innodb_print_data_file_purge_process = @old_innodb_print_data_file_purge_process;

--echo
--echo ###
--echo ### done
--echo ###
Loading