Skip to content

Commit 2fff6a3

Browse files
committed
BUG#35949017 Schema dist setup lockup
Problem: Schema event handler hangs waiting for GSL to become available when trying to setup util tables. Analysis: The schema event handler will try to setup the util tables when the physical tables have been dropped from NDB or connection lost otherwise. This setup check is intended to be done periodically every second but since the first step is to acquire the GSL the check will lockup waiting for the GSL. During this time the schema event handler and thus the binlog thread will not be actively handling other events. Solution: Use try lock when attempting to acquire the GSL, thus causing another setup check attempt to be made at a later time if GSl is not available. This change has the effect that check setup is active during a slightly longer then before, this means the util_tables_drop test has to be modified to wait for all servers completing the setup before continuing with next step in test. Previoulsy the test only waited for servers that would be used for subsequent SQL queries. Change-Id: Ie8e90b65781d94737eafc0e2ae0b6f3c18599f1d
1 parent ac9cc54 commit 2fff6a3

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

mysql-test/suite/ndb_ddl/check_util_table_drop.inc

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ RESET MASTER;
2626
--echo # Drop mysql.$util_table_name from NDB
2727
--exec $NDB_DROP_TABLE -d mysql $util_table_name
2828

29-
--connection mysqld1
30-
--echo # mysqld1: Wait until ready again...
31-
--source include/ndb_not_readonly.inc
32-
33-
--connection mysqld3
34-
--echo # mysqld3: Wait until ready again...
35-
--source include/ndb_not_readonly.inc
36-
37-
--connection mysqld5
38-
--echo # mysqld5: Wait until ready again...
39-
--source include/ndb_not_readonly.inc
29+
# Wait for all servers connected again
30+
let $i = 1;
31+
while($i <= $NUM_MYSQLDS)
32+
{
33+
--connection mysqld$i
34+
--echo # mysqld$i: Wait until ready again...
35+
--source include/ndb_not_readonly.inc
36+
inc $i;
37+
}
4038

4139
--connection mysqld5
4240
# NOTE! Neither drop of ndb_schema or ndb_schema_result should have a LOST_EVENT

mysql-test/suite/ndb_ddl/util_tables_drop.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ Dropping table ndb_schema...OK
1414
NDBT_ProgramExit: 0 - OK
1515

1616
# mysqld1: Wait until ready again...
17+
# mysqld2: Wait until ready again...
1718
# mysqld3: Wait until ready again...
19+
# mysqld4: Wait until ready again...
1820
# mysqld5: Wait until ready again...
21+
# mysqld6: Wait until ready again...
1922
# Check if a LOST_EVENTS event was written to the binlog
2023
include/show_binlog_events.inc
2124
Log_name Pos Event_type Server_id End_log_pos Info
@@ -44,8 +47,11 @@ Dropping table ndb_apply_status...OK
4447
NDBT_ProgramExit: 0 - OK
4548

4649
# mysqld1: Wait until ready again...
50+
# mysqld2: Wait until ready again...
4751
# mysqld3: Wait until ready again...
52+
# mysqld4: Wait until ready again...
4853
# mysqld5: Wait until ready again...
54+
# mysqld6: Wait until ready again...
4955
# Check if a LOST_EVENTS event was written to the binlog
5056
include/show_binlog_events.inc
5157
Log_name Pos Event_type Server_id End_log_pos Info
@@ -76,8 +82,11 @@ Dropping table ndb_schema_result...OK
7682
NDBT_ProgramExit: 0 - OK
7783

7884
# mysqld1: Wait until ready again...
85+
# mysqld2: Wait until ready again...
7986
# mysqld3: Wait until ready again...
87+
# mysqld4: Wait until ready again...
8088
# mysqld5: Wait until ready again...
89+
# mysqld6: Wait until ready again...
8190
# Check if a LOST_EVENTS event was written to the binlog
8291
include/show_binlog_events.inc
8392
Log_name Pos Event_type Server_id End_log_pos Info

storage/ndb/plugin/ha_ndbcluster_binlog.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4266,7 +4266,7 @@ class Ndb_schema_event_handler {
42664266

42674267
// Protect the setup with GSL(Global Schema Lock)
42684268
Ndb_global_schema_lock_guard global_schema_lock_guard(m_thd);
4269-
if (global_schema_lock_guard.lock()) {
4269+
if (!global_schema_lock_guard.try_lock()) {
42704270
ndb_log_info(" - failed to lock GSL");
42714271
return true;
42724272
}

0 commit comments

Comments
 (0)