Debian Codegraph @

mysql-test/suite/binlog_gtid/t/binlog_gtid_log_status_with_ongoing_bgc.test

raw
1 ##############################################################################
2 # ==== Purpose ====
3 # The purpose of this test is to verify that, at any given time,
4 # the gtid_executed value shown in log_status table matches the correct
5 # executed GTIDs.
6 #
7 # ==== Requirement ====
8 # At any given time, the gtid_executed value shown in log_status must match
9 # the correct executed GTIDs.
10 #
11 # ==== Implementation ====
12 # 1. Initial setup
13 # 2. Execute an INSERT query and pause after it acquires commit_lock
14 # 3. Execute a SELECT query on performance_schema.log_status and verify
15 # that it is waiting on MYSQL_BIN_LOG::prep_xids_cond
16 # 4. Resume the INSERT query
17 # 5. Let the SELECT query complete
18 # 6. Verify that the correct GTID set is received from
19 # performance_schema.log_status
20 # 7. Clean up
21 #
22 # ==== References ====
23 # Bug#32442772 LOG_STATUS HAS WRONG BINARY_LOG_POSITION OF GTID_EXECUTED
24 ###############################################################################
25
26 # This test case is binary log format agnostic
27 --source include/have_binlog_format_row.inc
28
29 --source include/have_debug.inc
30 --source include/have_debug_sync.inc
31
32 --echo #
33 --echo # 1. Initial setup
34 --connect (con1,localhost,root,,)
35 --connect (con2,localhost,root,,)
36
37 --connection default
38 RESET MASTER;
39 --let $server_uuid= `SELECT @@GLOBAL.SERVER_UUID`
40 CREATE TABLE t1(c1 INT);
41 INSERT INTO t1 VALUES(1);
42 INSERT INTO t1 VALUES(2);
43 FLUSH BINARY LOGS;
44
45 --echo #
46 --echo # 2. Execute an INSERT query and pause after it acquires commit_lock
47 --let $auxiliary_connection = default
48 --let $statement_connection = con1
49 --let $sync_point = update_gtid_state_before_global_sid_lock
50 --let $statement = INSERT INTO t1 VALUES (3)
51 --source include/execute_to_sync_point.inc
52
53 --echo #
54 --echo # 3. Execute a SELECT query on performance_schema.log_status and wait
55 --echo # until it is waiting for MYSQL_BIN_LOG::prep_xids_cond
56 --connection con2
57 --send SELECT REPLACE(LOCAL->"$.gtid_executed", '"', '') INTO @ps_log_status FROM performance_schema.log_status
58
59 --connection default
60 --let $wait_condition = SELECT COUNT(*) = 1 FROM performance_schema.threads T, performance_schema.events_waits_current W WHERE T.THREAD_ID=W.THREAD_ID AND W.EVENT_NAME LIKE "%MYSQL_BIN_LOG::prep_xids_cond" AND T.PROCESSLIST_INFO LIKE "%FROM%log_status%"
61 --source include/wait_condition.inc
62
63 --echo #
64 --echo # 4. Resume the INSERT query
65 --source include/execute_from_sync_point.inc
66
67 --echo #
68 --echo # 5. Let the SELECT query complete
69 --connection con2
70 --reap
71
72 --echo #
73 --echo # 6. Verify that the correct GTID set is received from
74 --echo # performance_schema.log_status
75 --let $assert_text= Gtid_executed is updated with GTID 4
76 --let $assert_cond= "[SELECT @ps_log_status]" = "$server_uuid:1-4"
77 --source include/assert.inc
78
79 --echo #
80 --echo # 7. Cleanup
81 --connection default
82 --disconnect con1
83 --disconnect con2
84 DROP TABLE t1;