MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Martin Skold Date:September 15 2006 1:56pm
Subject:bk commit into 5.1 tree (mskold:1.2318)
View as plain text  
Below is the list of changes that have just been committed into a local
5.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-15 15:56:20+02:00, mskold@stripped +5 -0
  Merge mysql.com:/windows/Linux_space/MySQL/mysql-5.0
  into  mysql.com:/windows/Linux_space/MySQL/mysql-5.1
  MERGE: 1.1810.1697.144

  mysql-test/r/ndb_condition_pushdown.result@stripped, 2006-09-15 15:53:16+02:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.15.1.7

  mysql-test/r/ndb_multi.result@stripped, 2006-09-15 15:56:16+02:00, mskold@stripped +0 -0
    Merge
    MERGE: 1.3.1.4

  mysql-test/t/ndb_multi.test@stripped, 2006-09-15 15:56:16+02:00, mskold@stripped +0 -1
    Merge
    MERGE: 1.5.1.3

  sql/ha_ndbcluster.cc@stripped, 2006-09-15 15:53:16+02:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.175.1.106

  sql/ha_ndbcluster.h@stripped, 2006-09-15 15:53:17+02:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.82.4.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-5.1/RESYNC

--- 1.360/sql/ha_ndbcluster.cc	2006-09-15 15:56:31 +02:00
+++ 1.361/sql/ha_ndbcluster.cc	2006-09-15 15:56:31 +02:00
@@ -6246,25 +6246,40 @@ 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
     build_table_filename(name, sizeof(name), db, file_name, ha_ndb_ext, 0);
     DBUG_PRINT("info", ("Check access for %s", name));
     if (my_access(name, F_OK))
     {
       DBUG_PRINT("info", ("%s did not exist on disk", name));     
       // .ndb file did not exist on disk, another table type
+      if (file_on_disk)
+      {
+	// Ignore this ndb table
+	gptr record=  hash_search(&ndb_tables, file_name, strlen(file_name));
+	DBUG_ASSERT(record);
+	hash_delete(&ndb_tables, record);
+	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) 
+    {
+      // File existed in NDB and as frm file, put in ok_tables list
+      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.
@@ -8628,7 +8643,7 @@ void ndb_serialize_cond(const Item *item
               curr_cond->ndb_item= new Ndb_item(field, col->getColumnNo());
               context->dont_expect(Item::FIELD_ITEM);
               context->expect_no_field_result();
-              if (context->expect_mask)
+              if (! context->expecting_nothing())
               {
                 // We have not seen second argument yet
                 if (type == MYSQL_TYPE_TIME ||
@@ -8933,7 +8948,7 @@ void ndb_serialize_cond(const Item *item
                 NDB_ITEM_QUALIFICATION q;
                 q.value_type= Item::STRING_ITEM;
                 curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); 
-                if (context->expect_field_result_mask)
+                if (! context->expecting_no_field_result())
                 {
                   // We have not seen the field argument yet
                   context->expect_only(Item::FIELD_ITEM);
@@ -8963,7 +8978,7 @@ void ndb_serialize_cond(const Item *item
                 NDB_ITEM_QUALIFICATION q;
                 q.value_type= Item::REAL_ITEM;
                 curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-                if (context->expect_field_result_mask) 
+                if (! context->expecting_no_field_result()) 
                 {
                   // We have not seen the field argument yet
                   context->expect_only(Item::FIELD_ITEM);
@@ -8986,7 +9001,7 @@ void ndb_serialize_cond(const Item *item
                 NDB_ITEM_QUALIFICATION q;
                 q.value_type= Item::INT_ITEM;
                 curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-                if (context->expect_field_result_mask) 
+                if (! context->expecting_no_field_result()) 
                 {
                   // We have not seen the field argument yet
                   context->expect_only(Item::FIELD_ITEM);
@@ -9009,7 +9024,7 @@ void ndb_serialize_cond(const Item *item
                 NDB_ITEM_QUALIFICATION q;
                 q.value_type= Item::DECIMAL_ITEM;
                 curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-                if (context->expect_field_result_mask) 
+                if (! context->expecting_no_field_result()) 
                 {
                   // We have not seen the field argument yet
                   context->expect_only(Item::FIELD_ITEM);
@@ -9059,7 +9074,7 @@ void ndb_serialize_cond(const Item *item
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::STRING_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);      
-            if (context->expect_field_result_mask)
+            if (! context->expecting_no_field_result())
             {
               // We have not seen the field argument yet
               context->expect_only(Item::FIELD_ITEM);
@@ -9092,7 +9107,7 @@ void ndb_serialize_cond(const Item *item
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::INT_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-            if (context->expect_field_result_mask) 
+            if (! context->expecting_no_field_result()) 
             {
               // We have not seen the field argument yet
               context->expect_only(Item::FIELD_ITEM);
@@ -9119,7 +9134,7 @@ void ndb_serialize_cond(const Item *item
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::REAL_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-            if (context->expect_field_result_mask) 
+            if (! context->expecting_no_field_result()) 
             {
               // We have not seen the field argument yet
               context->expect_only(Item::FIELD_ITEM);
@@ -9142,7 +9157,7 @@ void ndb_serialize_cond(const Item *item
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::VARBIN_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);      
-            if (context->expect_field_result_mask)
+            if (! context->expecting_no_field_result())
             {
               // We have not seen the field argument yet
               context->expect_only(Item::FIELD_ITEM);
@@ -9167,7 +9182,7 @@ void ndb_serialize_cond(const Item *item
             NDB_ITEM_QUALIFICATION q;
             q.value_type= Item::DECIMAL_ITEM;
             curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item);
-            if (context->expect_field_result_mask) 
+            if (! context->expecting_no_field_result()) 
             {
               // We have not seen the field argument yet
               context->expect_only(Item::FIELD_ITEM);

--- 1.149/sql/ha_ndbcluster.h	2006-09-15 15:56:31 +02:00
+++ 1.150/sql/ha_ndbcluster.h	2006-09-15 15:56:31 +02:00
@@ -461,76 +461,95 @@ class Ndb_cond_traverse_context 
   Ndb_cond_traverse_context(TABLE *tab, void* ndb_tab, Ndb_cond_stack* stack)
     : table(tab), ndb_table(ndb_tab), 
     supported(TRUE), stack_ptr(stack), cond_ptr(NULL),
-    expect_mask(0), expect_field_type_mask(0), expect_field_result_mask(0), 
     skip(0), collation(NULL), rewrite_stack(NULL)
   {
+    // Allocate type checking bitmaps   
+    bitmap_init(&expect_mask, 0, 512, TRUE);
+    bitmap_init(&expect_field_type_mask, 0, 512, TRUE);
+    bitmap_init(&expect_field_result_mask, 0, 512, TRUE);
+
     if (stack)
       cond_ptr= stack->ndb_cond;
   };
   ~Ndb_cond_traverse_context()
   {
+    bitmap_free(&expect_mask);
+    bitmap_free(&expect_field_type_mask);
+    bitmap_free(&expect_field_result_mask);
     if (rewrite_stack) delete rewrite_stack;
   }
   void expect(Item::Type type)
   {
-    expect_mask|= (1 << type);
+    bitmap_set_bit(&expect_mask, (uint) type);
     if (type == Item::FIELD_ITEM) expect_all_field_types();
   };
   void dont_expect(Item::Type type)
   {
-    expect_mask&= ~(1 << type);
+    bitmap_clear_bit(&expect_mask, (uint) type);
   };
   bool expecting(Item::Type type)
   {
-    return (expect_mask & (1 << type));
+    return bitmap_is_set(&expect_mask, (uint) type);
   };
   void expect_nothing()
   {
-    expect_mask= 0;
+    bitmap_clear_all(&expect_mask);
   };
+  bool expecting_nothing()
+  {
+    return bitmap_is_clear_all(&expect_mask);
+  }
   void expect_only(Item::Type type)
   {
-    expect_mask= 0;
+    expect_nothing();
     expect(type);
   };
 
-  void expect_field_type(enum_field_types result)
+  void expect_field_type(enum_field_types type)
   {
-    expect_field_type_mask|= (1 << result);
+    bitmap_set_bit(&expect_field_type_mask, (uint) type);
   };
   void expect_all_field_types()
   {
-    expect_field_type_mask= ~0;
+    bitmap_set_all(&expect_field_type_mask);
   };
-  bool expecting_field_type(enum_field_types result)
+  bool expecting_field_type(enum_field_types type)
   {
-    return (expect_field_type_mask & (1 << result));
+    return bitmap_is_set(&expect_field_type_mask, (uint) type);
   };
   void expect_no_field_type()
   {
-    expect_field_type_mask= 0;
+    bitmap_clear_all(&expect_field_type_mask);
   };
+  bool expecting_no_field_type()
+  {
+    return bitmap_is_clear_all(&expect_field_type_mask);
+  }
   void expect_only_field_type(enum_field_types result)
   {
-    expect_field_type_mask= 0;
+    expect_no_field_type();
     expect_field_type(result);
   };
 
   void expect_field_result(Item_result result)
   {
-    expect_field_result_mask|= (1 << result);
+    bitmap_set_bit(&expect_field_result_mask, (uint) result);
   };
   bool expecting_field_result(Item_result result)
   {
-    return (expect_field_result_mask & (1 << result));
+    return bitmap_is_set(&expect_field_result_mask, (uint) result);
   };
   void expect_no_field_result()
   {
-    expect_field_result_mask= 0;
+    bitmap_clear_all(&expect_field_result_mask);
   };
+  bool expecting_no_field_result()
+  {
+    return bitmap_is_clear_all(&expect_field_result_mask);
+  }
   void expect_only_field_result(Item_result result)
   {
-    expect_field_result_mask= 0;
+    expect_no_field_result();
     expect_field_result(result);
   };
   void expect_collation(CHARSET_INFO* col)
@@ -550,9 +569,9 @@ class Ndb_cond_traverse_context 
   bool supported;
   Ndb_cond_stack* stack_ptr;
   Ndb_cond* cond_ptr;
-  uint expect_mask;
-  uint expect_field_type_mask;
-  uint expect_field_result_mask;
+  MY_BITMAP expect_mask;
+  MY_BITMAP expect_field_type_mask;
+  MY_BITMAP expect_field_result_mask;
   uint skip;
   CHARSET_INFO* collation;
   Ndb_rewrite_context *rewrite_stack;

--- 1.9/mysql-test/r/ndb_multi.result	2006-09-15 15:56:31 +02:00
+++ 1.10/mysql-test/r/ndb_multi.result	2006-09-15 15:56:31 +02:00
@@ -60,3 +60,35 @@ t2
 t3
 t4
 drop table t1, t2, 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 test.t1 shadows ndb 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.12/mysql-test/t/ndb_multi.test	2006-09-15 15:56:31 +02:00
+++ 1.13/mysql-test/t/ndb_multi.test	2006-09-15 15:56:31 +02:00
@@ -69,5 +69,26 @@ show tables like 't4';
 show tables;
 
 drop table t1, t2, 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 5.1 tree (mskold:1.2318)Martin Skold15 Sep