diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.h | 6 | ||||
-rw-r--r-- | sql/mdl.cc | 1 | ||||
-rw-r--r-- | sql/mdl.h | 4 | ||||
-rw-r--r-- | sql/sql_acl.cc | 8 | ||||
-rw-r--r-- | sql/sql_show.cc | 12 | ||||
-rw-r--r-- | sql/sql_table.cc | 11 |
6 files changed, 27 insertions, 15 deletions
diff --git a/sql/handler.h b/sql/handler.h index 2bf6ff1d0fa..26c183be4c7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -307,7 +307,11 @@ enum chf_create_flags { #define HA_PERSISTENT_TABLE (1ULL << 48) -/* If storage engine uses another engine as a base */ +/* + If storage engine uses another engine as a base + This flag is also needed if the table tries to open the .frm file + as part of drop table. +*/ #define HA_REUSES_FILE_NAMES (1ULL << 49) /* diff --git a/sql/mdl.cc b/sql/mdl.cc index 2b556eb436c..e83ef151554 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -2787,6 +2787,7 @@ void MDL_context::find_deadlock() context was waiting is concurrently satisfied. */ (void) victim->m_wait.set_status(MDL_wait::VICTIM); + victim->inc_deadlock_overweight(); victim->unlock_deadlock_victim(); if (victim == this) diff --git a/sql/mdl.h b/sql/mdl.h index 9dbf9aa7f4f..45d28cc3068 100644 --- a/sql/mdl.h +++ b/sql/mdl.h @@ -929,7 +929,8 @@ public: /** @pre Only valid if we started waiting for lock. */ inline uint get_deadlock_weight() const - { return m_waiting_for->get_deadlock_weight(); } + { return m_waiting_for->get_deadlock_weight() + m_deadlock_overweight; } + void inc_deadlock_overweight() { m_deadlock_overweight++; } /** Post signal to the context (and wake it up if necessary). @@ -1047,6 +1048,7 @@ private: */ MDL_wait_for_subgraph *m_waiting_for; LF_PINS *m_pins; + uint m_deadlock_overweight= 0; private: MDL_ticket *find_ticket(MDL_request *mdl_req, enum_mdl_duration *duration); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 4ae27a7e3ce..3ec8b9ecfcd 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3924,7 +3924,7 @@ bool change_password(THD *thd, LEX_USER *user) char buff[512]; ulong query_length= 0; enum_binlog_format save_binlog_format; - int result=0; + bool result= false, acl_cache_is_locked= false; ACL_USER *acl_user; ACL_USER::AUTH auth; const char *password_plugin= 0; @@ -3949,7 +3949,7 @@ bool change_password(THD *thd, LEX_USER *user) if ((result= tables.open_and_lock(thd, Table_user, TL_WRITE))) DBUG_RETURN(result != 1); - result= 1; + acl_cache_is_locked= 1; mysql_mutex_lock(&acl_cache->lock); if (!(acl_user= find_user_exact(user->host.str, user->user.str))) @@ -4002,7 +4002,7 @@ bool change_password(THD *thd, LEX_USER *user) acl_cache->clear(1); // Clear locked hostname cache mysql_mutex_unlock(&acl_cache->lock); - result= 0; + result= acl_cache_is_locked= 0; if (mysql_bin_log.is_open()) { query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'", @@ -4013,7 +4013,7 @@ bool change_password(THD *thd, LEX_USER *user) FALSE, FALSE, FALSE, 0) > 0; } end: - if (result) + if (acl_cache_is_locked) mysql_mutex_unlock(&acl_cache->lock); close_mysql_tables(thd); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a9f1e1bacef..07432031c17 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8501,14 +8501,19 @@ end: bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) { + DBUG_ENTER("optimize_schema_tables_memory_usage"); + List_iterator<TABLE_LIST> tli(tables); while (TABLE_LIST *table_list= tli++) { + if (!table_list->schema_table) + continue; + TABLE *table= table_list->table; THD *thd=table->in_use; - if (!table_list->schema_table || !thd->fill_information_schema_tables()) + if (!thd->fill_information_schema_tables()) continue; if (!table->is_created()) @@ -8548,6 +8553,7 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) { /* all fields were optimized away. Force a non-0-length row */ table->s->reclength= to_recinfo->length= 1; + to_recinfo->type= FIELD_NORMAL; to_recinfo++; } p->recinfo= to_recinfo; @@ -8555,10 +8561,10 @@ bool optimize_schema_tables_memory_usage(List<TABLE_LIST> &tables) // TODO switch from Aria to Memory if all blobs were optimized away? if (instantiate_tmp_table(table, p->keyinfo, p->start_recinfo, &p->recinfo, table_list->select_lex->options | thd->variables.option_bits)) - return 1; + DBUG_RETURN(1); } } - return 0; + DBUG_RETURN(0); } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 7201a05025e..ef626cd64f3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11002,12 +11002,11 @@ do_continue:; The above is mainly true for the sequence and the partition engine. */ engine_changed= ((new_table->file->ht != table->file->ht) && - (((!(new_table->file->ha_table_flags() & HA_FILE_BASED) || - !(table->file->ha_table_flags() & HA_FILE_BASED))) || - (!(table->file->ha_table_flags() & HA_REUSES_FILE_NAMES) && - !(new_table->file->ha_table_flags() & - HA_REUSES_FILE_NAMES)))); - + ((!(new_table->file->ha_table_flags() & HA_FILE_BASED) || + !(table->file->ha_table_flags() & HA_FILE_BASED))) && + !(table->file->ha_table_flags() & HA_REUSES_FILE_NAMES) && + !(new_table->file->ha_table_flags() & + HA_REUSES_FILE_NAMES)); /* Close the intermediate table that will be the new table, but do not delete it! Even though MERGE tables do not have their children |