mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
75 lines
2.7 KiB
Text
75 lines
2.7 KiB
Text
|
# Tests of Maria's recovery of the bitmap pages
|
||
|
|
||
|
--source include/not_embedded.inc
|
||
|
# Don't test this under valgrind, memory leaks will occur as we crash
|
||
|
--source include/not_valgrind.inc
|
||
|
# Binary must be compiled with debug for crash to occur
|
||
|
--source include/have_debug.inc
|
||
|
--source include/have_maria.inc
|
||
|
|
||
|
--disable_warnings
|
||
|
drop database if exists mysqltest;
|
||
|
--enable_warnings
|
||
|
create database mysqltest;
|
||
|
|
||
|
# Include scripts can perform SQL. For it to not influence the main test
|
||
|
# they use a separate connection. This way if they use a DDL it would
|
||
|
# not autocommit in the main test.
|
||
|
connect (admin, 127.0.0.1, root,,mysqltest,,);
|
||
|
--enable_reconnect
|
||
|
|
||
|
connection default;
|
||
|
use mysqltest;
|
||
|
--enable_reconnect
|
||
|
|
||
|
-- source include/maria_empty_logs.inc
|
||
|
let $mms_tables=1;
|
||
|
create table t1 (a varchar(10000)) engine=maria;
|
||
|
|
||
|
# we want recovery to use the tables as they were at time of crash
|
||
|
let $mvr_restore_old_snapshot=0;
|
||
|
# UNDO phase prevents physical comparison, normally,
|
||
|
# so we'll only use checksums to compare.
|
||
|
let $mms_compare_physically=0;
|
||
|
let $mvr_crash_statement= set global maria_checkpoint_interval=1;
|
||
|
|
||
|
--echo * TEST of over-allocated bitmap not flushed by checkpoint
|
||
|
let $mvr_debug_option="+d,maria_crash";
|
||
|
insert into t1 values ("bbbbbbb");
|
||
|
-- source include/maria_make_snapshot_for_comparison.inc
|
||
|
# make_snapshot_for_comparison closed the table, which lost its id.
|
||
|
# So we make a null operation just to give a short id to the table so
|
||
|
# that checkpoint includes table in checkpoint (otherwise nothing to
|
||
|
# test).
|
||
|
insert into t1 values ("bbbbbbb");
|
||
|
delete from t1 limit 1;
|
||
|
set session debug="+d,info,enter,exit,maria_over_alloc_bitmap";
|
||
|
send insert into t1 values ("aaaaaaaaa");
|
||
|
connection admin;
|
||
|
# Leave time for INSERT to block after modifying bitmap;
|
||
|
# in the future we should not use sleep but something like
|
||
|
# debug_sync_point().
|
||
|
sleep 5;
|
||
|
# force a checkpoint, which could, if buggy, flush over-allocated
|
||
|
# bitmap page; as REDO-UNDO was not written, bitmap and data page
|
||
|
# would be inconsistent. Correct checkpoint will wait until UNDO is
|
||
|
# written.
|
||
|
set global maria_checkpoint_interval=1;
|
||
|
-- source include/maria_verify_recovery.inc
|
||
|
|
||
|
--echo * TEST of bitmap flushed without REDO-UNDO in the log (WAL violation)
|
||
|
# before crashing we'll flush the bitmap page
|
||
|
let $mvr_debug_option="+d,maria_flush_bitmap,maria_crash";
|
||
|
-- source include/maria_make_snapshot_for_comparison.inc
|
||
|
lock tables t1 write;
|
||
|
insert into t1 values (REPEAT('a', 6000));
|
||
|
# bitmap of after-INSERT will be on disk, but data pages will not; if
|
||
|
# log is not flushed the bitmap is inconsistent with the data.
|
||
|
-- source include/maria_verify_recovery.inc
|
||
|
drop table t1;
|
||
|
|
||
|
# clean up everything
|
||
|
let $mms_purpose=comparison;
|
||
|
eval drop database mysqltest_for_$mms_purpose;
|
||
|
drop database mysqltest;
|