List:Internals« Previous MessageNext Message »
From:msvensson Date:April 4 2005 10:26am
Subject:bk commit into 4.1 tree (msvensson:1.2174) BUG#6762
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of msvensson. When msvensson 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
  1.2174 05/04/04 12:26:05 msvensson@neptunus.(none) +5 -0
  BUG#6762 ALTER TABLE gives weird results and error message
    - Better error message when table definition has changed

  sql/ha_ndbcluster.cc
    1.136 05/04/04 12:26:02 msvensson@neptunus.(none) +28 -2
    When error 284 is returned from NDB a check must be made to see what the error really means.
     - if table does not exists any more, return 709 -> No such table exists
     - if table still exists, table has most likely been altered and table id and version has 
       changed, print  hardcoded  errormessage indicating that transaction should retried
      (this error message should be translated to a langauge dependent error message in 5.0)
      
    Remove mapping from 284 to HA_ERR_NO_SUCH_TABLE

  mysql-test/t/ndb_multi.test
    1.2 05/04/04 12:26:02 msvensson@neptunus.(none) +2 -0
    Safety, drop tables in second server as well

  mysql-test/t/ndb_alter_table.test
    1.18 05/04/04 12:26:02 msvensson@neptunus.(none) +1 -1
    New error message and code when table definition has changed.

  mysql-test/r/ndb_multi.result
    1.2 05/04/04 12:26:02 msvensson@neptunus.(none) +1 -0
    Safety, drop tables in second server as well

  mysql-test/r/ndb_alter_table.result
    1.20 05/04/04 12:26:02 msvensson@neptunus.(none) +1 -1
    New error message and code when table definition has changed.

# 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:	msvensson
# Host:	neptunus.(none)
# Root:	/home/msvensson/mysql/bug6762

--- 1.19/mysql-test/r/ndb_alter_table.result	2005-03-07 10:21:08 +01:00
+++ 1.20/mysql-test/r/ndb_alter_table.result	2005-04-04 12:26:02 +02:00
@@ -179,7 +179,7 @@
 2	two	two
 alter table t1 drop index c;
 select * from t1 where b = 'two';
-ERROR 42S02: Table 'test.t1' doesn't exist
+ERROR HY000: Table definition has changed, please retry transaction
 select * from t1 where b = 'two';
 a	b	c
 2	two	two

--- 1.17/mysql-test/t/ndb_alter_table.test	2005-03-07 10:21:08 +01:00
+++ 1.18/mysql-test/t/ndb_alter_table.test	2005-04-04 12:26:02 +02:00
@@ -143,7 +143,7 @@
 connection server1;
 alter table t1 drop index c;
 connection server2;
---error 1146
+--error 1105
 select * from t1 where b = 'two';
 select * from t1 where b = 'two';
 connection server1;

--- 1.135/sql/ha_ndbcluster.cc	2005-03-22 17:48:12 +01:00
+++ 1.136/sql/ha_ndbcluster.cc	2005-04-04 12:26:02 +02:00
@@ -113,7 +113,6 @@
   { 4244, HA_ERR_TABLE_EXIST, 1 },
 
   { 709, HA_ERR_NO_SUCH_TABLE, 1 },
-  { 284, HA_ERR_NO_SUCH_TABLE, 1 },
 
   { 266, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
   { 274, HA_ERR_LOCK_WAIT_TIMEOUT, 1 },
@@ -363,7 +362,7 @@
 int ha_ndbcluster::ndb_err(NdbConnection *trans)
 {
   int res;
-  const NdbError err= trans->getNdbError();
+  NdbError err= trans->getNdbError();
   DBUG_ENTER("ndb_err");
   
   ERR_PRINT(err);
@@ -371,6 +370,33 @@
   case NdbError::SchemaError:
   {
     invalidateDictionaryCache();
+
+    if (err.code==284)
+    {
+      /*
+         Check if the table is _really_ gone or if the table has
+         been alterend and thus changed table id
+       */
+      NDBDICT *dict= get_ndb()->getDictionary();
+      DBUG_PRINT("info", ("Check if table %s is really gone", m_tabname));
+      if (!(dict->getTable(m_tabname)))
+      {
+        err= dict->getNdbError();
+        DBUG_PRINT("info", ("Table not found, error: %d", err.code));
+        if (err.code != 709)
+          DBUG_RETURN(1);
+      }
+      else
+      {
+        DBUG_PRINT("info", ("Table exist but must have changed"));
+        /* In 5.0, this should be replaced with a mapping to a mysql error */
+        my_printf_error(ER_UNKNOWN_ERROR,
+                        "Table definition has changed, "\
+                        "please retry transaction",
+                        MYF(0));
+        DBUG_RETURN(1);
+      }
+    }
     break;
   }
   default:

--- 1.1/mysql-test/r/ndb_multi.result	2005-03-07 09:54:53 +01:00
+++ 1.2/mysql-test/r/ndb_multi.result	2005-04-04 12:26:02 +02:00
@@ -47,3 +47,4 @@
 t3
 t4
 drop table t1, t2, t3, t4;
+drop table t1, t3, t4;

--- 1.1/mysql-test/t/ndb_multi.test	2005-03-07 09:54:53 +01:00
+++ 1.2/mysql-test/t/ndb_multi.test	2005-04-04 12:26:02 +02:00
@@ -40,5 +40,7 @@
 show tables;
 
 drop table t1, t2, t3, t4;
+connection server2;
+drop table t1, t3, t4;
 
 
Thread
bk commit into 4.1 tree (msvensson:1.2174) BUG#6762msvensson4 Apr