| 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 |
################################################################################ |
| 18 |
|
| 19 |
if ($no_debug) |
| 20 |
{ |
| 21 |
--disable_query_log |
| 22 |
} |
| 23 |
# Clean the table holding the definition of t1 |
| 24 |
DELETE FROM t0_definition WHERE state = 'new'; |
| 25 |
|
| 26 |
|
| 27 |
# Get the MySQL Servers datadir without ending slash |
| 28 |
let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`; |
| 29 |
#echo MYSQLD_DATADIR: $MYSQLD_DATADIR; |
| 30 |
|
| 31 |
# Save the current definition of the table t1 |
| 32 |
let $show_create= `SHOW CREATE TABLE t1`; |
| 33 |
|
| 34 |
if ($do_file_tests) |
| 35 |
{ |
| 36 |
# List the files belonging to the table t1 |
| 37 |
let $ls_file= $MYSQLD_DATADIR/test/tmp2; |
| 38 |
--list_files_write_file $ls_file $MYSQLD_DATADIR/test t1* |
| 39 |
--chmod 0644 $ls_file |
| 40 |
if ($with_directories) |
| 41 |
{ |
| 42 |
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-data-dir t1* |
| 43 |
--list_files_append_file $ls_file $MYSQLTEST_VARDIR/mysql-test-idx-dir t1* |
| 44 |
} |
| 45 |
eval SET @aux = load_file('$ls_file'); |
| 46 |
|
| 47 |
# clean up |
| 48 |
--remove_file $ls_file |
| 49 |
} |
| 50 |
if (!$do_file_tests) |
| 51 |
{ |
| 52 |
SET @aux = '--- not determined ---'; |
| 53 |
} |
| 54 |
|
| 55 |
# Insert the current definition of the table t1 into t0_definition |
| 56 |
eval INSERT INTO t0_definition SET state = 'new', |
| 57 |
create_command = "$show_create", |
| 58 |
file_list = @aux; |
| 59 |
|
| 60 |
# Print the old and new table layout, if they differ |
| 61 |
SELECT COUNT(*) <> 1 INTO @aux |
| 62 |
FROM t0_definition tab1, t0_definition tab2 |
| 63 |
WHERE tab1.state = 'old' AND tab2.state = 'new' |
| 64 |
AND tab1.create_command = tab2.create_command |
| 65 |
AND tab1.file_list = tab2.file_list; |
| 66 |
let $run= `SELECT @aux`; |
| 67 |
if ($run) |
| 68 |
{ |
| 69 |
--vertical_results |
| 70 |
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR #p# #P# #sp# #SP# |
| 71 |
SELECT state, |
| 72 |
REPLACE(create_command,'\n',' ') AS "Table definition", |
| 73 |
REPLACE(file_list ,'\n',' ') AS "File list" |
| 74 |
FROM t0_definition WHERE state in ('old','new'); |
| 75 |
--horizontal_results |
| 76 |
--echo # check layout success: 0 |
| 77 |
} |
| 78 |
let $run= `SELECT @aux = 0`; |
| 79 |
if ($run) |
| 80 |
{ |
| 81 |
--echo # check layout success: 1 |
| 82 |
} |
| 83 |
--enable_query_log |