File: rpl_partial_transaction_timestamps.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 (72 lines) | stat: -rw-r--r-- 2,895 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
# ==== References ====
#
# WL#7374 Performance schema tables to monitor replication lags and queue
#
# ==== Purpose ====
# This test verifies the behavior of QUEUEING_TIMESTAMPS in case of
# partial transactions in the relay log.

# This test case uses a debug point based on RBR
--source include/have_binlog_format_row.inc
--source include/have_debug.inc
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc

--source include/rpl_connection_slave.inc
--source include/start_slave_io.inc

# this test case makes the receiver thread to parse and
# events (WRITE_ROWS). These events are enclosed in
# a Transaction_payload event when compression is on.
--source include/not_binlog_transaction_compression_on.inc

# Prepare the slave IO thread to stop after queuing a WRITE_ROWS event
SET @save_debug=@@global.debug;
SET GLOBAL DEBUG= "+d,stop_io_after_reading_write_rows_log_event";

# Do some transactions on master
--source include/rpl_connection_master.inc
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;

BEGIN;
INSERT INTO t1 (c1) VALUES (1);
COMMIT;

# Wait for the slave IO thread to reach the debug point
--source include/rpl_connection_slave.inc
--source include/wait_for_slave_io_to_stop.inc

--let $initial_queue_timestamp= query_get_value(select QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP,1)

--source include/kill_and_restart_mysqld.inc
--let $rpl_server_number= 2
--source include/rpl_reconnect.inc

--let $restart_queue_timestamp= query_get_value(select QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,QUEUEING_TRANSACTION_START_QUEUE_TIMESTAMP,1)

# Debug point disappears on restart

# Start slave
--source include/start_slave.inc
--source include/rpl_connection_master.inc
--source include/sync_slave_io_with_master.inc

--let $final_queue_timestamp= query_get_value(select LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP from performance_schema.replication_connection_status,LAST_QUEUED_TRANSACTION_START_QUEUE_TIMESTAMP,1)

# Check that the timestamps values are valid
--let $unix_ts_initial= `SELECT UNIX_TIMESTAMP('$initial_queue_timestamp')`
--let $unix_ts_restart= `SELECT UNIX_TIMESTAMP('$restart_queue_timestamp')`
--let $assert_text= Assert that the timestamp after the restart is more recent than the initial timestamp
--let $assert_cond= $unix_ts_restart - $unix_ts_initial  > 0
--source include/assert.inc

# Check that the timestamps values are valid
--let $unix_ts_final= `SELECT UNIX_TIMESTAMP('$final_queue_timestamp')`
--let $assert_text= Assert that the final queue timestamp is more recent than the timestamp after the restart
--let $assert_cond= $unix_ts_final - $unix_ts_restart  > 0
--source include/assert.inc

# Cleanup
--source include/rpl_connection_master.inc
DROP TABLE t1;
--source include/rpl_end.inc