mariadb/storage/maria/ma_test_recovery
unknown 2cc2f3e757 Generalized the way update and redo extends the size of a directory record.
storage/maria/ma_blockrec.c:
  Generalized the way update and redo extends the size of a directory record.
  This will (for now) ensure that data files are idenitical after normal run and after a apply-log run.
storage/maria/ma_open.c:
  Disabled reservation of transid on rows (for now) as these are not yet used.
  (I had to disable this as otherwise update thougth rows had grown in size when they hadn't and we had thus different row sizes on update and redo, which caused different block information)
storage/maria/ma_test1.c:
  Added comment
storage/maria/ma_test2.c:
  Do commit on error/abort
storage/maria/ma_test_all.sh:
  Some more testing (to cover a bug that was not found in previous runs)
storage/maria/ma_test_recovery:
  More tests
2007-08-31 10:19:54 +03:00

64 lines
1.9 KiB
Bash
Executable file

#!/bin/sh
set -e
silent="-s"
if [ -z "$maria_path" ]
then
maria_path="."
fi
tmp=$maria_path/tmp
if test '!' -d $tmp
then
mkdir $tmp
fi
echo "MARIA RECOVERY TESTS - success is if exit code is 0"
# runs a program inserting/deleting rows, then moves the resulting table
# elsewhere; applies the log and checks that the data file is
# identical to the saved original.
# Does not test the index file as we don't have logging for it yet.
for prog in "$maria_path/ma_test1 $silent -M -T -c" "$maria_path/ma_test2 $silent -L -K -W -P -M -T -c" "$maria_path/ma_test2 $silent -M -T -c -b"
do
rm -f maria_log.* maria_log_control
echo "TEST WITH $prog"
$prog
# derive table's name from program's name
table=`echo $prog | sed -e 's;.*ma_\(test[0-9]\).*;\1;' `
$maria_path/maria_chk -dvv $table > $tmp/maria_chk_message.good.txt 2>&1
checksum=`$maria_path/maria_chk -dss $table`
mv -f $table.MAD $tmp/$table.MAD.good
rm $table.MAI
echo "applying log"
$maria_path/maria_read_log -a > $tmp/maria_read_log_$table.txt
$maria_path/maria_chk -dvv $table > $tmp/maria_chk_message.txt 2>&1
cmp $table.MAD $tmp/$table.MAD.good
# QQ: Remove the following line when we also can recovert the index file
$maria_path/maria_chk -s -r $table
$maria_path/maria_chk -s -e $table
checksum2=`$maria_path/maria_chk -dss $table`
if test "$checksum" != "$checksum2"
then
echo "checksum differs for $table before and after recovery"
exit 1;
fi
# When "recovery of the table's state" is ready, we can test it like this:
# diff $tmp/maria_chk_message.good.txt $tmp/maria_chk_message.txt > $tmp/maria_chk_diff.txt || true
# if [ -s $tmp/maria_chk_diff.txt ]
# then
# echo "Differences in maria_chk -dvv, recovery not yet perfect !"
# echo "========DIFF START======="
# cat $tmp/maria_chk_diff.txt
# echo "========DIFF END======="
# fi
rm -f $table.* $tmp/maria_chk_*.txt $tmp/maria_read_log_$table.txt
done
echo "ALL RECOVERY TESTS OK"