Skip to content

Commit 7258730

Browse files
committed
Bug#30192373 MYSQLD CRASH IN BINLOG SETUP DUE TO LCTN IN MAC
Post push fix to handle a corner case where a table in a database with an upper case name is created in NDB Dictionary and picked up for automatic synchronization Change-Id: Iefc70fda03c04a52aa5e54b422610941d28b2dc7
1 parent bf74dd8 commit 7258730

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

storage/ndb/plugin/ndb_metadata_sync.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "sql/sql_table.h" // build_table_filename
3232
#include "storage/ndb/include/ndbapi/Ndb.hpp" // Ndb
3333
#include "storage/ndb/plugin/ha_ndbcluster_binlog.h" // ndbcluster_binlog_setup_table
34+
#include "storage/ndb/plugin/ndb_dd.h" // ndb_dd_fs_name_case
3435
#include "storage/ndb/plugin/ndb_dd_client.h" // Ndb_dd_client
3536
#include "storage/ndb/plugin/ndb_dd_disk_data.h" // ndb_dd_disk_data_get_object_id_and_version
3637
#include "storage/ndb/plugin/ndb_dd_table.h" // ndb_dd_table_get_object_id_and_version
@@ -614,14 +615,15 @@ bool Ndb_metadata_sync::sync_schema(THD *thd, const std::string &schema_name,
614615
temp_error = false;
615616
return false;
616617
}
618+
const std::string dd_schema_name = ndb_dd_fs_name_case(schema_name.c_str());
617619
Ndb_dd_client dd_client(thd);
618620
// Acquire exclusive MDL on the schema upfront. Note that this isn't strictly
619621
// necessary since the Ndb_local_connection is used further down the function.
620622
// But the binlog thread shouldn't stall while waiting for the MDL to be
621623
// acquired. Thus, there's an attempt to lock the schema with
622624
// lock_wait_timeout = 0 to ensure that the binlog thread can bail out early
623625
// should there be any conflicting locks
624-
if (!dd_client.mdl_lock_schema_exclusive(schema_name.c_str(), true)) {
626+
if (!dd_client.mdl_lock_schema_exclusive(dd_schema_name.c_str(), true)) {
625627
ndb_log_info("Failed to acquire MDL on schema '%s'", schema_name.c_str());
626628
temp_error = true;
627629
// Since it's a temporary error, the THD conditions should be cleared but
@@ -644,7 +646,7 @@ bool Ndb_metadata_sync::sync_schema(THD *thd, const std::string &schema_name,
644646
}
645647

646648
bool exists_in_DD;
647-
if (!dd_client.schema_exists(schema_name.c_str(), &exists_in_DD)) {
649+
if (!dd_client.schema_exists(dd_schema_name.c_str(), &exists_in_DD)) {
648650
log_and_clear_thd_conditions(thd, condition_logging_level::WARNING);
649651
ndb_log_warning("Failed to determine if schema '%s' exists in DD",
650652
schema_name.c_str());

0 commit comments

Comments
 (0)