| 1 |
# Verify that contents of directory for databases |
| 2 |
# ndb_ddl_test and ndb_ddl_test2 match on all mysqld |
| 3 |
# |
| 4 |
|
| 5 |
echo == verify_mysql_dd.inc ==; |
| 6 |
|
| 7 |
# |
| 8 |
# Create empty file, serving as reference to show that the physical |
| 9 |
# data directory on disk is now empty. |
| 10 |
# |
| 11 |
let $empty_ref_file=$MYSQLTEST_VARDIR/tmp/ndb_ddl_empty_ref.txt; |
| 12 |
--write_file $empty_ref_file |
| 13 |
EOF |
| 14 |
|
| 15 |
|
| 16 |
# First create the reference file by selecting |
| 17 |
# the compare query into ref_file |
| 18 |
--connection mysqld1 |
| 19 |
let $ref_file=$MYSQLTEST_VARDIR/tmp/ndb_ddl_ref.txt; |
| 20 |
# Build query used to compare the tables in ndb_ddl_test and |
| 21 |
# ndb_ddl_test2 databases between all the servers, the query |
| 22 |
# selects from the DD by using information_schema tables. |
| 23 |
let $cmp_query= |
| 24 |
select TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE, ENGINE, TABLE_ROWS, |
| 25 |
AVG_ROW_LENGTH, DATA_LENGTH, MAX_DATA_LENGTH, INDEX_LENGTH, |
| 26 |
DATA_FREE, AUTO_INCREMENT, TABLE_COLLATION, CHECKSUM, |
| 27 |
CREATE_OPTIONS, TABLE_COMMENT |
| 28 |
from information_schema.tables |
| 29 |
where TABLE_SCHEMA = 'ndb_ddl_test' or |
| 30 |
TABLE_SCHEMA = 'ndb_ddl_test2' |
| 31 |
order by TABLE_SCHEMA, TABLE_NAME; |
| 32 |
#echo cmp_query: $cmp_query; |
| 33 |
--disable_query_log ONCE |
| 34 |
eval $cmp_query into outfile '$ref_file'; |
| 35 |
|
| 36 |
# Then iterate all mysqlds and check conditions |
| 37 |
let $i = $NUM_MYSQLDS; |
| 38 |
while($i) |
| 39 |
{ |
| 40 |
--connection mysqld$i |
| 41 |
|
| 42 |
# Check that output from compare query is the |
| 43 |
# same as the reference file |
| 44 |
let $file=$MYSQLTEST_VARDIR/tmp/ndb_ddl_$i.txt; |
| 45 |
--disable_query_log ONCE |
| 46 |
eval $cmp_query into outfile '$file'; |
| 47 |
--diff_files $ref_file $file |
| 48 |
--remove_file $file |
| 49 |
|
| 50 |
# Check that there are no files in the data directory |
| 51 |
# by listing files and compare with the empty file |
| 52 |
let $empty_file=$MYSQLTEST_VARDIR/tmp/ndb_ddl_empty_$i.txt; |
| 53 |
let $data_dir=`select @@datadir`; |
| 54 |
--list_files_write_file $empty_file $data_dir/ndb_ddl_test |
| 55 |
--list_files_append_file $empty_file $data_dir/ndb_ddl_test2 |
| 56 |
--diff_files $empty_ref_file $empty_file |
| 57 |
--remove_file $empty_file |
| 58 |
|
| 59 |
dec $i; |
| 60 |
} |
| 61 |
--remove_file $ref_file |
| 62 |
--remove_file $empty_ref_file |
| 63 |
|
| 64 |
connection default; |
| 65 |
|