1 ################################################################################
2 # inc/partition_check_drop.inc #
5 # Check that a drop table removes all files belonging to this table. #
6 # Remaining unused files can be caused by imperfect DROP TABLE or #
7 # ALTER TABLE <alter partitioning>. #
9 # This routine is only useful for the partition_<feature>_<engine> tests. #
11 #------------------------------------------------------------------------------#
12 # Original Author: mleich #
13 # Original Date: 2006-05-12 #
14 ################################################################################
21 # Get the MySQL Servers datadir without ending slash
22 let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
23 #echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
27 let $ls_file= $MYSQLD_DATADIR/
test/tmp2;
28 # List the files belonging to the table t1
29 --replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
30 --list_files_write_file $ls_file $MYSQLD_DATADIR/
test t1*
32 if ($with_directories)
34 --replace_result $MYSQLTEST_VARDIR \$MYSQLTEST_VARDIR #p# #P# #sp# #SP#
35 --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
37 eval SET @aux = load_file(
'$ls_file');
40 --remove_file $ls_file
44 SET @aux =
'--- not determined ---';
47 # UPDATE the current filelist of the table t1 within t0_definition
48 # Note: This list should be empty, because the table t1 was dropped !
49 eval INSERT INTO t0_definition SET state =
'old', file_list = @aux
50 ON DUPLICATE
KEY UPDATE file_list = @aux;
51 # eval UPDATE t0_definition SET file_list = @aux WHERE state = 'old';
53 # Check if filelist is empty.
54 let $found_garbage= `SELECT file_list <>
'' FROM t0_definition WHERE state =
'old'`;
57 # Unfortunately the DROP TABLE did not remove the unused files
60 --echo # Attention: There are unused files.
61 --echo # Either the DROP
TABLE or a preceding ALTER
TABLE
62 --echo # <alter partitioning> worked incomplete.
64 # Print the list of files into the protocol
65 eval SELECT file_list AS
"unified filelist"
66 FROM t0_definition WHERE state =
'old';
68 # Do a manual cleanup, because the following tests should not suffer from
70 --remove_files_wildcard $MYSQLD_DATADIR/
test t1*
71 if ($with_directories)
73 --remove_files_wildcard $MYSQLTEST_VARDIR/tmp t1*