summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <mskold@mysql.com>2005-03-07 10:21:38 +0100
committerunknown <mskold@mysql.com>2005-03-07 10:21:38 +0100
commit8e8dfe43db45875306d06d5c1d882c86a68b6b3a (patch)
treeb06b6684ff4122901b911545b8f54f0d438e308e /sql
parentae81d53048643da4b110c936eaec0a895af06219 (diff)
downloadmariadb-git-8e8dfe43db45875306d06d5c1d882c86a68b6b3a.tar.gz
Fix for Bug #8753 Invalid schema object version after dropping index
Diffstat (limited to 'sql')
-rw-r--r--sql/ha_ndbcluster.cc38
-rw-r--r--sql/ha_ndbcluster.h1
2 files changed, 33 insertions, 6 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 3e2fc5b2855..70b86ca08d1 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -328,6 +328,36 @@ void ha_ndbcluster::no_uncommitted_rows_reset(THD *thd)
# The mapped error code
*/
+void ha_ndbcluster::invalidateCache()
+{
+ NDBDICT *dict= get_ndb()->getDictionary();
+ DBUG_PRINT("info", ("invalidating %s", m_tabname));
+ dict->invalidateTable(m_tabname);
+ table->version=0L; /* Free when thread is ready */
+ /* Invalidate indexes */
+ for (uint i= 0; i < table->keys; i++)
+ {
+ NDBINDEX *index = (NDBINDEX *) m_index[i].index;
+ NDBINDEX *unique_index = (NDBINDEX *) m_index[i].unique_index;
+ NDB_INDEX_TYPE idx_type= m_index[i].type;
+
+
+ switch(m_index[i].type) {
+ case(PRIMARY_KEY_ORDERED_INDEX):
+ case(ORDERED_INDEX):
+ dict->invalidateIndex(index->getName(), m_tabname);
+ break;
+ case(UNIQUE_ORDERED_INDEX):
+ dict->invalidateIndex(index->getName(), m_tabname);
+ case(UNIQUE_INDEX):
+ dict->invalidateIndex(unique_index->getName(), m_tabname);
+ break;
+ case(PRIMARY_KEY_INDEX):
+ case(UNDEFINED_INDEX):
+ break;
+ }
+ }
+}
int ha_ndbcluster::ndb_err(NdbConnection *trans)
{
@@ -339,11 +369,7 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans)
switch (err.classification) {
case NdbError::SchemaError:
{
- Ndb *ndb= get_ndb();
- NDBDICT *dict= ndb->getDictionary();
- DBUG_PRINT("info", ("invalidateTable %s", m_tabname));
- dict->invalidateTable(m_tabname);
- table->version=0L; /* Free when thread is ready */
+ invalidateCache();
break;
}
default:
@@ -733,7 +759,7 @@ int ha_ndbcluster::get_metadata(const char *path)
if (!invalidating_ndb_table)
{
DBUG_PRINT("info", ("Invalidating table"));
- dict->invalidateTable(m_tabname);
+ invalidateCache();
invalidating_ndb_table= TRUE;
}
else
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index 07b305bad3e..149276c8356 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -201,6 +201,7 @@ class ha_ndbcluster: public handler
void print_results();
longlong get_auto_increment();
+ void invalidateCache();
int ndb_err(NdbConnection*);
bool uses_blob_value(bool all_fields);