summaryrefslogtreecommitdiff
path: root/mysql-test/suite/maria/maria-recovery-bitmap.test
blob: 4c7956fbc30776ab1d890a69c2060dbdcdfd8be9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Tests of Aria'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;
let $mms_tname=t;

# 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, localhost, 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=aria;

# 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 aria_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;
# Use a separate connection here. The reason is that we leave a dangling
# --send on the connection during aria_verify_recovery.inc, which makes that
# script fail if it were to try to use that connection before --reap.
connect (extra, localhost, root,,mysqltest,,);
set session debug_dbug="+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 aria_checkpoint_interval=1;
-- source include/maria_verify_recovery.inc
connection default;

--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;