| 1 |
# Tests of Aria's recovery of the bitmap pages |
| 2 |
|
| 3 |
--source include/not_embedded.inc |
| 4 |
# Don't test this under valgrind, memory leaks will occur as we crash |
| 5 |
--source include/not_valgrind.inc |
| 6 |
# Binary must be compiled with debug for crash to occur |
| 7 |
--source include/have_debug.inc |
| 8 |
--source include/have_maria.inc |
| 9 |
|
| 10 |
--disable_warnings |
| 11 |
drop database if exists mysqltest; |
| 12 |
--enable_warnings |
| 13 |
create database mysqltest; |
| 14 |
let $mms_tname=t; |
| 15 |
|
| 16 |
# Include scripts can perform SQL. For it to not influence the main test |
| 17 |
# they use a separate connection. This way if they use a DDL it would |
| 18 |
# not autocommit in the main test. |
| 19 |
connect (admin, localhost, root,,mysqltest,,); |
| 20 |
--enable_reconnect |
| 21 |
|
| 22 |
connection default; |
| 23 |
use mysqltest; |
| 24 |
--enable_reconnect |
| 25 |
|
| 26 |
-- source include/maria_empty_logs.inc |
| 27 |
let $mms_tables=1; |
| 28 |
create table t1 (a varchar(10000)) engine=aria; |
| 29 |
|
| 30 |
# we want recovery to use the tables as they were at time of crash |
| 31 |
let $mvr_restore_old_snapshot=0; |
| 32 |
# UNDO phase prevents physical comparison, normally, |
| 33 |
# so we'll only use checksums to compare. |
| 34 |
let $mms_compare_physically=0; |
| 35 |
let $mvr_crash_statement= set global aria_checkpoint_interval=1; |
| 36 |
|
| 37 |
--echo * TEST of over-allocated bitmap not flushed by checkpoint |
| 38 |
let $mvr_debug_option="+d,maria_crash"; |
| 39 |
insert into t1 values ("bbbbbbb"); |
| 40 |
-- source include/maria_make_snapshot_for_comparison.inc |
| 41 |
# make_snapshot_for_comparison closed the table, which lost its id. |
| 42 |
# So we make a null operation just to give a short id to the table so |
| 43 |
# that checkpoint includes table in checkpoint (otherwise nothing to |
| 44 |
# test). |
| 45 |
insert into t1 values ("bbbbbbb"); |
| 46 |
delete from t1 limit 1; |
| 47 |
# Use a separate connection here. The reason is that we leave a dangling |
| 48 |
# --send on the connection during aria_verify_recovery.inc, which makes that |
| 49 |
# script fail if it were to try to use that connection before --reap. |
| 50 |
connect (extra, localhost, root,,mysqltest,,); |
| 51 |
set session debug_dbug="+d,info,enter,exit,maria_over_alloc_bitmap"; |
| 52 |
send insert into t1 values ("aaaaaaaaa"); |
| 53 |
connection admin; |
| 54 |
# Leave time for INSERT to block after modifying bitmap; |
| 55 |
# in the future we should not use sleep but something like |
| 56 |
# debug_sync_point(). |
| 57 |
sleep 5; |
| 58 |
# force a checkpoint, which could, if buggy, flush over-allocated |
| 59 |
# bitmap page; as REDO-UNDO was not written, bitmap and data page |
| 60 |
# would be inconsistent. Correct checkpoint will wait until UNDO is |
| 61 |
# written. |
| 62 |
set global aria_checkpoint_interval=1; |
| 63 |
-- source include/maria_verify_recovery.inc |
| 64 |
connection default; |
| 65 |
|
| 66 |
--echo * TEST of bitmap flushed without REDO-UNDO in the log (WAL violation) |
| 67 |
# before crashing we'll flush the bitmap page |
| 68 |
let $mvr_debug_option="+d,maria_flush_bitmap,maria_crash"; |
| 69 |
-- source include/maria_make_snapshot_for_comparison.inc |
| 70 |
lock tables t1 write; |
| 71 |
insert into t1 values (REPEAT('a', 6000)); |
| 72 |
# bitmap of after-INSERT will be on disk, but data pages will not; if |
| 73 |
# log is not flushed the bitmap is inconsistent with the data. |
| 74 |
-- source include/maria_verify_recovery.inc |
| 75 |
drop table t1; |
| 76 |
|
| 77 |
# clean up everything |
| 78 |
let $mms_purpose=comparison; |
| 79 |
eval drop database mysqltest_for_$mms_purpose; |
| 80 |
drop database mysqltest; |