~ubuntu-branches/ubuntu/trusty/mysql-5.6/trusty

« back to all changes in this revision

Viewing changes to mysql-test/suite/binlog/t/binlog_crash_safe_master_checksum.test

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-02-12 11:54:27 UTC
  • Revision ID: package-import@ubuntu.com-20140212115427-oq6tfsqxl1wuwehi
Tags: upstream-5.6.15
ImportĀ upstreamĀ versionĀ 5.6.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ==== Purpose ====
 
2
#
 
3
# Verify that a transaction with wrong checksum is trimmed off from
 
4
# the binary log when the server restarts and executes recovery.  Such
 
5
# recovery is executed if the server restarts after a crash.
 
6
#
 
7
# ==== Method ====
 
8
#
 
9
# 1. Inject a wrong checksum using debug code.
 
10
# 2. Crash server using debug_sync
 
11
# 3. Restart server
 
12
# 4. Show contents of binary log.
 
13
#
 
14
# ==== References ====
 
15
#
 
16
# WL#5493 Binlog crash-safe when master crashed
 
17
# WL#5440 Test binlog and replication when master crashed
 
18
 
 
19
--let $old_debug = `select @@global.debug`
 
20
--let $prefix = `select CONCAT(IF(LENGTH(@@global.debug) > 0, CONCAT(@@global.debug, ":"), ''), "d,debug,info,enter,return,query,")`
 
21
# Don't test this under valgrind, memory leaks will occur
 
22
-- source include/not_valgrind.inc
 
23
-- source include/not_embedded.inc
 
24
-- source include/have_debug.inc
 
25
-- source include/have_innodb.inc
 
26
-- source include/have_binlog_format_row.inc
 
27
-- source include/not_crashrep.inc
 
28
 
 
29
call mtr.add_suppression("Attempting backtrace");
 
30
call mtr.add_suppression("allocated tablespace *., old maximum was 0");
 
31
call mtr.add_suppression("Error in Log_event::read_log_event()");
 
32
call mtr.add_suppression("Buffered warning: Performance schema disabled");
 
33
 
 
34
RESET MASTER;
 
35
 
 
36
CREATE TABLE t1(a LONGBLOB) ENGINE=INNODB;
 
37
CREATE TABLE t2(a LONGBLOB) ENGINE=MYISAM;
 
38
 
 
39
-- echo # Test case5: Inject wrong value of crc for a log event, and
 
40
-- echo #             then set DBUG POINT to casue the master crash.
 
41
# Write file to make mysql-test-run.pl expect crash and restart
 
42
-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
43
-- let $binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1)
 
44
-- let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
 
45
INSERT INTO t2 (a) VALUES (REPEAT('a',1));
 
46
 
 
47
BEGIN;
 
48
INSERT INTO t1 (a) VALUES (REPEAT('a',1));
 
49
--disable_query_log
 
50
eval SET SESSION debug=CONCAT('$prefix', "fault_injection_crc_value");
 
51
--enable_query_log
 
52
INSERT INTO t1 (a) VALUES (REPEAT('a',2));
 
53
COMMIT;
 
54
 
 
55
BEGIN;
 
56
INSERT INTO t1 (a) VALUES (REPEAT('a',3));
 
57
--disable_query_log
 
58
eval SET SESSION debug=CONCAT('$prefix', "crash_commit_after_prepare");
 
59
--enable_query_log
 
60
# Run the crashing query
 
61
-- error 2013
 
62
COMMIT;
 
63
 
 
64
-- source include/wait_until_disconnected.inc
 
65
-- enable_reconnect
 
66
-- echo # Restart the master server
 
67
-- exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
 
68
-- source include/wait_until_connected_again.inc
 
69
-- disable_reconnect
 
70
 
 
71
-- echo # Test the transaction with a log event injected a wrong crc value
 
72
-- echo # will be trimmed from the crashed binlog file
 
73
-- source include/show_binlog_events.inc
 
74
 
 
75
DROP TABLE t1, t2;
 
76