summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/dict/dict0dict.cc6
-rw-r--r--storage/innobase/fil/fil0fil.cc15
-rw-r--r--storage/innobase/handler/ha_innodb.cc14
-rw-r--r--storage/innobase/handler/i_s.cc3
-rw-r--r--storage/innobase/include/dict0mem.h5
-rw-r--r--storage/innobase/include/trx0trx.h4
-rw-r--r--storage/innobase/lock/lock0wait.cc33
-rw-r--r--storage/innobase/row/row0vers.cc2
-rw-r--r--storage/innobase/trx/trx0roll.cc3
-rw-r--r--storage/innobase/trx/trx0trx.cc13
10 files changed, 67 insertions, 31 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 06a38f49212..c97b08c063d 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -5274,3 +5274,9 @@ dict_tf_to_row_format_string(
ut_error;
return(0);
}
+
+bool dict_table_t::is_stats_table() const
+{
+ return !strcmp(name.m_name, TABLE_STATS_NAME) ||
+ !strcmp(name.m_name, INDEX_STATS_NAME);
+}
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 842dbaf1eb2..880fa9d9efa 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2021, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -2989,7 +2989,7 @@ fil_ibd_load(
space = fil_space_get_by_id(space_id);
mutex_exit(&fil_system.mutex);
- if (space != NULL) {
+ if (space) {
/* Compare the filename we are trying to open with the
filename from the first node of the tablespace we opened
previously. Fail if it is different. */
@@ -3001,8 +3001,8 @@ fil_ibd_load(
<< "' with space ID " << space->id
<< ". Another data file called " << node->name
<< " exists with the same space ID.";
- space = NULL;
- return(FIL_LOAD_ID_CHANGED);
+ space = NULL;
+ return(FIL_LOAD_ID_CHANGED);
}
return(FIL_LOAD_OK);
}
@@ -3039,13 +3039,6 @@ fil_ibd_load(
os_offset_t minimum_size;
case DB_SUCCESS:
if (file.space_id() != space_id) {
- ib::info()
- << "Ignoring data file '"
- << file.filepath()
- << "' with space ID " << file.space_id()
- << ", since the redo log references "
- << file.filepath() << " with space ID "
- << space_id << ".";
return(FIL_LOAD_ID_CHANGED);
}
/* Get and test the file size. */
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index b2908fc9819..df5d2e2ddaa 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4856,13 +4856,19 @@ ha_innobase::index_type(
{
dict_index_t* index = innobase_get_index(keynr);
- if (index && index->type & DICT_FTS) {
+ if (!index) {
+ return "Corrupted";
+ }
+
+ if (index->type & DICT_FTS) {
return("FULLTEXT");
- } else if (dict_index_is_spatial(index)) {
+ }
+
+ if (dict_index_is_spatial(index)) {
return("SPATIAL");
- } else {
- return("BTREE");
}
+
+ return("BTREE");
}
/****************************************************************//**
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 2d659d9f9a3..420e7eac9e1 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -2425,7 +2425,8 @@ i_s_fts_deleted_generic_fill(
if (!user_table) {
rw_lock_s_unlock(&dict_sys.latch);
DBUG_RETURN(0);
- } else if (!dict_table_has_fts_index(user_table)) {
+ } else if (!dict_table_has_fts_index(user_table)
+ || !user_table->is_readable()) {
dict_table_close(user_table, FALSE, FALSE);
rw_lock_s_unlock(&dict_sys.latch);
DBUG_RETURN(0);
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index c96ea8806df..b43747268b3 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -2373,6 +2373,11 @@ public:
return true;
return false;
}
+
+ /** Check whether the table name is same as mysql/innodb_stats_table
+ or mysql/innodb_index_stats.
+ @return true if the table name is same as stats table */
+ bool is_stats_table() const;
};
inline void dict_index_t::set_modified(mtr_t& mtr) const
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index f1a13e6ea59..ac161687c87 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1076,6 +1076,10 @@ public:
ut_ad(old_n_ref > 0);
}
+ /** @return whether the table has lock on
+ mysql.innodb_table_stats and mysql.innodb_index_stats */
+ bool has_stats_table_lock() const;
+
/** Free the memory to trx_pools */
void free();
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index b606228b1fe..e5f71e0b151 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -193,28 +193,33 @@ wsrep_is_BF_lock_timeout(
const trx_t* trx,
bool locked = true)
{
- if (trx->error_state != DB_DEADLOCK && trx->is_wsrep() &&
- srv_monitor_timer && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
- ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id)
+ bool long_wait= (trx->error_state != DB_DEADLOCK &&
+ srv_monitor_timer && trx->is_wsrep() &&
+ wsrep_thd_is_BF(trx->mysql_thd, false));
+ bool was_wait= true;
+
+ DBUG_EXECUTE_IF("wsrep_instrument_BF_lock_wait",
+ was_wait=false; long_wait=true;);
+
+ if (long_wait) {
+ ib::info() << "WSREP: BF lock wait long for trx:" << trx->id
<< " query: " << wsrep_thd_query(trx->mysql_thd);
- if (!locked) {
+
+ if (!locked)
lock_mutex_enter();
- }
ut_ad(lock_mutex_own());
trx_print_latched(stderr, trx, 3000);
+ /* Note this will release lock_sys mutex */
+ lock_print_info_all_transactions(stderr);
- if (!locked) {
- lock_mutex_exit();
- }
+ if (locked)
+ lock_mutex_enter();
- srv_print_innodb_monitor = TRUE;
- srv_print_innodb_lock_monitor = TRUE;
- srv_monitor_timer_schedule_now();
- return true;
- }
- return false;
+ return was_wait;
+ } else
+ return false;
}
#endif /* WITH_WSREP */
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index f096149b0aa..b73786074f2 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -457,6 +457,8 @@ row_vers_build_clust_v_col(
ut_ad(dict_index_has_virtual(index));
ut_ad(index->table == clust_index->table);
+ DEBUG_SYNC(current_thd, "ib_clust_v_col_before_row_allocated");
+
ib_vcol_row vc(nullptr);
byte *record = vc.record(thd, index, &maria_table);
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index dc3dd51bb89..4df4f8fff05 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -777,7 +777,8 @@ void trx_rollback_recovered(bool all)
srv_fast_shutdown)
goto discard;
- if (all || trx_get_dict_operation(trx) != TRX_DICT_OP_NONE)
+ if (all || trx_get_dict_operation(trx) != TRX_DICT_OP_NONE
+ || trx->has_stats_table_lock())
{
trx_rollback_active(trx);
if (trx->error_state != DB_SUCCESS)
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index a48ab780960..d01ba992dc5 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -2333,3 +2333,16 @@ trx_set_rw_mode(
trx->read_view.set_creator_trx_id(trx->id);
}
}
+
+bool trx_t::has_stats_table_lock() const
+{
+ for (lock_list::const_iterator it= lock.table_locks.begin(),
+ end= lock.table_locks.end(); it != end; ++it)
+ {
+ const lock_t *lock= *it;
+ if (lock && lock->un_member.tab_lock.table->is_stats_table())
+ return true;
+ }
+
+ return false;
+}