~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/inc/partition_check_drop.inc

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################################################################################
 
2
# inc/partition_check_drop.inc                                                 #
 
3
#                                                                              #
 
4
# Purpose:                                                                     #
 
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>.                                          #
 
8
#                                                                              #
 
9
#   This routine is only useful for the partition_<feature>_<engine> tests.    #
 
10
#                                                                              #
 
11
#------------------------------------------------------------------------------#
 
12
# Original Author: mleich                                                      #
 
13
# Original Date: 2006-05-12                                                    #
 
14
# Change Author:                                                               #
 
15
# Change Date:                                                                 #
 
16
# Change:                                                                      #
 
17
################################################################################
 
18
 
 
19
if ($no_debug)
 
20
{
 
21
   --disable_query_log
 
22
}
 
23
 
 
24
if ($do_file_tests)
 
25
{
 
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)
 
29
{
 
30
--exec ls $MYSQLTEST_VARDIR/tmp/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 || true
 
31
}
 
32
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')');
 
33
let $file_list= `SELECT @aux`;
 
34
}
 
35
if (!$do_file_tests)
 
36
{
 
37
let $file_list= '--- not determined ---';
 
38
}
 
39
 
 
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';
 
45
 
 
46
# Check if filelist is empty.
 
47
let $found_garbage= `SELECT file_list <> '' FROM t0_definition WHERE state = 'old'`;
 
48
if ($found_garbage)
 
49
{
 
50
   # Unfortunately the DROP TABLE did not remove the unused files
 
51
   if ($ls)
 
52
   {
 
53
      --echo # Attention: There are unused files.
 
54
      --echo #            Either the DROP TABLE or a preceding ALTER TABLE
 
55
      --echo #            <alter partitioning> worked incomplete.
 
56
      --echo # We found:
 
57
      # Print the list of files into the protocol
 
58
      eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
 
59
                  AS "unified filelist"
 
60
           FROM t0_definition WHERE state = 'old';
 
61
   }
 
62
   # Do a manual cleanup, because the following tests should not suffer from
 
63
   # remaining files
 
64
   --exec rm -f $MYSQLTEST_VARDIR/master-data/test/t1* || true
 
65
   if ($with_directories)
 
66
   {
 
67
           --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
 
68
   }
 
69
}
 
70
--enable_query_log