MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Martin Skold Date:September 12 2006 2:05pm
Subject:bk commit into 4.1 tree (mskold:1.2540) BUG#21378
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of marty. When marty does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-09-12 16:04:52+02:00, mskold@stripped +3 -0
  Bug #21378  Alter table from X storage engine to NDB could cause data loss: Added warning if local table shadows ndb table

  mysql-test/r/ndb_multi.result@stripped, 2006-09-12 16:03:42+02:00, mskold@stripped +32 -0
    Bug #21378  Alter table from X storage engine to NDB could cause data loss: Added warning if local table shadows ndb table

  mysql-test/t/ndb_multi.test@stripped, 2006-09-12 16:03:42+02:00, mskold@stripped +22 -0
    Bug #21378  Alter table from X storage engine to NDB could cause data loss: Added warning if local table shadows ndb table

  sql/ha_ndbcluster.cc@stripped, 2006-09-12 16:02:52+02:00, mskold@stripped +13 -4

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-4.1

--- 1.191/sql/ha_ndbcluster.cc	2006-09-12 16:05:03 +02:00
+++ 1.192/sql/ha_ndbcluster.cc	2006-09-12 16:05:03 +02:00
@@ -4715,16 +4715,16 @@ int ndbcluster_find_files(THD *thd,const
   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
     {
       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.

--- 1.4/mysql-test/r/ndb_multi.result	2006-09-12 16:05:03 +02:00
+++ 1.5/mysql-test/r/ndb_multi.result	2006-09-12 16:05:03 +02:00
@@ -69,3 +69,35 @@ t3
 t4
 drop table t1, t2, t3, t4;
 drop table t1, t3, t4;
+create table t1(c1 int key)ENGINE=MyISAM;
+insert into t1 values(1),(3),(5);
+select * from t1 order by c1;
+c1
+1
+3
+5
+create table t1(c1 int key)ENGINE=MyISAM;
+insert into t1 values(100),(344),(533);
+select * from t1 order by c1;
+c1
+100
+344
+533
+alter table t1 engine=ndb;
+show tables;
+Tables_in_test
+t1
+Warnings:
+Warning	1050	Local table t1 shadows cluster table
+select * from t1 order by c1;
+c1
+100
+344
+533
+drop table t1;
+select * from t1 order by c1;
+c1
+1
+3
+5
+drop table t1;

--- 1.6/mysql-test/t/ndb_multi.test	2006-09-12 16:05:03 +02:00
+++ 1.7/mysql-test/t/ndb_multi.test	2006-09-12 16:05:03 +02:00
@@ -69,4 +69,26 @@ drop table t1, t2, t3, t4;
 connection server2;
 drop table t1, t3, t4;
 
+# bug#21378
+connection server1;
+create table t1(c1 int key)ENGINE=MyISAM;
+insert into t1 values(1),(3),(5);
+select * from t1 order by c1;
+
+connection server2;
+create table t1(c1 int key)ENGINE=MyISAM;
+insert into t1 values(100),(344),(533);
+select * from t1 order by c1;
+
+connection server1;
+alter table t1 engine=ndb;
+
+connection server2;
+show tables;
+select * from t1 order by c1;
+drop table t1;
+
+connection server1;
+select * from t1 order by c1;
+drop table t1;
 # End of 4.1 tests
Thread
bk commit into 4.1 tree (mskold:1.2540) BUG#21378Martin Skold12 Sep