diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-11 20:09:34 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-11 20:09:34 +0200 |
commit | a4b7232b2cfd504057c26f9b40a2dacf064dca73 (patch) | |
tree | 9a33e1d13f7b7b716da89fe41f3ffdd3bf6221ba /sql | |
parent | a8650b64ede7330e83e84226cccd77ba8e05fa29 (diff) | |
parent | 1ea6ac3c953f847da033254d5df67f57987a1884 (diff) | |
download | mariadb-git-a4b7232b2cfd504057c26f9b40a2dacf064dca73.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql')
-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 |
4 files changed, 17 insertions, 8 deletions
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 b043f83c72c..7acbc73bc3b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8492,14 +8492,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()) @@ -8539,6 +8544,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; @@ -8546,10 +8552,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); } |