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
--list_files_write_file $ls_file $MYSQLD_DATADIR/test t1*
31
if ($with_directories)
33
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
35
eval SET @aux = load_file('$ls_file');
42
SET @aux = '--- not determined ---';
45
# UPDATE the current filelist of the table t1 within t0_definition
46
# Note: This list should be empty, because the table t1 was dropped !
47
eval INSERT INTO t0_definition SET state = 'old', file_list = @aux
48
ON DUPLICATE KEY UPDATE file_list = @aux;
49
# eval UPDATE t0_definition SET file_list = @aux WHERE state = 'old';
51
# Check if filelist is empty.
52
let $found_garbage= `SELECT file_list <> '' FROM t0_definition WHERE state = 'old'`;
55
# Unfortunately the DROP TABLE did not remove the unused files
58
--echo # Attention: There are unused files.
59
--echo # Either the DROP TABLE or a preceding ALTER TABLE
60
--echo # <alter partitioning> worked incomplete.
62
# Print the list of files into the protocol
63
eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
65
FROM t0_definition WHERE state = 'old';
67
# Do a manual cleanup, because the following tests should not suffer from
69
--exec rm -f $MYSQLD_DATADIR/test/t1* || true
70
if ($with_directories)
72
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true