summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/t/ndb_restore.test5
-rw-r--r--sql/ha_ndbcluster.cc19
2 files changed, 23 insertions, 1 deletions
diff --git a/mysql-test/t/ndb_restore.test b/mysql-test/t/ndb_restore.test
index 7f0cafdfd77..18efa66ebe0 100644
--- a/mysql-test/t/ndb_restore.test
+++ b/mysql-test/t/ndb_restore.test
@@ -180,6 +180,11 @@ drop table t1_c,t2_c,t3_c,t4_c,t5_c,t6_c,t7_c,t8_c,t9_c,t10_c;
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t3_c | grep ForceVarPart
--exec $NDB_TOOLS_DIR/ndb_desc --no-defaults -d test t2_c | grep ForceVarPart
+# Bug #30667
+# ndb table discovery does not work correcly with information schema
+# - prior to bug fix this would yeild no output and a warning
+select * from information_schema.columns where table_name = "t1_c";
+
# random output order??
#show tables;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 4d02c8267db..d252a92393c 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -6955,9 +6955,26 @@ int ndbcluster_find_files(handlerton *hton, THD *thd,
while ((file_name=it++))
{
bool file_on_disk= FALSE;
- DBUG_PRINT("info", ("%s", file_name));
+ DBUG_PRINT("info", ("%s", file_name));
if (hash_search(&ndb_tables, file_name, strlen(file_name)))
{
+ build_table_filename(name, sizeof(name), db, file_name, reg_ext, 0);
+ if (my_access(name, F_OK))
+ {
+ pthread_mutex_lock(&LOCK_open);
+ DBUG_PRINT("info", ("Table %s listed and need discovery",
+ file_name));
+ if (ndb_create_table_from_engine(thd, db, file_name))
+ {
+ pthread_mutex_unlock(&LOCK_open);
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ ER_TABLE_EXISTS_ERROR,
+ "Discover of table %s.%s failed",
+ db, file_name);
+ continue;
+ }
+ pthread_mutex_unlock(&LOCK_open);
+ }
DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name));
file_on_disk= TRUE;
}