diff options
Diffstat (limited to 'sql/ha_ndbcluster.cc')
-rw-r--r-- | sql/ha_ndbcluster.cc | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index da419fca19c..90a1e2e75ad 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -3986,7 +3986,14 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type) if (lock_type != F_UNLCK) { DBUG_PRINT("info", ("lock_type != F_UNLCK")); - if (!thd->transaction.on) + if (thd->lex->sql_command == SQLCOM_LOAD) + { + m_transaction_on= FALSE; + /* Would be simpler if has_transactions() didn't always say "yes" */ + thd->options|= OPTION_STATUS_NO_TRANS_UPDATE; + thd->no_trans_update= TRUE; + } + else if (!thd->transaction.on) m_transaction_on= FALSE; else m_transaction_on= thd->variables.ndb_use_transactions; @@ -6239,25 +6246,40 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path, List<char> delete_list; while ((file_name=it++)) { + bool file_on_disk= false; DBUG_PRINT("info", ("%s", file_name)); if (hash_search(&ndb_tables, file_name, strlen(file_name))) { DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name)); - // File existed in NDB and as frm file, put in ok_tables list - my_hash_insert(&ok_tables, (byte*)file_name); - continue; + file_on_disk= true; } - // File is not in NDB, check for .ndb file with this name + // Check for .ndb file with this name build_table_filename(name, sizeof(name), db, file_name, ha_ndb_ext, 0); DBUG_PRINT("info", ("Check access for %s", name)); if (my_access(name, F_OK)) { DBUG_PRINT("info", ("%s did not exist on disk", name)); // .ndb file did not exist on disk, another table type + if (file_on_disk) + { + // Ignore this ndb table + gptr record= hash_search(&ndb_tables, file_name, strlen(file_name)); + DBUG_ASSERT(record); + hash_delete(&ndb_tables, record); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TABLE_EXISTS_ERROR, + "Local table %s.%s shadows ndb table", + db, file_name); + } + continue; + } + if (file_on_disk) + { + // File existed in NDB and as frm file, put in ok_tables list + my_hash_insert(&ok_tables, (byte*)file_name); continue; } - DBUG_PRINT("info", ("%s existed on disk", name)); // The .ndb file exists on disk, but it's not in list of tables in ndb // Verify that handler agrees table is gone. @@ -8621,7 +8643,7 @@ void ndb_serialize_cond(const Item *item, void *arg) curr_cond->ndb_item= new Ndb_item(field, col->getColumnNo()); context->dont_expect(Item::FIELD_ITEM); context->expect_no_field_result(); - if (context->expect_mask) + if (! context->expecting_nothing()) { // We have not seen second argument yet if (type == MYSQL_TYPE_TIME || @@ -8926,7 +8948,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::STRING_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -8956,7 +8978,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::REAL_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -8979,7 +9001,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::INT_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9002,7 +9024,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::DECIMAL_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9052,7 +9074,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::STRING_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9085,7 +9107,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::INT_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9112,7 +9134,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::REAL_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9135,7 +9157,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::VARBIN_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); @@ -9160,7 +9182,7 @@ void ndb_serialize_cond(const Item *item, void *arg) NDB_ITEM_QUALIFICATION q; q.value_type= Item::DECIMAL_ITEM; curr_cond->ndb_item= new Ndb_item(NDB_VALUE, q, item); - if (context->expect_field_result_mask) + if (! context->expecting_no_field_result()) { // We have not seen the field argument yet context->expect_only(Item::FIELD_ITEM); |