| 1 |
RESET MASTER; |
| 2 |
# |
| 3 |
# binlog cache file is created in #binlog_cache_files directory |
| 4 |
# and it is deleted at disconnect |
| 5 |
# |
| 6 |
connect con1,localhost,root,,; |
| 7 |
CREATE TABLE t1 (c1 LONGTEXT) ENGINE = InnoDB; |
| 8 |
# list binlog_cache_files/ |
| 9 |
INSERT INTO t1 values(repeat("1", 5242880)); |
| 10 |
INSERT INTO t1 values(repeat("1", 5242880)); |
| 11 |
FLUSH BINARY LOGS; |
| 12 |
# list #binlog_cache_files/ |
| 13 |
ML_BINLOG_CACHE_FILE |
| 14 |
SET debug_sync = "thread_end SIGNAL signal.thread_end"; |
| 15 |
disconnect con1; |
| 16 |
connection default; |
| 17 |
SET debug_sync = "now WAIT_FOR signal.thread_end"; |
| 18 |
# binlog cache file is deleted at disconnection |
| 19 |
# list #binlog_cache_files/ |
| 20 |
# |
| 21 |
# Reserved space is not big enough, rename will not happen. But rotate |
| 22 |
# will succeed. |
| 23 |
# |
| 24 |
SET GLOBAL binlog_large_commit_threshold = 10 * 1024 * 1024; |
| 25 |
SET debug = 'd,simulate_required_size_too_big'; |
| 26 |
UPDATE t1 SET c1 = repeat('2', 5242880); |
| 27 |
include/assert.inc [Binlog is rotated, but rename is not executed.] |
| 28 |
# |
| 29 |
# Error happens when renaming binlog cache to binlog file, rename will |
| 30 |
# not happen. Since the original binlog is delete, the rotate will failed |
| 31 |
# too. binlog will be closed. |
| 32 |
# |
| 33 |
SET debug = 'd,simulate_rename_binlog_cache_to_binlog_error'; |
| 34 |
UPDATE t1 SET c1 = repeat('3', 5242880); |
| 35 |
ERROR HY000: Can't open file: './master-bin.000004' (errno: 1 "Operation not permitted") |
| 36 |
SELECT count(*) FROM t1 WHERE c1 like "3%"; |
| 37 |
count(*) |
| 38 |
0 |
| 39 |
# Binlog is closed |
| 40 |
show master status; |
| 41 |
File Position Binlog_Do_DB Binlog_Ignore_DB |
| 42 |
# restart |
| 43 |
show master status; |
| 44 |
File Position Binlog_Do_DB Binlog_Ignore_DB |
| 45 |
master-bin.000004 # <Binlog_Do_DB> <Binlog_Ignore_DB> |
| 46 |
# |
| 47 |
# Crash happens before rename the file |
| 48 |
# |
| 49 |
SET GLOBAL binlog_large_commit_threshold = 10 * 1024 * 1024; |
| 50 |
SET debug = 'd,binlog_commit_by_rotate_crash_before_rename'; |
| 51 |
UPDATE t1 SET c1 = repeat('4', 5242880); |
| 52 |
ERROR HY000: Lost connection to server during query |
| 53 |
# One cache file left after crash |
| 54 |
# list #binlog_cache_files/ |
| 55 |
ML_BINLOG_CACHE_FILE |
| 56 |
non_binlog_cache |
| 57 |
# restart |
| 58 |
# The cache file is deleted at startup. |
| 59 |
# list #binlog_cache_files/ |
| 60 |
non_binlog_cache |
| 61 |
include/assert_grep.inc [warning: non_binlog_cache file is in #binlog_cache_files/] |
| 62 |
include/show_binlog_events.inc |
| 63 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 64 |
master-bin.000005 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 65 |
master-bin.000005 # Gtid_list # # [#-#-#] |
| 66 |
# |
| 67 |
# Crash happens just after rotation is finished, binlog commit is not |
| 68 |
# started yet, so there is no Xid_log_event in the log, no garbage at |
| 69 |
# the end of the file. |
| 70 |
# |
| 71 |
SET GLOBAL binlog_large_commit_threshold = 10 * 1024 * 1024; |
| 72 |
BEGIN; |
| 73 |
UPDATE t1 SET c1 = repeat('5', 5242880); |
| 74 |
SAVEPOINT s1; |
| 75 |
UPDATE t1 SET c1 = repeat('6', 5242880); |
| 76 |
UPDATE t1 SET c1 = repeat('7', 5242880); |
| 77 |
ROLLBACK TO SAVEPOINT s1; |
| 78 |
INSERT INTO t1 VALUES('a'); |
| 79 |
SET debug = 'd,binlog_commit_by_rotate_crash_after_rotate'; |
| 80 |
COMMIT; |
| 81 |
ERROR HY000: Lost connection to server during query |
| 82 |
# No cache file left after crash |
| 83 |
# list #binlog_cache_files/ |
| 84 |
# restart |
| 85 |
include/show_binlog_events.inc |
| 86 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 87 |
master-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 88 |
master-bin.000006 # Gtid_list # # [#-#-#] |
| 89 |
master-bin.000006 # Gtid # # BEGIN GTID #-#-# |
| 90 |
master-bin.000006 # Annotate_rows # # UPDATE t1 SET c1 = repeat('5', 5242880) |
| 91 |
master-bin.000006 # Table_map # # table_id: # (test.t1) |
| 92 |
master-bin.000006 # Update_rows_v1 # # table_id: # |
| 93 |
master-bin.000006 # Update_rows_v1 # # table_id: # flags: STMT_END_F |
| 94 |
master-bin.000006 # Query # # SAVEPOINT `s1` |
| 95 |
master-bin.000006 # Annotate_rows # # INSERT INTO t1 VALUES('a') |
| 96 |
master-bin.000006 # Table_map # # table_id: # (test.t1) |
| 97 |
master-bin.000006 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 98 |
call mtr.add_suppression(".*Turning logging off for the whole duration.*"); |
| 99 |
call mtr.add_suppression(".*non_binlog_cache is in #binlog_cache_files/.*"); |
| 100 |
DROP TABLE t1; |