diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-23 09:19:06 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-07-23 09:19:06 +0300 |
commit | 5e76e234f5e1821fda291cef4cc77d3ecb4dfcfc (patch) | |
tree | a1789512e0f9c549b41e5dd3628e139f297d45f4 /storage/innobase/handler/ha_innodb.cc | |
parent | 92014bd1c611fd27c487bcc47a7521baa435214c (diff) | |
parent | 5f2628d1eea21d9732f582b77782b072e5e04014 (diff) | |
download | mariadb-git-5e76e234f5e1821fda291cef4cc77d3ecb4dfcfc.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'storage/innobase/handler/ha_innodb.cc')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 40b38814a85..67822d0b752 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -519,7 +519,6 @@ static PSI_cond_info all_innodb_conds[] = { performance schema instrumented if "UNIV_PFS_MUTEX" is defined */ static PSI_mutex_info all_innodb_mutexes[] = { - PSI_KEY(autoinc_mutex), PSI_KEY(buf_pool_mutex), PSI_KEY(cache_last_read_mutex), PSI_KEY(dict_foreign_err_mutex), @@ -567,7 +566,6 @@ static PSI_mutex_info all_innodb_mutexes[] = { PSI_KEY(rtr_match_mutex), PSI_KEY(rtr_path_mutex), PSI_KEY(trx_sys_mutex), - PSI_KEY(zip_pad_mutex) }; # endif /* UNIV_PFS_MUTEX */ @@ -2382,7 +2380,7 @@ ha_innobase::innobase_reset_autoinc( if (error == DB_SUCCESS) { dict_table_autoinc_initialize(m_prebuilt->table, autoinc); - mutex_exit(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.unlock(); } return(error); @@ -5729,7 +5727,7 @@ initialize_auto_increment(dict_table_t* table, const Field* field) const unsigned col_no = innodb_col_no(field); - mutex_enter(&table->autoinc_mutex); + table->autoinc_mutex.lock(); table->persistent_autoinc = static_cast<uint16_t>( dict_table_get_nth_col_pos(table, col_no, NULL) + 1) @@ -5760,7 +5758,7 @@ initialize_auto_increment(dict_table_t* table, const Field* field) innobase_get_int_col_max_value(field)); } - mutex_exit(&table->autoinc_mutex); + table->autoinc_mutex.unlock(); } /** Open an InnoDB table @@ -7568,7 +7566,7 @@ ha_innobase::innobase_lock_autoinc(void) switch (innobase_autoinc_lock_mode) { case AUTOINC_NO_LOCKING: /* Acquire only the AUTOINC mutex. */ - mutex_enter(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.lock(); break; case AUTOINC_NEW_STYLE_LOCKING: @@ -7577,24 +7575,19 @@ ha_innobase::innobase_lock_autoinc(void) transaction has already acquired the AUTOINC lock on behalf of a LOAD FILE or INSERT ... SELECT etc. type of statement. */ - if (thd_sql_command(m_user_thd) == SQLCOM_INSERT - || thd_sql_command(m_user_thd) == SQLCOM_REPLACE - || thd_sql_command(m_user_thd) == SQLCOM_END // RBR event - ) { - + switch (thd_sql_command(m_user_thd)) { + case SQLCOM_INSERT: + case SQLCOM_REPLACE: + case SQLCOM_END: // RBR event /* Acquire the AUTOINC mutex. */ - mutex_enter(&m_prebuilt->table->autoinc_mutex); - + m_prebuilt->table->autoinc_mutex.lock(); /* We need to check that another transaction isn't already holding the AUTOINC lock on the table. */ - if (m_prebuilt->table->n_waiting_or_granted_auto_inc_locks) { - /* Release the mutex to avoid deadlocks and - fall back to old style locking. */ - mutex_exit(&m_prebuilt->table->autoinc_mutex); - } else { + if (!m_prebuilt->table->n_waiting_or_granted_auto_inc_locks) { /* Do not fall back to old style locking. */ - break; + DBUG_RETURN(error); } + m_prebuilt->table->autoinc_mutex.unlock(); } /* Use old style locking. */ /* fall through */ @@ -7606,7 +7599,7 @@ ha_innobase::innobase_lock_autoinc(void) if (error == DB_SUCCESS) { /* Acquire the AUTOINC mutex. */ - mutex_enter(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.lock(); } break; @@ -7634,7 +7627,7 @@ ha_innobase::innobase_set_max_autoinc( if (error == DB_SUCCESS) { dict_table_autoinc_update_if_greater(m_prebuilt->table, auto_inc); - mutex_exit(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.unlock(); } return(error); @@ -13046,7 +13039,7 @@ create_table_info_t::create_table_update_dict() autoinc = 1; } - mutex_enter(&innobase_table->autoinc_mutex); + innobase_table->autoinc_mutex.lock(); dict_table_autoinc_initialize(innobase_table, autoinc); if (innobase_table->is_temporary()) { @@ -13074,7 +13067,7 @@ create_table_info_t::create_table_update_dict() } } - mutex_exit(&innobase_table->autoinc_mutex); + innobase_table->autoinc_mutex.unlock(); } innobase_parse_hint_from_comment(m_thd, innobase_table, m_form->s); @@ -16741,7 +16734,7 @@ ha_innobase::innobase_get_autoinc( /* It should have been initialized during open. */ if (*value == 0) { m_prebuilt->autoinc_error = DB_UNSUPPORTED; - mutex_exit(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.unlock(); } } @@ -16765,7 +16758,7 @@ ha_innobase::innobase_peek_autoinc(void) innodb_table = m_prebuilt->table; - mutex_enter(&innodb_table->autoinc_mutex); + innodb_table->autoinc_mutex.lock(); auto_inc = dict_table_autoinc_read(innodb_table); @@ -16774,7 +16767,7 @@ ha_innobase::innobase_peek_autoinc(void) " '" << innodb_table->name << "'"; } - mutex_exit(&innodb_table->autoinc_mutex); + innodb_table->autoinc_mutex.unlock(); return(auto_inc); } @@ -16881,7 +16874,7 @@ ha_innobase::get_auto_increment( /* Out of range number. Let handler::update_auto_increment() take care of this */ m_prebuilt->autoinc_last_value = 0; - mutex_exit(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.unlock(); *nb_reserved_values= 0; return; } @@ -16924,7 +16917,7 @@ ha_innobase::get_auto_increment( m_prebuilt->autoinc_offset = offset; m_prebuilt->autoinc_increment = increment; - mutex_exit(&m_prebuilt->table->autoinc_mutex); + m_prebuilt->table->autoinc_mutex.unlock(); } /*******************************************************************//** |