diff options
author | mskold/marty@mysql.com/linux.site <> | 2006-09-12 16:04:52 +0200 |
---|---|---|
committer | mskold/marty@mysql.com/linux.site <> | 2006-09-12 16:04:52 +0200 |
commit | 125df80e9be90a749be43a1c05601f1f46a9586b (patch) | |
tree | 209b269b51bd055a553842f00920ae16bb0e6e5c /sql/ha_ndbcluster.cc | |
parent | bacdcb053e69fa2ccc2c3898d06b00543fbd528d (diff) | |
download | mariadb-git-125df80e9be90a749be43a1c05601f1f46a9586b.tar.gz |
Bug #21378 Alter table from X storage engine to NDB could cause data loss: Added warning if local table shadows ndb table
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index e4c20de2390..987c96aed37 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -4715,16 +4715,16 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, List<char> delete_list; while ((file_name=it++)) { + bool file_on_disk= false; DBUG_PRINT("info", ("%s", file_name)); if (hash_search(&ndb_tables, file_name, strlen(file_name))) { DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name)); // File existed in NDB and as frm file, put in ok_tables list - my_hash_insert(&ok_tables, (byte*)file_name); - continue; + file_on_disk= true; } - // File is not in NDB, check for .ndb file with this name + // Check for .ndb file with this name (void)strxnmov(name, FN_REFLEN, mysql_data_home,"/",db,"/",file_name,ha_ndb_ext,NullS); DBUG_PRINT("info", ("Check access for %s", name)); @@ -4732,9 +4732,18 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, { DBUG_PRINT("info", ("%s did not exist on disk", name)); // .ndb file did not exist on disk, another table type + if (file_on_disk) + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TABLE_EXISTS_ERROR, + "Local table %s.%s shadows ndb table", + db, file_name); + continue; + } + if (file_on_disk) + { + my_hash_insert(&ok_tables, (byte*)file_name); continue; } - DBUG_PRINT("info", ("%s existed on disk", name)); // The .ndb file exists on disk, but it's not in list of tables in ndb // Verify that handler agrees table is gone. |