summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-11-17 15:38:15 +0100
committerunknown <mskold@mysql.com>2005-11-17 15:38:15 +0100
commitfe50343e1a4c5497bc2d4147497854b41e0b0bf9 (patch)
treeab3361785f029ed64c6dc9db8e51241655ee4e92
parent47044ea63b779ed6d89df35f5fb642b1a8191528 (diff)
parenta710414c87d08b27945ab8f22d273255f5a2ea64 (diff)
downloadmariadb-git-fe50343e1a4c5497bc2d4147497854b41e0b0bf9.tar.gz
Merge mysql.com:/usr/local/home/marty/MySQL/mysql-4.1
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.0 mysql-test/r/ndb_alter_table.result: Auto merged mysql-test/t/ndb_alter_table.test: Auto merged sql/ha_ndbcluster.cc: Merge
-rw-r--r--mysql-test/r/ndb_alter_table.result3
-rw-r--r--mysql-test/t/ndb_alter_table.test2
-rw-r--r--sql/ha_ndbcluster.cc44
3 files changed, 42 insertions, 7 deletions
diff --git a/mysql-test/r/ndb_alter_table.result b/mysql-test/r/ndb_alter_table.result
index 69aa233b5e4..ae64a5f9d3f 100644
--- a/mysql-test/r/ndb_alter_table.result
+++ b/mysql-test/r/ndb_alter_table.result
@@ -179,8 +179,7 @@ a b c
2 two two
alter table t1 drop index c;
select * from t1 where b = 'two';
-a b c
-2 two two
+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/t/ndb_alter_table.test b/mysql-test/t/ndb_alter_table.test
index 357f658a296..86086ac54e5 100644
--- a/mysql-test/t/ndb_alter_table.test
+++ b/mysql-test/t/ndb_alter_table.test
@@ -151,6 +151,8 @@ select * from t1 where b = 'two';
connection server1;
alter table t1 drop index c;
connection server2;
+# This should fail since index information is not automatically refreshed
+--error 1105
select * from t1 where b = 'two';
select * from t1 where b = 'two';
connection server1;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 80c34f1117f..b8794c67301 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -78,6 +78,8 @@ handlerton ndbcluster_hton = {
#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
#define NDB_AUTO_INCREMENT_RETRIES 10
+#define NDB_INVALID_SCHEMA_OBJECT 241
+
#define ERR_PRINT(err) \
DBUG_PRINT("error", ("%d message: %s", err.code, err.message))
@@ -296,7 +298,21 @@ Thd_ndb::Thd_ndb()
Thd_ndb::~Thd_ndb()
{
if (ndb)
+ {
+#ifndef DBUG_OFF
+ Ndb::Free_list_usage tmp; tmp.m_name= 0;
+ while (ndb->get_free_list_usage(&tmp))
+ {
+ uint leaked= (uint) tmp.m_created - tmp.m_free;
+ if (leaked)
+ fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n",
+ leaked, tmp.m_name,
+ (leaked == 1)?"":"'s",
+ (leaked == 1)?"has":"have");
+ }
+#endif
delete ndb;
+ }
ndb= NULL;
changed_tables.empty();
}
@@ -3316,15 +3332,19 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
DBUG_PRINT("info", ("Table schema version: %d",
tab->getObjectVersion()));
}
- if (m_table != (void *)tab || m_table_version < tab->getObjectVersion())
+ if (m_table != (void *)tab)
{
- /*
- The table has been altered, refresh the index list
- */
- build_index_list(ndb, table, ILBP_OPEN);
m_table= (void *)tab;
m_table_version = tab->getObjectVersion();
}
+ else if (m_table_version < tab->getObjectVersion())
+ {
+ /*
+ The table has been altered, caller has to retry
+ */
+ NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
+ DBUG_RETURN(ndb_to_mysql_error(&err));
+ }
m_table_info= tab_info;
}
no_uncommitted_rows_init(thd);
@@ -4862,7 +4882,21 @@ bool ndbcluster_end()
(void) pthread_mutex_unlock(&LOCK_ndb_util_thread);
if (g_ndb)
+ {
+#ifndef DBUG_OFF
+ Ndb::Free_list_usage tmp; tmp.m_name= 0;
+ while (g_ndb->get_free_list_usage(&tmp))
+ {
+ uint leaked= (uint) tmp.m_created - tmp.m_free;
+ if (leaked)
+ fprintf(stderr, "NDB: Found %u %s%s that %s not been released\n",
+ leaked, tmp.m_name,
+ (leaked == 1)?"":"'s",
+ (leaked == 1)?"has":"have");
+ }
+#endif
delete g_ndb;
+ }
g_ndb= NULL;
if (g_ndb_cluster_connection)
delete g_ndb_cluster_connection;