| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
|
| 4 |
# Connect to all |
| 5 |
--source connect.inc |
| 6 |
|
| 7 |
--echo # |
| 8 |
--echo # Test participants' restart during a schema distribution |
| 9 |
--echo # |
| 10 |
|
| 11 |
--echo # Case 1 : Participant restarts before the coordinator starts waiting on a schema op |
| 12 |
# Also covers Bug#31721534 |
| 13 |
|
| 14 |
connection mysqld1; |
| 15 |
--echo # Activate the sync points required for the test |
| 16 |
|
| 17 |
# Enable debug sync point to make the client wait for a |
| 18 |
# participant restart before logging the schema op into ndb_schema table. |
| 19 |
SET DEBUG_SYNC="ndb_schema_before_write WAIT_FOR reached_check_wakeup_clients"; |
| 20 |
|
| 21 |
# Enable debug code in check_wakeup_clients that signals and waits |
| 22 |
# for the client to log the schema op into ndb_schema table. |
| 23 |
SET GLOBAL DEBUG="+d,ndb_check_wakeup_clients_syncpoint"; |
| 24 |
|
| 25 |
# Enable debug sync point in client that signals check_wakeup_clients |
| 26 |
# to continue once the schema op has been logged into ndb_schema table. |
| 27 |
SET DEBUG_SYNC="ndb_schema_after_write SIGNAL continue_check_wakeup_clients"; |
| 28 |
|
| 29 |
--echo # Execute a DDL through send which will cause the |
| 30 |
--echo # client to wait until a participant (mysqld6) unsubscribes |
| 31 |
send CREATE TABLE t1 (a INT) ENGINE NDB; |
| 32 |
|
| 33 |
--echo # Shutdown a participant Server |
| 34 |
connection mysqld6; |
| 35 |
let $mysqld_name=mysqld.6.1; |
| 36 |
--source include/shutdown_mysqld.inc |
| 37 |
|
| 38 |
--echo # Verify that the DDL was successful |
| 39 |
connection mysqld1; |
| 40 |
reap; |
| 41 |
SHOW CREATE TABLE t1; |
| 42 |
|
| 43 |
--echo # Cleanup |
| 44 |
# Start mysqld6 again |
| 45 |
connection mysqld6; |
| 46 |
--source include/start_mysqld.inc |
| 47 |
--source include/ndb_not_readonly.inc |
| 48 |
connection mysqld1; |
| 49 |
set GLOBAL debug="-d,ndb_check_wakeup_clients_syncpoint"; |
| 50 |
set debug_sync="RESET"; |
| 51 |
DROP TABLE t1; |
| 52 |
|
| 53 |
--echo # Case 2 : Participant restarts after replying to the |
| 54 |
--echo # schema op but the coordinator is waiting on other participants |
| 55 |
|
| 56 |
--echo # Defer sending schema op ack from mysqld2 |
| 57 |
--echo # to make the coordinator wait for it |
| 58 |
connection mysqld2; |
| 59 |
set GLOBAL debug="+d,ndb_defer_sending_participant_ack"; |
| 60 |
|
| 61 |
--echo # Execute a DDL through send on mysqld1 |
| 62 |
connection mysqld1; |
| 63 |
send CREATE TABLE t1 (a INT) ENGINE NDB; |
| 64 |
|
| 65 |
--echo # Wait for the participant mysqld6 to send the ack so |
| 66 |
--echo # that we can restart it and test the coordinator |
| 67 |
# This is ensured by waiting for all other participants except |
| 68 |
# mysqld2 to send acks (i.e.) wait until 5 reply rows are |
| 69 |
# found in ndb_schema_result table |
| 70 |
connection mysqld6; |
| 71 |
let $ndb_select_all_log= $MYSQLTEST_VARDIR/tmp/ndb_select_all.log; |
| 72 |
let $wait_counter= 100; # wait for atmost 10s |
| 73 |
while ($wait_counter) |
| 74 |
{ |
| 75 |
exec $NDB_SELECT_ALL -d mysql ndb_schema_result > $ndb_select_all_log; |
| 76 |
let $success=`SELECT LOAD_FILE("$ndb_select_all_log") LIKE "%5 rows returned%"`; |
| 77 |
if ($success) |
| 78 |
{ |
| 79 |
let $wait_counter= 0; |
| 80 |
} |
| 81 |
if (!$success) |
| 82 |
{ |
| 83 |
sleep 0.1; |
| 84 |
dec $wait_counter; |
| 85 |
if (!$wait_counter) |
| 86 |
{ |
| 87 |
die Expected participants did not reply before wait timeout; |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
remove_file $ndb_select_all_log; |
| 92 |
|
| 93 |
--echo # Shutdown a participant Server |
| 94 |
--let $mysqld_name=mysqld.6.1 |
| 95 |
--source include/shutdown_mysqld.inc |
| 96 |
|
| 97 |
--echo # Resume sending the ack from participant mysqld2 |
| 98 |
connection mysqld2; |
| 99 |
set GLOBAL debug="-d,ndb_defer_sending_participant_ack"; |
| 100 |
SET DEBUG_SYNC="now SIGNAL resume_sending_participant_ack"; |
| 101 |
|
| 102 |
--echo # Verify that the DDL was successful without any warnings |
| 103 |
connection mysqld1; |
| 104 |
reap; |
| 105 |
SHOW CREATE TABLE t1; |
| 106 |
|
| 107 |
--echo # Cleanup |
| 108 |
# Start mysqld6 again |
| 109 |
connection mysqld6; |
| 110 |
--source include/start_mysqld.inc |
| 111 |
--source include/ndb_not_readonly.inc |
| 112 |
connection mysqld1; |
| 113 |
DROP TABLE t1; |