Loading mysql-test/t/ndb_basic.test +0 −11 Original line number Diff line number Diff line Loading @@ -6,17 +6,6 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; drop database if exists mysqltest; --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 # table handler is working Loading sql/field.cc +5 −5 Original line number Diff line number Diff line Loading @@ -5989,7 +5989,7 @@ int Field_str::store(double nr) uint Field::is_equal(create_field *new_field) { return (new_field->sql_type == type()); return (new_field->sql_type == real_type()); } Loading @@ -6001,7 +6001,7 @@ uint Field_str::is_equal(create_field *new_field) (flags & (BINCMP_FLAG | BINARY_FLAG)))) return 0; /* One of the fields is binary and the other one isn't */ return ((new_field->sql_type == type()) && return ((new_field->sql_type == real_type()) && new_field->charset == field_charset && new_field->length == max_length()); } Loading Loading @@ -6798,7 +6798,7 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root, uint Field_varstring::is_equal(create_field *new_field) { if (new_field->sql_type == type() && if (new_field->sql_type == real_type() && new_field->charset == field_charset) { if (new_field->length == max_length()) Loading Loading @@ -7957,12 +7957,12 @@ bool Field_num::eq_def(Field *field) uint Field_num::is_equal(create_field *new_field) { return ((new_field->sql_type == type()) && return ((new_field->sql_type == real_type()) && ((new_field->flags & UNSIGNED_FLAG) == (uint) (flags & UNSIGNED_FLAG)) && ((new_field->flags & AUTO_INCREMENT_FLAG) == (uint) (flags & AUTO_INCREMENT_FLAG)) && (new_field->length >= max_length())); (new_field->length <= max_length())); } Loading sql/ha_ndbcluster_binlog.cc +76 −59 Original line number Diff line number Diff line Loading @@ -1430,6 +1430,10 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, NDB_SHARE *share) { DBUG_ENTER("ndb_handle_schema_change"); TABLE* table= share->table; TABLE_SHARE *table_share= table->s; const char *dbname= table_share->db.str; const char *tabname= table_share->table_name.str; bool do_close_cached_tables= FALSE; bool is_online_alter_table= FALSE; bool is_rename_table= FALSE; Loading @@ -1449,14 +1453,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); Thd_ndb *thd_ndb= get_thd_ndb(thd); Loading @@ -1464,13 +1463,17 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, Ndb* old_ndb= thd_ndb->ndb; thd_ndb->ndb= ndb; ha_ndbcluster table_handler(table_share); table_handler.set_dbname(share->key); table_handler.set_tabname(share->key); (void)strxmov(table_handler.m_dbname, dbname, NullS); (void)strxmov(table_handler.m_tabname, tabname, NullS); table_handler.open_indexes(ndb, table, TRUE); table_handler.invalidate_dictionary_cache(TRUE); 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; char key[FN_REFLEN]; Loading Loading @@ -1514,7 +1517,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, pthread_mutex_unlock(&LOCK_open); } } } // If only frm was changed continue replicating if (is_online_alter_table) Loading @@ -1540,6 +1542,21 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, share->table->s->db.length= strlen(share->db); share->table->s->table_name.str= share->table_name; share->table->s->table_name.length= strlen(share->table_name); /* Refresh local dictionary cache by invalidating any old table with same name and all it's indexes */ ndb->setDatabaseName(dbname); Thd_ndb *thd_ndb= get_thd_ndb(thd); DBUG_ASSERT(thd_ndb != NULL); Ndb* old_ndb= thd_ndb->ndb; thd_ndb->ndb= ndb; ha_ndbcluster table_handler(table_share); table_handler.set_dbname(share->key); table_handler.set_tabname(share->key); table_handler.open_indexes(ndb, table, TRUE); table_handler.invalidate_dictionary_cache(TRUE); thd_ndb->ndb= old_ndb; } DBUG_ASSERT(share->op == pOp || share->op_old == pOp); if (share->op_old == pOp) Loading Loading
mysql-test/t/ndb_basic.test +0 −11 Original line number Diff line number Diff line Loading @@ -6,17 +6,6 @@ DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; drop database if exists mysqltest; --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 # table handler is working Loading
sql/field.cc +5 −5 Original line number Diff line number Diff line Loading @@ -5989,7 +5989,7 @@ int Field_str::store(double nr) uint Field::is_equal(create_field *new_field) { return (new_field->sql_type == type()); return (new_field->sql_type == real_type()); } Loading @@ -6001,7 +6001,7 @@ uint Field_str::is_equal(create_field *new_field) (flags & (BINCMP_FLAG | BINARY_FLAG)))) return 0; /* One of the fields is binary and the other one isn't */ return ((new_field->sql_type == type()) && return ((new_field->sql_type == real_type()) && new_field->charset == field_charset && new_field->length == max_length()); } Loading Loading @@ -6798,7 +6798,7 @@ Field *Field_varstring::new_key_field(MEM_ROOT *root, uint Field_varstring::is_equal(create_field *new_field) { if (new_field->sql_type == type() && if (new_field->sql_type == real_type() && new_field->charset == field_charset) { if (new_field->length == max_length()) Loading Loading @@ -7957,12 +7957,12 @@ bool Field_num::eq_def(Field *field) uint Field_num::is_equal(create_field *new_field) { return ((new_field->sql_type == type()) && return ((new_field->sql_type == real_type()) && ((new_field->flags & UNSIGNED_FLAG) == (uint) (flags & UNSIGNED_FLAG)) && ((new_field->flags & AUTO_INCREMENT_FLAG) == (uint) (flags & AUTO_INCREMENT_FLAG)) && (new_field->length >= max_length())); (new_field->length <= max_length())); } Loading
sql/ha_ndbcluster_binlog.cc +76 −59 Original line number Diff line number Diff line Loading @@ -1430,6 +1430,10 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, NDB_SHARE *share) { DBUG_ENTER("ndb_handle_schema_change"); TABLE* table= share->table; TABLE_SHARE *table_share= table->s; const char *dbname= table_share->db.str; const char *tabname= table_share->table_name.str; bool do_close_cached_tables= FALSE; bool is_online_alter_table= FALSE; bool is_rename_table= FALSE; Loading @@ -1449,14 +1453,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); Thd_ndb *thd_ndb= get_thd_ndb(thd); Loading @@ -1464,13 +1463,17 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, Ndb* old_ndb= thd_ndb->ndb; thd_ndb->ndb= ndb; ha_ndbcluster table_handler(table_share); table_handler.set_dbname(share->key); table_handler.set_tabname(share->key); (void)strxmov(table_handler.m_dbname, dbname, NullS); (void)strxmov(table_handler.m_tabname, tabname, NullS); table_handler.open_indexes(ndb, table, TRUE); table_handler.invalidate_dictionary_cache(TRUE); 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; char key[FN_REFLEN]; Loading Loading @@ -1514,7 +1517,6 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, pthread_mutex_unlock(&LOCK_open); } } } // If only frm was changed continue replicating if (is_online_alter_table) Loading @@ -1540,6 +1542,21 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, share->table->s->db.length= strlen(share->db); share->table->s->table_name.str= share->table_name; share->table->s->table_name.length= strlen(share->table_name); /* Refresh local dictionary cache by invalidating any old table with same name and all it's indexes */ ndb->setDatabaseName(dbname); Thd_ndb *thd_ndb= get_thd_ndb(thd); DBUG_ASSERT(thd_ndb != NULL); Ndb* old_ndb= thd_ndb->ndb; thd_ndb->ndb= ndb; ha_ndbcluster table_handler(table_share); table_handler.set_dbname(share->key); table_handler.set_tabname(share->key); table_handler.open_indexes(ndb, table, TRUE); table_handler.invalidate_dictionary_cache(TRUE); thd_ndb->ndb= old_ndb; } DBUG_ASSERT(share->op == pOp || share->op_old == pOp); if (share->op_old == pOp) Loading