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 #
17
################################################################################
26
# List the files belonging to the table t1
27
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
28
if ($with_directories)
30
--exec ls $MYSQLTEST_VARDIR/tmp/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
32
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')');
33
let $file_list= `SELECT @aux`;
37
let $file_list= '--- not determined ---';
40
# UPDATE the current filelist of the table t1 within t0_definition
41
# Note: This list should be empty, because the table t1 was dropped !
42
eval INSERT INTO t0_definition SET state = 'old', file_list = $file_list
43
ON DUPLICATE KEY UPDATE file_list = $file_list;
44
# eval UPDATE t0_definition SET file_list = $file_list WHERE state = 'old';
46
# Check if filelist is empty.
47
let $found_garbage= `SELECT file_list <> '' FROM t0_definition WHERE state = 'old'`;
50
# Unfortunately the DROP TABLE did not remove the unused files
53
--echo # Attention: There are unused files.
54
--echo # Either the DROP TABLE or a preceding ALTER TABLE
55
--echo # <alter partitioning> worked incomplete.
57
# Print the list of files into the protocol
58
eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
60
FROM t0_definition WHERE state = 'old';
62
# Do a manual cleanup, because the following tests should not suffer from
64
--exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true
65
if ($with_directories)
67
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true