partition_layout_check1.inc 3.41 KB
Newer Older
1
################################################################################
unknown's avatar
unknown committed
2
# inc/partition_layout_check1.inc                                          #
3 4 5 6 7 8
#                                                                              #
# Purpose:                                                                     #
#   Store the SHOW CREATE TABLE output and the list of files belonging to      #
#   this table + print this into the protocol                                  #
#   This script is only usefule when sourced within the partitioning tests.    #
#                                                                              #
unknown's avatar
unknown committed
9
# Attention: The routine inc/partition_layout_check2.inc is very similar   #
10 11 12 13
#            to this one. So if something has to be changed here it            #
#            might be necessary to do it also there                            #
#                                                                              #
#------------------------------------------------------------------------------#
unknown's avatar
unknown committed
14
# Original Author: mleich                                                      #
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
# Original Date: 2006-03-05                                                    #
# Change Author:                                                               #
# Change Date:                                                                 #
# Change:                                                                      #
################################################################################

if ($no_debug)
{
--disable_query_log
}
# Clean the table holding the definition of t1
DELETE FROM t0_definition;

# Dump the current definition of the table t1 to tmp1
# This complicated method - let another mysqltest collect the output - is used
# because of two reasons
# - SHOW CREATE TABLE t1 is at least currently most probably more reliable than
#   the corresponding SELECT on the INFORMATION_SCHEMA
# - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT
34
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $MYSQLTEST_VARDIR/mysqld.1/data/test/tmp1 2>&1 || true
35 36 37
if ($do_file_tests)
{
# List the files belonging to the table t1
38
--exec ls $MYSQLTEST_VARDIR/mysqld.1/data/test/t1* > $MYSQLTEST_VARDIR/mysqld.1/data/test/tmp2 2>&1 || true
39 40
if ($with_directories)
{
41 42
--exec ls $MYSQLTEST_VARDIR/mysqld.1/data/test/data/t1* >> $MYSQLTEST_VARDIR/mysqld.1/data/test/tmp2 2>&1 || true
--exec ls $MYSQLTEST_VARDIR/mysqld.1/data/test/index/t1* >> $MYSQLTEST_VARDIR/mysqld.1/data/test/tmp2 2>&1 || true
43
}
44
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/mysqld.1/data/test/tmp2''
45 46 47 48 49 50 51 52 53 54
)');
let $file_list= `SELECT @aux`;
}
if (!$do_file_tests)
{
let $file_list= '--- not determined ---';
}

# Insert the current definition of the table t1 into t0_definition
eval INSERT INTO t0_definition SET state = 'old',
55
     create_command = load_file('$MYSQLTEST_VARDIR/mysqld.1/data/test/tmp1'),
56 57 58
     file_list      = $file_list;

# Print the create table statement into the protocol
unknown's avatar
unknown committed
59
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
60 61 62 63 64 65 66 67 68 69 70 71 72
SELECT create_command FROM t0_definition WHERE state = 'old';
if ($do_file_tests)
{
   # We stored the list of files, therefore printing the content makes sense
   if ($ls)
   {
      # Print the list of files into the protocol
      eval SELECT REPLACE(file_list,'$MYSQLTEST_VARDIR','\$MYSQLTEST_VARDIR')
                  AS "unified filelist"
           FROM t0_definition WHERE state = 'old';
   }
}
--enable_query_log