diff options
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 16 | ||||
-rw-r--r-- | storage/innobase/include/buf0buf.h | 16 | ||||
-rw-r--r-- | storage/innobase/trx/trx0trx.cc | 8 |
3 files changed, 19 insertions, 21 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index a7f1b38f68f..cc92cb3fdbe 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -3436,13 +3436,13 @@ func_exit: return(TRUE); } -/** Given a tablespace id and page number tries to get that page. If the -page is not in the buffer pool it is not loaded and NULL is returned. -Suitable for using when holding the lock_sys_t::mutex. -@param[in] page_id page id -@param[in] mtr mini-transaction -@return pointer to a page or NULL */ -buf_block_t* buf_page_try_get(const page_id_t page_id, mtr_t *mtr) +/** Try to U-latch a page. +Suitable for using when holding the lock_sys latches (as it avoids deadlock). +@param[in] page_id page identifier +@param[in,out] mtr mini-transaction +@return the block +@retval nullptr if an U-latch cannot be granted immediately */ +buf_block_t *buf_page_try_get(const page_id_t page_id, mtr_t *mtr) { ut_ad(mtr); ut_ad(mtr->is_active()); diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 952acb362b0..bcb75975244 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2020, MariaDB Corporation. +Copyright (c) 2013, 2021, 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 @@ -232,13 +232,13 @@ buf_page_optimistic_get( ib_uint64_t modify_clock,/*!< in: modify clock value */ mtr_t* mtr); /*!< in: mini-transaction */ -/** Given a tablespace id and page number tries to get that page. If the -page is not in the buffer pool it is not loaded and NULL is returned. -Suitable for using when holding the lock_sys_t::mutex. -@param[in] page_id page id -@param[in] mtr mini-transaction -@return pointer to a page or NULL */ -buf_block_t* buf_page_try_get(const page_id_t page_id, mtr_t *mtr); +/** Try to U-latch a page. +Suitable for using when holding the lock_sys latches (as it avoids deadlock). +@param[in] page_id page identifier +@param[in,out] mtr mini-transaction +@return the block +@retval nullptr if an U-latch cannot be granted immediately */ +buf_block_t *buf_page_try_get(const page_id_t page_id, mtr_t *mtr); /** Get read access to a compressed page (usually of type FIL_PAGE_TYPE_ZBLOB or FIL_PAGE_TYPE_ZBLOB2). diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 50a78adcf53..7ece8a40540 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2020, MariaDB Corporation. +Copyright (c) 2015, 2021, 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 @@ -1323,10 +1323,8 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr) ut_a(!is_recovered); ut_ad(!rsegs.m_redo.rseg); - /* Note: We are asserting without holding the lock mutex. But - that is OK because this transaction is not waiting and cannot - be rolled back and no new locks can (or should) be added - because it is flagged as a non-locking read-only transaction. */ + /* Note: We do not have to hold any lock_sys latch here, because + this is a non-locking transaction. */ ut_a(UT_LIST_GET_LEN(lock.trx_locks) == 0); /* This state change is not protected by any mutex, therefore |