List:Commits« Previous MessageNext Message »
From:gni Date:September 28 2007 1:16am
Subject:bk commit into 5.0 tree (gni:1.2476) BUG#29851
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gni. When gni 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, 2007-09-28 09:16:41+08:00, gni@stripped +3 -0
  BUG#29851 TRUNCATE causes error 4350 from cluster in INSERT... ON DUPLICATE KEY UPDATE

  mysql-test/r/ndb_alter_table2.result@stripped, 2007-09-28 09:16:39+08:00, gni@stripped +19 -0
    Add test case for BUG#29851

  mysql-test/t/ndb_alter_table2.test@stripped, 2007-09-28 09:16:39+08:00, gni@stripped +31 -0
    Add test case for BUG#29851

  sql/ha_ndbcluster.cc@stripped, 2007-09-28 09:16:39+08:00, gni@stripped +9 -1
    Indexes are dropped also when dropping table in GlobalDictCache

# 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:	gni
# Host:	dev3-221.dev.cn.tlan
# Root:	/home/ngb/mysql/mysql-5.0/bug29851

--- 1.314/sql/ha_ndbcluster.cc	2007-09-28 09:16:48 +08:00
+++ 1.315/sql/ha_ndbcluster.cc	2007-09-28 09:16:48 +08:00
@@ -439,7 +439,8 @@
 
 void ha_ndbcluster::invalidate_dictionary_cache(bool global)
 {
-  NDBDICT *dict= get_ndb()->getDictionary();
+  Ndb * ndb= get_ndb();
+  NDBDICT *dict= ndb->getDictionary();
   DBUG_ENTER("invalidate_dictionary_cache");
   DBUG_PRINT("info", ("invalidating %s", m_tabname));
 
@@ -459,6 +460,7 @@
   }
   else
     dict->removeCachedTable(m_tabname);
+  build_index_list(ndb, table, ILBP_OPEN);
   table->s->version=0L;			/* Free when thread is ready */
   /* Invalidate indexes */
   for (uint i= 0; i < table->s->keys; i++)
@@ -470,17 +472,23 @@
     switch (idx_type) {
     case PRIMARY_KEY_ORDERED_INDEX:
     case ORDERED_INDEX:
+      if (!index)
+        break;
       if (global)
         dict->invalidateIndex(index->getName(), m_tabname);
       else
         dict->removeCachedIndex(index->getName(), m_tabname);
       break;
     case UNIQUE_ORDERED_INDEX:
+      if (!index)
+        break;
       if (global)
         dict->invalidateIndex(index->getName(), m_tabname);
       else
         dict->removeCachedIndex(index->getName(), m_tabname);
     case UNIQUE_INDEX:
+      if (!unique_index)
+        break;
       if (global)
         dict->invalidateIndex(unique_index->getName(), m_tabname);
       else

--- 1.1/mysql-test/r/ndb_alter_table2.result	2007-09-28 09:16:48 +08:00
+++ 1.2/mysql-test/r/ndb_alter_table2.result	2007-09-28 09:16:48 +08:00
@@ -40,3 +40,22 @@
 select * from t1;
 a	b	c
 drop table t1;
+DROP TABLE IF EXISTS truncate_test;
+CREATE TABLE truncate_test (
+i INT PRIMARY KEY,
+a INT,
+b VARCHAR(11),
+UNIQUE KEY (a) 
+) ENGINE = NDB;
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+TRUNCATE truncate_test;
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+SELECT * FROM truncate_test;
+i	a	b
+1	1	test
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+SELECT * FROM truncate_test;
+i	a	b
+1	1	new
+DROP TABLE truncate_test;

--- 1.1/mysql-test/t/ndb_alter_table2.test	2007-09-28 09:16:48 +08:00
+++ 1.2/mysql-test/t/ndb_alter_table2.test	2007-09-28 09:16:48 +08:00
@@ -81,3 +81,34 @@
 select * from t1;
 
 drop table t1;
+
+#For BUG#29851 TRUNCATE causes error 4350 from cluster in INSERT... ON DUPLICATE KEY UPDATE
+
+connection con1;
+
+--disable_warnings
+DROP TABLE IF EXISTS truncate_test;
+--enable_warnings
+
+CREATE TABLE truncate_test (
+  i INT PRIMARY KEY,
+  a INT,
+  b VARCHAR(11),
+  UNIQUE KEY (a) 
+) ENGINE = NDB;
+
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+
+connection con2;
+TRUNCATE truncate_test;
+
+connection con1;
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+SELECT * FROM truncate_test;
+
+connection con2;
+INSERT INTO truncate_test VALUES (1, 1, 'test') ON DUPLICATE KEY UPDATE b = 'new';
+SELECT * FROM truncate_test;
+
+DROP TABLE truncate_test;
Thread
bk commit into 5.0 tree (gni:1.2476) BUG#29851gni28 Sep