1# Maria helper script 2# Copies table' data and index file to other directory, or back, or compares. 3# The other directory looks like a database directory, so that we can 4# read copies from inside mysqld, that's also why we copy the frm. 5 6# "mms" is a namespace for Maria_Make_Snapshot 7 8# API: 9# 1) set one of 10# $mms_copy : to copy table from database to spare directory 11# $mms_reverse : to copy it back 12# $mms_compare_physically : to compare both byte-for-byte 13# 2) set $mms_tname to a string and set $mms_table_to_use to a number: tables 14# will be mysqltest.$mms_tname$mms_table_to_use. 15# 3) set $mms_purpose to say what this copy is for (influences the naming 16# of the spare directory). 17 18if ($mms_copy) 19{ 20 --echo * copied $mms_tname$mms_table_to_use for $mms_purpose 21 copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; 22 copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; 23 copy_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.frm $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.frm; 24} 25 26if ($mms_reverse_copy) 27{ 28 # do not call this without flushing target table first! 29 --disable_warnings 30 --echo * copied $mms_tname$mms_table_to_use back for $mms_purpose 31 -- error 0,1 32 remove_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD; 33 --enable_warnings 34 copy_file $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD; 35 --disable_warnings 36 -- error 0,1 37 remove_file $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI; 38 --enable_warnings 39 copy_file $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI; 40} 41 42if ($mms_compare_physically) 43{ 44 # After the UNDO phase this is normally impossible 45 # (UNDO execution has created new log records => pages have new LSNs). 46 # So, do this only when testing REDO phase. 47 # If UNDO phase, we nevertheless compare checksums 48 # (see maria_verify_recovery.inc). 49 --echo * compared $mms_tname$mms_table_to_use to old version 50 diff_files $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAD $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAD; 51# index file not yet recovered 52# diff_files $MYSQLD_DATADIR/mysqltest/$mms_tname$mms_table_to_use.MAI $MYSQLD_DATADIR/mysqltest_for_$mms_purpose/$mms_tname$mms_table_to_use.MAI; 53} 54