summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-03-05 10:36:51 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-03-05 10:36:51 +0200
commit8bab5bb332aec671febbfc1b9c30c2b269c1d7d4 (patch)
tree67f1dfddcba6458408565eb9065234a325156d66 /storage
parent82efe4a15a985c3902e80eb7e1a70841c08d9f2e (diff)
parent5bd994b0d56d11bf62717a84172c49ca9ed37de4 (diff)
downloadmariadb-git-8bab5bb332aec671febbfc1b9c30c2b269c1d7d4.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/handler/ha_innodb.cc6
-rw-r--r--storage/innobase/lock/lock0lock.cc31
-rw-r--r--storage/innobase/trx/trx0trx.cc41
-rw-r--r--storage/maria/ma_recovery.c1
-rw-r--r--storage/maria/ma_recovery_util.c1
5 files changed, 41 insertions, 39 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 5746ac703f6..76723d62761 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4119,8 +4119,10 @@ static int innodb_init(void* p)
innobase_hton->flush_logs = innobase_flush_logs;
innobase_hton->show_status = innobase_show_status;
innobase_hton->flags =
- HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS
- | HTON_NATIVE_SYS_VERSIONING | HTON_WSREP_REPLICATION;
+ HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS |
+ HTON_NATIVE_SYS_VERSIONING |
+ HTON_WSREP_REPLICATION |
+ HTON_REQUIRES_CLOSE_AFTER_TRUNCATE;
#ifdef WITH_WSREP
innobase_hton->abort_transaction=wsrep_abort_transaction;
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index cb69e99a111..e1d9dea0dc5 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -4266,6 +4266,18 @@ lock_check_dict_lock(
and release possible other transactions waiting because of these locks. */
void lock_release(trx_t* trx)
{
+#ifdef UNIV_DEBUG
+ std::set<table_id_t> to_evict;
+ if (innodb_evict_tables_on_commit_debug && !trx->is_recovered)
+# if 1 /* if dict_stats_exec_sql() were not playing dirty tricks */
+ if (!mutex_own(&dict_sys.mutex))
+# else /* this would be more proper way to do it */
+ if (!trx->dict_operation_lock_mode && !trx->dict_operation)
+# endif
+ for (const auto& p : trx->mod_tables)
+ if (!p.first->is_temporary())
+ to_evict.emplace(p.first->id);
+#endif
ulint count = 0;
trx_id_t max_trx_id = trx_sys.get_max_trx_id();
@@ -4314,6 +4326,25 @@ void lock_release(trx_t* trx)
}
lock_mutex_exit();
+
+#ifdef UNIV_DEBUG
+ if (to_evict.empty()) {
+ return;
+ }
+ mutex_enter(&dict_sys.mutex);
+ lock_mutex_enter();
+ for (table_id_t id : to_evict) {
+ if (dict_table_t *table = dict_table_open_on_id(
+ id, TRUE, DICT_TABLE_OP_OPEN_ONLY_IF_CACHED)) {
+ if (!table->get_ref_count()
+ && !UT_LIST_GET_LEN(table->locks)) {
+ dict_sys.remove(table, true);
+ }
+ }
+ }
+ lock_mutex_exit();
+ mutex_exit(&dict_sys.mutex);
+#endif
}
/* True if a lock mode is S or X */
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 14bd684e2ce..1bcc92f8b97 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1272,16 +1272,6 @@ trx_update_mod_tables_timestamp(
const time_t now = time(NULL);
trx_mod_tables_t::const_iterator end = trx->mod_tables.end();
-#ifdef UNIV_DEBUG
- const bool preserve_tables = !innodb_evict_tables_on_commit_debug
- || trx->is_recovered /* avoid trouble with XA recovery */
-# if 1 /* if dict_stats_exec_sql() were not playing dirty tricks */
- || mutex_own(&dict_sys.mutex)
-# else /* this would be more proper way to do it */
- || trx->dict_operation_lock_mode || trx->dict_operation
-# endif
- ;
-#endif
for (trx_mod_tables_t::const_iterator it = trx->mod_tables.begin();
it != end;
@@ -1297,26 +1287,6 @@ trx_update_mod_tables_timestamp(
intrusive. */
dict_table_t* table = it->first;
table->update_time = now;
-#ifdef UNIV_DEBUG
- if (preserve_tables || table->get_ref_count()
- || UT_LIST_GET_LEN(table->locks)) {
- /* do not evict when committing DDL operations
- or if some other transaction is holding the
- table handle */
- continue;
- }
- /* recheck while holding the mutex that blocks
- table->acquire() */
- mutex_enter(&dict_sys.mutex);
- mutex_enter(&lock_sys.mutex);
- const bool do_evict = !table->get_ref_count()
- && !UT_LIST_GET_LEN(table->locks);
- mutex_exit(&lock_sys.mutex);
- if (do_evict) {
- dict_sys.remove(table, true);
- }
- mutex_exit(&dict_sys.mutex);
-#endif
}
trx->mod_tables.clear();
@@ -1402,16 +1372,9 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
so that there will be no race condition in lock_release(). */
while (UNIV_UNLIKELY(is_referenced()))
ut_delay(srv_spin_wait_delay);
- release_locks();
- id= 0;
}
else
- {
ut_ad(read_only || !rsegs.m_redo.rseg);
- release_locks();
- }
-
- DEBUG_SYNC_C("after_trx_committed_in_memory");
if (read_only || !rsegs.m_redo.rseg)
{
@@ -1424,6 +1387,10 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
is_recovered= false;
}
+ release_locks();
+ id= 0;
+ DEBUG_SYNC_C("after_trx_committed_in_memory");
+
while (dict_table_t *table= UT_LIST_GET_FIRST(lock.evicted_tables))
{
UT_LIST_REMOVE(lock.evicted_tables, table);
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index 8f108e3f03f..be8a9fe8b2a 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -1453,6 +1453,7 @@ static int new_table(uint16 sid, const char *name, LSN lsn_of_file_id)
}
if (maria_is_crashed(info))
{
+ tprint(tracef, "\n");
eprint(tracef, "Table '%s' is crashed, skipping it. Please repair it with"
" aria_chk -r", share->open_file_name.str);
recovery_found_crashed_tables++;
diff --git a/storage/maria/ma_recovery_util.c b/storage/maria/ma_recovery_util.c
index 3bbda614991..fe43d812600 100644
--- a/storage/maria/ma_recovery_util.c
+++ b/storage/maria/ma_recovery_util.c
@@ -98,6 +98,7 @@ void eprint(FILE *trace_file __attribute__ ((unused)),
fputc('\n', trace_file);
if (trace_file != stderr)
{
+ va_start(args, format);
my_printv_error(HA_ERR_INITIALIZATION, format, MYF(0), args);
}
va_end(args);