summaryrefslogtreecommitdiff
path: root/storage/innobase/mtr
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-07-20 14:53:24 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-07-20 14:53:24 +0300
commitca9276e37ea29468406d5ec7c17d2ad5c032637f (patch)
tree993694268974407425e53edfb4dcd10a04c2258e /storage/innobase/mtr
parenta1e52e7f32cee7c204078db4c4beb88250d7e1f6 (diff)
parent57ec42bc321dee796ce8e711a4499cd665513009 (diff)
downloadmariadb-git-ca9276e37ea29468406d5ec7c17d2ad5c032637f.tar.gz
Merge 10.1 into 10.2
Diffstat (limited to 'storage/innobase/mtr')
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc57
1 files changed, 37 insertions, 20 deletions
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 9fdb10e230c..b649d907c23 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -218,6 +218,13 @@ static void memo_slot_release(mtr_memo_slot_t *slot)
case MTR_MEMO_SX_LOCK:
rw_lock_sx_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
+ case MTR_MEMO_SPACE_X_LOCK:
+ {
+ fil_space_t *space= static_cast<fil_space_t*>(slot->object);
+ space->committed_size= space->size;
+ rw_lock_x_unlock(&space->latch);
+ }
+ break;
case MTR_MEMO_X_LOCK:
rw_lock_x_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
@@ -251,6 +258,13 @@ struct ReleaseLatches {
case MTR_MEMO_S_LOCK:
rw_lock_s_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
+ case MTR_MEMO_SPACE_X_LOCK:
+ {
+ fil_space_t *space= static_cast<fil_space_t*>(slot->object);
+ space->committed_size= space->size;
+ rw_lock_x_unlock(&space->latch);
+ }
+ break;
case MTR_MEMO_X_LOCK:
rw_lock_x_unlock(reinterpret_cast<rw_lock_t*>(slot->object));
break;
@@ -564,13 +578,23 @@ mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
ut_ad(space);
ut_ad(space->id == space_id);
- x_lock(&space->latch, file, line);
+ x_lock_space(space, file, line);
ut_ad(space->purpose == FIL_TYPE_TEMPORARY
|| space->purpose == FIL_TYPE_IMPORT
|| space->purpose == FIL_TYPE_TABLESPACE);
return(space);
}
+/** Exclusively aqcuire a tablespace latch.
+@param space tablespace
+@param file source code file name of the caller
+@param line source code line number */
+void mtr_t::x_lock_space(fil_space_t *space, const char *file, unsigned line)
+{
+ rw_lock_x_lock_inline(&space->latch, 0, file, line);
+ memo_push(space, MTR_MEMO_SPACE_X_LOCK);
+}
+
/** Look up the system tablespace. */
void
mtr_t::lookup_sys_space()
@@ -764,27 +788,20 @@ with index pages.
void
mtr_t::release_free_extents(ulint n_reserved)
{
- fil_space_t* space;
-
- ut_ad(!m_undo_space);
-
- if (m_user_space) {
+ fil_space_t *space= m_user_space;
- ut_ad(m_user_space->id == m_user_space_id);
- ut_ad(memo_contains(get_memo(), &m_user_space->latch,
- MTR_MEMO_X_LOCK));
+ ut_ad(!m_undo_space);
- space = m_user_space;
- } else {
-
- ut_ad(m_sys_space->id == TRX_SYS_SPACE);
- ut_ad(memo_contains(get_memo(), &m_sys_space->latch,
- MTR_MEMO_X_LOCK));
-
- space = m_sys_space;
- }
+ if (space)
+ ut_ad(m_user_space->id == m_user_space_id);
+ else
+ {
+ ut_ad(m_sys_space->id == TRX_SYS_SPACE);
+ space= m_sys_space;
+ }
- space->release_free_extents(n_reserved);
+ ut_ad(memo_contains(get_memo(), space, MTR_MEMO_SPACE_X_LOCK));
+ space->release_free_extents(n_reserved);
}
#ifdef UNIV_DEBUG