File: rpl_gtid_glle_no_terminate.test

package info (click to toggle)
mariadb 1%3A11.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 765,428 kB
  • sloc: ansic: 2,382,827; cpp: 1,803,532; asm: 378,315; perl: 63,176; sh: 46,496; pascal: 40,776; java: 39,363; yacc: 20,428; python: 19,506; sql: 17,864; xml: 12,463; ruby: 8,544; makefile: 6,059; cs: 5,855; ada: 1,700; lex: 1,193; javascript: 1,039; objc: 80; tcl: 73; awk: 46; php: 22
file content (73 lines) | stat: -rw-r--r-- 2,186 bytes parent folder | download | duplicates (2)
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
#
# Purpose:
#   If a fake Glle event follows a Gtid event, we need to ensure the rest of
# the group should not terminate at the Glle event. MDEV-28550 revealed that
# a Glle would terminate the event and upon reconnect, the DDL would be lost.
#
# Methodology:
#   Force the primary to send a fake GLLE event after a GTID on a "reconnect"
# and ensure that both 1) the replica does not error, and 2) the original
# command within the GTID is executed.
#
# References:
#   MDEV-28550: improper handling of replication event group that contains Gtid_log_list_event

--source include/master-slave.inc

# Independent of binlog format
--source include/have_binlog_format_statement.inc

--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;

--echo #
--echo # Initialize test data
--connection master
--source include/wait_for_binlog_checkpoint.inc
create table t1 (a int);
SET @@session.server_id= 3;
create table t2 (a int);
--source include/save_master_gtid.inc

--echo #
--echo # Have the replica "reconnect" and the primary will send Gtid, Glle, DDL
--connection slave
eval set global gtid_slave_pos="0-3-1";
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc

--echo #
--echo # Ensure that the replica did not error
connection slave;
--source include/sync_with_master_gtid.inc
let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
--echo Last_SQL_Error = $error
let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
--echo Last_SQL_Errno = $errno

--echo #
--echo # Ensure that the primary sent a Glle after a Gtid event
let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
let $binlog_start= $relaylog_start;
let $binlog_limit=0,10;
--source include/show_relaylog_events.inc

--echo #
--echo # Ensure the DDL was executed on the replica
if (!`SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't2'`)
{
    die "t2 should exist on slave";
}

--echo #
--echo # Cleanup

--echo # t1 does not make it to the replica
--connection master
set sql_log_bin=0;
DROP TABLE t1;
set sql_log_bin=1;
DROP TABLE t2;

--source include/rpl_end.inc