File: compression_incident_event.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (82 lines) | stat: -rw-r--r-- 3,266 bytes parent folder | download
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
81
82
#
# WL#3549: Test incident events and binlog compression
#
# This test injects an incident event and makes sure that no
# compression takes place. In addition to that it also makes
# sure that no compression stats appear in performance schema.
#

--source include/have_debug.inc
--source include/have_binlog_format_row.inc

call mtr.add_suppression("An incident event has been written to the binary log which will stop the replicas");

--let $show_rpl_debug_info = 0

--let $saved_binlog_transaction_compression_session = `SELECT @@SESSION.binlog_transaction_compression`
--let $compression_type = LZ4
--let $pfs_table = performance_schema.binary_log_transaction_compression_stats

--eval SET SESSION binlog_transaction_compression = ON

CREATE TABLE t1(c1 INT PRIMARY KEY, data TEXT(30000));

RESET MASTER;
--eval TRUNCATE $pfs_table

--let $pattern_to_match = $MYSQLTEST_VARDIR/mysqld.1/data/*binlog*.0*
--source include/rpl_log_file_max_number.inc
--let $max_log_file_before_incident = $log_file_max_number

--let $debug_point=binlog_compression_inject_incident
--source include/add_debug_point.inc

INSERT INTO t1 VALUES (1, REPEAT ('a', 1000));

# Prior to Bug#35671897 the Incident would not be written until subseqent
# query, this check verifies that it has already been written by reading the
# fourth event and showing it's type, before any other query is executed.
--echo Check that Incident has been written
--let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 4)
echo $evt;

--let $debug_point=binlog_compression_inject_incident
--source include/remove_debug_point.inc

# 1 - Format_desc event, 2 - Previous_gtids event

--let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
--let $assert_text = Expected event type Anonymous_Gtid
--let $assert_cond = "$evt" = "Anonymous_Gtid" OR "$evt" = "Gtid"
--source include/assert.inc

--let $evt= query_get_value(SHOW BINLOG EVENTS, Event_type, 4)
--let $assert_text = Expected event type Incident
--let $assert_cond = "$evt" = "Incident"
--source include/assert.inc

# assert that we have no stats on the performance_schema table for compression
--let $nrows = `SELECT COUNT(*) FROM $pfs_table WHERE log_type ='BINARY' AND compression_type='$compression_type'`
--let $assert_cond = $nrows = 0
--let $assert_text = Number of rows in $pfs_table = 0 for compression_type != NONE (because of incident event)
--source include/assert.inc

# assert that we have the stats on the table
--let $nrows = `SELECT COUNT(*) FROM $pfs_table WHERE log_type ='BINARY' AND compression_type='NONE'`
--let $assert_cond = $nrows = 1
--let $assert_text = Number of rows in $pfs_table = 1 for compression_type = NONE
--source include/assert.inc

# assert the log file number increased, this shows that binlog was rotated
--source include/rpl_log_file_max_number.inc
--let $max_log_file_after_incident = $log_file_max_number
--let $assert_text = incident rotated binlog
--let $assert_cond = $max_log_file_before_incident + 1 = $max_log_file_after_incident
--source include/assert.inc

# clean up
DROP TABLE t1;
--replace_result $saved_binlog_transaction_compression_session SAVED
--eval SET SESSION binlog_transaction_compression = $saved_binlog_transaction_compression_session
RESET MASTER;
--eval TRUNCATE $pfs_table