Commit 2bd5f579 authored by unknown's avatar unknown

Fix for bug#16445 schema version error 241 after mysqld restart, always...

Fix for bug#16445 schema version error 241 after mysqld restart, always invalidate dictionary cache when receiving changed schema events drop table or alter table, regardless if done remotely or not (also includes cluster failures, but refreshing cache is a safe operation)


parent 9ceb114f
...@@ -6,17 +6,6 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; ...@@ -6,17 +6,6 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists mysqltest; drop database if exists mysqltest;
--enable_warnings --enable_warnings
# workaround for bug#16445
# remove to reproduce bug and run tests drom ndb start
# and with ndb_autodiscover disabled
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
drop table t1;
# #
# Basic test to show that the NDB # Basic test to show that the NDB
# table handler is working # table handler is working
......
...@@ -1372,6 +1372,9 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, ...@@ -1372,6 +1372,9 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
NDB_SHARE *share) NDB_SHARE *share)
{ {
DBUG_ENTER("ndb_handle_schema_change"); DBUG_ENTER("ndb_handle_schema_change");
TABLE* table= share->table;
TABLE_SHARE *table_share= table->s;
const char *dbname= table_share->db.str;
bool do_close_cached_tables= FALSE; bool do_close_cached_tables= FALSE;
bool is_online_alter_table= FALSE; bool is_online_alter_table= FALSE;
bool is_rename_table= FALSE; bool is_rename_table= FALSE;
...@@ -1391,14 +1394,9 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, ...@@ -1391,14 +1394,9 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
} }
} }
if (is_remote_change) /* includes CLUSTER_FAILURE */
{
TABLE* table= share->table;
TABLE_SHARE *table_share= table->s;
const char *dbname= table_share->db.str;
/* /*
Invalidate table and all it's indexes Refresh local dictionary cache by
invalidating table and all it's indexes
*/ */
ndb->setDatabaseName(dbname); ndb->setDatabaseName(dbname);
Thd_ndb *thd_ndb= get_thd_ndb(thd); Thd_ndb *thd_ndb= get_thd_ndb(thd);
...@@ -1412,7 +1410,11 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, ...@@ -1412,7 +1410,11 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
table_handler.invalidate_dictionary_cache(TRUE); table_handler.invalidate_dictionary_cache(TRUE);
thd_ndb->ndb= old_ndb; thd_ndb->ndb= old_ndb;
if (is_online_alter_table) /*
Refresh local frm file and dictionary cache if
remote on-line alter table
*/
if (is_remote_change && is_online_alter_table)
{ {
const char *tabname= table_share->table_name.str; const char *tabname= table_share->table_name.str;
char key[FN_REFLEN]; char key[FN_REFLEN];
...@@ -1456,7 +1458,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, ...@@ -1456,7 +1458,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
} }
} }
}
// If only frm was changed continue replicating // If only frm was changed continue replicating
if (is_online_alter_table) if (is_online_alter_table)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment