File: schema_dist_participant_restart.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 (113 lines) | stat: -rw-r--r-- 3,480 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
--source include/have_debug.inc
--source include/have_debug_sync.inc

# Connect to all
--source connect.inc

--echo #
--echo # Test participants' restart during a schema distribution
--echo #

--echo # Case 1 : Participant restarts before the coordinator starts waiting on a schema op
# Also covers Bug#31721534

connection mysqld1;
--echo # Activate the sync points required for the test

# Enable debug sync point to make the client wait for a
# participant restart before logging the schema op into ndb_schema table.
SET DEBUG_SYNC="ndb_schema_before_write WAIT_FOR reached_check_wakeup_clients";

# Enable debug code in check_wakeup_clients that signals and waits
# for the client to log the schema op into ndb_schema table.
SET GLOBAL DEBUG="+d,ndb_check_wakeup_clients_syncpoint";

# Enable debug sync point in client that signals check_wakeup_clients
# to continue once the schema op has been logged into ndb_schema table.
SET DEBUG_SYNC="ndb_schema_after_write SIGNAL continue_check_wakeup_clients";

--echo # Execute a DDL through send which will cause the
--echo # client to wait until a participant (mysqld6) unsubscribes
send CREATE TABLE t1 (a INT) ENGINE NDB;

--echo # Shutdown a participant Server
connection mysqld6;
let $mysqld_name=mysqld.6.1;
--source include/shutdown_mysqld.inc

--echo # Verify that the DDL was successful
connection mysqld1;
reap;
SHOW CREATE TABLE t1;

--echo # Cleanup
# Start mysqld6 again
connection mysqld6;
--source include/start_mysqld.inc
--source include/ndb_not_readonly.inc
connection mysqld1;
set GLOBAL debug="-d,ndb_check_wakeup_clients_syncpoint";
set debug_sync="RESET";
DROP TABLE t1;

--echo # Case 2 : Participant restarts after replying to the
--echo # schema op but the coordinator is waiting on other participants

--echo # Defer sending schema op ack from mysqld2
--echo # to make the coordinator wait for it
connection mysqld2;
set GLOBAL debug="+d,ndb_defer_sending_participant_ack";

--echo # Execute a DDL through send on mysqld1
connection mysqld1;
send CREATE TABLE t1 (a INT) ENGINE NDB;

--echo # Wait for the participant mysqld6 to send the ack so
--echo # that we can restart it and test the coordinator
# This is ensured by waiting for all other participants except
# mysqld2 to send acks (i.e.) wait until 5 reply rows are
# found in ndb_schema_result table
connection mysqld6;
let $ndb_select_all_log= $MYSQLTEST_VARDIR/tmp/ndb_select_all.log;
let $wait_counter= 100; # wait for atmost 10s
while ($wait_counter)
{
  exec $NDB_SELECT_ALL -d mysql ndb_schema_result > $ndb_select_all_log;
  let $success=`SELECT LOAD_FILE("$ndb_select_all_log") LIKE "%5 rows returned%"`;
  if ($success)
  {
    let $wait_counter= 0;
  }
  if (!$success)
  {
    sleep 0.1;
    dec $wait_counter;
    if (!$wait_counter)
    {
      die Expected participants did not reply before wait timeout;
    }
  }
}
remove_file $ndb_select_all_log;

--echo # Shutdown a participant Server
--let $mysqld_name=mysqld.6.1
--source include/shutdown_mysqld.inc

--echo # Resume sending the ack from participant mysqld2
connection mysqld2;
set GLOBAL debug="-d,ndb_defer_sending_participant_ack";
SET DEBUG_SYNC="now SIGNAL resume_sending_participant_ack";

--echo # Verify that the DDL was successful without any warnings
connection mysqld1;
reap;
SHOW CREATE TABLE t1;

--echo # Cleanup
# Start mysqld6 again
connection mysqld6;
--source include/start_mysqld.inc
--source include/ndb_not_readonly.inc
connection mysqld1;
DROP TABLE t1;