summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/ndb_alter_table.result2
-rw-r--r--mysql-test/r/ndb_multi.result1
-rw-r--r--mysql-test/t/ndb_alter_table.test2
-rw-r--r--mysql-test/t/ndb_multi.test2
-rw-r--r--sql/ha_ndbcluster.cc30
5 files changed, 33 insertions, 4 deletions
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 88ac04db111..52ae0b58d56 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -179,7 +179,7 @@ a b c
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
diff --git a/mysql-test/r/ndb_multi.result b/mysql-test/r/ndb_multi.result
index 4a2389cd1ff..5696fda1c07 100644
--- a/mysql-test/r/ndb_multi.result
+++ b/mysql-test/r/ndb_multi.result
@@ -47,3 +47,4 @@ t2
t3
t4
drop table t1, t2, t3, t4;
+drop table t1, t3, t4;
diff --git a/mysql-test/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index f39edc0ee65..3ff2e735cb5 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -143,7 +143,7 @@ select * from t1 where b = 'two';
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;
diff --git a/mysql-test/t/ndb_multi.test b/mysql-test/t/ndb_multi.test
index 9286721b677..27ddd6508e9 100644
--- a/mysql-test/t/ndb_multi.test
+++ b/mysql-test/t/ndb_multi.test
@@ -40,5 +40,7 @@ show status like 'handler_discover%';
show tables;
drop table t1, t2, t3, t4;
+connection server2;
+drop table t1, t3, t4;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 92d5e6119aa..53f432ccfd5 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -113,7 +113,6 @@ static const err_code_mapping err_map[]=
{ 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 @@ void ha_ndbcluster::invalidateDictionaryCache()
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 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
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: