~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

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
################################################################################
 
15
 
 
16
if ($no_debug)
 
17
{
 
18
   --disable_query_log
 
19
}
 
20
 
 
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;
 
24
 
 
25
if ($do_file_tests)
 
26
{
 
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*
 
30
  --chmod 0644 $ls_file
 
31
  if ($with_directories)
 
32
  {
 
33
    --list_files_append_file $ls_file $MYSQLTEST_VARDIR/tmp t1*
 
34
  }
 
35
  eval SET @aux = load_file('$ls_file');
 
36
 
 
37
  # clean up
 
38
  remove_file $ls_file;
 
39
}
 
40
if (!$do_file_tests)
 
41
{
 
42
  SET @aux = '--- not determined ---';
 
43
}
 
44
 
 
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';
 
50
 
 
51
# Check if filelist is empty.
 
52
let $found_garbage= `SELECT file_list <> '' FROM t0_definition WHERE state = 'old'`;
 
53
if ($found_garbage)
 
54
{
 
55
   # Unfortunately the DROP TABLE did not remove the unused files
 
56
   if ($ls)
 
57
   {
 
58
      --echo # Attention: There are unused files.
 
59
      --echo #            Either the DROP TABLE or a preceding ALTER TABLE
 
60
      --echo #            <alter partitioning> worked incomplete.
 
61
      --echo # We found:
 
62
      # Print the list of files into the protocol
 
63
      eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
 
64
                  AS "unified filelist"
 
65
           FROM t0_definition WHERE state = 'old';
 
66
   }
 
67
   # Do a manual cleanup, because the following tests should not suffer from
 
68
   # remaining files
 
69
   --exec rm -f $MYSQLD_DATADIR/test/t1* || true
 
70
   if ($with_directories)
 
71
   {
 
72
           --exec rm -f $MYSQLTEST_VARDIR/tmp/t1* || true
 
73
   }
 
74
}
 
75
--enable_query_log