~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/suite/parts/inc/partition_layout_check2.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_layout_check2.inc                                              #
 
3
#                                                                              #
 
4
# Purpose:                                                                     #
 
5
#   Store the SHOW CREATE TABLE output and the list of files belonging to      #
 
6
#   this table + Check if the layout of the table was not modified             #
 
7
#   since the call of inc/partition_layout_check1.inc                          #
 
8
#   This script is only usefule when sourced within the partitioning tests.    #
 
9
#                                                                              #
 
10
# Attention: The routine inc/partition_layout_check1.inc is very similar   #
 
11
#            to this one. So if something has to be changed here it            #
 
12
#            might be necessary to do it also there                            #
 
13
#                                                                              #
 
14
#------------------------------------------------------------------------------#
 
15
# Original Author: mleich                                                      #
 
16
# Original Date: 2006-03-05                                                    #
 
17
# Change Author:                                                               #
 
18
# Change Date:                                                                 #
 
19
# Change:                                                                      #
 
20
################################################################################
 
21
 
 
22
if ($no_debug)
 
23
{
 
24
--disable_query_log
 
25
}
 
26
# Clean the table holding the definition of t1
 
27
DELETE FROM t0_definition WHERE state = 'new';
 
28
 
 
29
# Dump the current definition of the table t1 to tmp1
 
30
--exec echo "SHOW CREATE TABLE t1;" | $MYSQL_TEST > $MYSQLTEST_VARDIR/master-data/test/tmp1 2>&1 || true
 
31
if ($do_file_tests)
 
32
{
 
33
# List the files belonging to the table t1
 
34
--exec ls $MYSQLTEST_VARDIR/master-data/test/t1* > $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
 
35
if ($with_directories)
 
36
{
 
37
--exec ls $MYSQLTEST_VARDIR/mysql-test-data-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
 
38
--exec ls $MYSQLTEST_VARDIR/mysql-test-idx-dir/t1* >> $MYSQLTEST_VARDIR/master-data/test/tmp2 2>&1 || true
 
39
}
 
40
eval SET @aux = CONCAT('load_file(''$MYSQLTEST_VARDIR','/master-data/test/tmp2'')');
 
41
let $file_list= `SELECT @aux`;
 
42
}
 
43
if (!$do_file_tests)
 
44
{
 
45
let $file_list= '--- not determined ---';
 
46
}
 
47
 
 
48
# Insert the current definition of the table t1 into t0_definition
 
49
eval INSERT INTO t0_definition SET state = 'new',
 
50
     create_command = load_file('$MYSQLTEST_VARDIR/master-data/test/tmp1'),
 
51
     file_list      = $file_list;
 
52
 
 
53
# Print the old and new table layout, if they differ
 
54
SELECT COUNT(*) <> 1 INTO @aux
 
55
FROM t0_definition tab1, t0_definition tab2
 
56
WHERE tab1.state = 'old' AND tab2.state = 'new'
 
57
  AND tab1.create_command = tab2.create_command
 
58
  AND tab1.file_list = tab2.file_list;
 
59
let $run= `SELECT @aux`;
 
60
if ($run)
 
61
{
 
62
   --vertical_results
 
63
   --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
64
   SELECT state,
 
65
   REPLACE(create_command,'\n',' ') AS "Table definition",
 
66
   REPLACE(file_list     ,'\n',' ') AS "File list"
 
67
   FROM t0_definition WHERE state in ('old','new');
 
68
   --horizontal_results
 
69
   --echo # check layout success:    0
 
70
}
 
71
let $run= `SELECT @aux = 0`;
 
72
if ($run)
 
73
{
 
74
   --echo # check layout success:    1
 
75
}
 
76
--enable_query_log