File: rpl_trx_boundary_parser_warning.inc

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 (142 lines) | stat: -rw-r--r-- 4,616 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# ==== Purpose ====
#
# This include will wait for the slave IO thread to queue a given amount of
# events, will stop the whole slave server, will restore a master.info file
# based on a desired point to restart queuing events and will restart the
# slave and the slave IO thread.
#
# ==== Usage ====
#
# --let $stop_after= <EVENT NUMBER TO STOP AFTER>
# --let $restart_at= <EVENT NUMBER TO RESTART AT>
# --source extra/rpl_tests/rpl_trx_boundary_parser.inc
#
# Parameters:
#   $stop_after
#     The number of events this include will let the slave IO thread to queue
#     before restarting the slave server.
#
#   $restart_at
#     The event that should be the first queued by the slave IO thread after
#     restarting the slave server.
#
#   $master_2nd_event_pos
#     We always start counting by the second event, skipping slave's FD, its exact position
#     is compated by this macro caller to be passed here as a parameter


if (!$stop_after)
{
  --die ERROR IN TEST: invalid value for mysqltest variable 'stop_after': $stop_after
}
if (!$restart_at)
{
  --die ERROR IN TEST: invalid value for mysqltest variable 'restart_at': $restart_at
}

--let $rpl_connection_silent= 1

###
### Cleanup and reset the slave
###
--disable_query_log
--echo # Cleaning up and reseting the slave
--source include/rpl_connection_slave.inc
--source include/stop_slave.inc
--disable_warnings
DROP TABLE IF EXISTS t1, t2;
DROP EVENT IF EXISTS ev1;
--enable_warnings
RESET MASTER;
RESET SLAVE;
--enable_query_log

###
### Adjust the value of $restart_at to this include
###
--let $_stop_after= $stop_after
--let $_restart_at= $restart_at
# We will restart using the master_info file saved after
# queuing the event preceding the one we want.
--dec $_restart_at

###
### Prepare to count the events queued to the IO thread
###
--let $debug_point= pause_on_queuing_event
--source include/add_debug_point.inc
# Get the master.info file path (the $MYSQLD_SLAVE_DATADIR)
--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
# Start the IO thread to start receiving events from master
START SLAVE IO_THREAD;
--let $event_counter= 2
--let $master_pos= $master_2nd_event_pos
# Disabling query log during queue event counting
--disable_query_log
###
### Counting events
###
while ($event_counter <= $_stop_after)
{
  SET DEBUG_SYNC='now WAIT_FOR reached_queuing_event';
  # After the relay log PREVIOUS_GTIDS ($event_counter == 2) we save the event
  # position to display only the last event queued.
  if ($event_counter > 2)
  {
    --let $master_pos= query_get_value(SHOW RELAYLOG EVENTS IN 'slave-relay-bin.000003' FROM $master_pos, Pos, 2)
  }
  # If we reached the event to stop after, we can stop counting events
  if ($event_counter == $_stop_after)
  {
    --source include/remove_debug_point.inc
    --let $debug_point= stop_io_after_queuing_event
    --source include/add_debug_point.inc
  }
  # If we don't reached the event to stop after yet, make the IO thread to
  # queue the current event and retrieve the next one.
  if ($event_counter <= $_stop_after)
  {
    SET DEBUG_SYNC= 'now SIGNAL continue_queuing_event';
  }
  --inc $event_counter
}
--source include/wait_for_slave_io_to_stop.inc
# Get the position of the last queued event
--let $master_pos= query_get_value(SHOW RELAYLOG EVENTS IN 'slave-relay-bin.000003' FROM $master_pos, Pos, 2)
###
### Display the last event queued by the IO thread
###
--echo # Stopped IO thread after queuing the following event (#$stop_after):
--let $binlog_start= $master_pos
--let $binlog_file= slave-relay-bin.000003
--let $binlog_limit=
--source include/show_relaylog_events.inc
--enable_query_log

###
### Restart the slave changing the master.info file
###
# Stop the slave server
--let $rpl_server_number= 2
--let $rpl_force_stop= 0
--source include/rpl_stop_server.inc
# Remove the current master.info
--remove_file $MYSQLD_SLAVE_DATADIR./master.info
--echo # Restoring a master.info.backup to start asking events at event #$restart_at
--copy_file $MYSQLD_SLAVE_DATADIR./master.backup.$_restart_at $MYSQLD_SLAVE_DATADIR./master.info
# Start the slave again
--source include/rpl_start_server.inc
# Start the IO thread to receive the events from the $restart_at point
--source include/start_slave_io.inc
--source include/rpl_connection_master.inc

--let $use_gtids= 0
--source include/sync_slave_io_with_master.inc
--echo # Restarted queuing the following event (#$restart_at):
--replace_result $master_uuid MASTER_UUID
--let $binlog_start=
--let $binlog_file= slave-relay-bin.000005
--let $binlog_limit= 3, 1
--source include/show_relaylog_events.inc

--let $rpl_connection_silent=