summaryrefslogtreecommitdiff
path: root/storage/innobase/mtr/mtr0mtr.cc
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-09-09 11:58:15 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-09-09 11:58:15 +0530
commitb1009ae5c16697d5eef443cc6a60a74301148c73 (patch)
tree9e48295ece91aa6026406cdfa084542e9dbf9d1a /storage/innobase/mtr/mtr0mtr.cc
parentf99cace77fbf3076137ba63b024465c6ab6ee25e (diff)
downloadmariadb-git-b1009ae5c16697d5eef443cc6a60a74301148c73.tar.gz
MDEV-23456 fil_space_crypt_t::write_page0() is accessing an uninitialized page
buf_page_create() is invoked when page is initialized. So that previous contents of the page ignored. In few cases, it calls buf_page_get_gen() is called to fetch the page from buffer pool. It should take x-latch on the page. If other thread uses the block or block io state is different from BUF_IO_NONE then release the mutex and check the state and buffer fix count again. For compressed page, use the existing free block from LRU list to create new page. Retry to fetch the compressed page if it is in flush list fseg_create(), fseg_create_general(): Introduce block as a parameter where segment header is placed. It is used to avoid repetitive x-latch on the same page Change the assert to check whether the page has SX latch and X latch in all callee function of buf_page_create() mtr_t::get_fix_count(): Get the buffer fix count of the given block added by the mtr FindBlock is added to find the buffer fix count of the given block acquired by the mini-transaction
Diffstat (limited to 'storage/innobase/mtr/mtr0mtr.cc')
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index b649d907c23..6d0492f30f2 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -308,6 +308,32 @@ struct DebugCheck {
};
#endif
+/** Find buffer fix count of the given block acquired by the
+mini-transaction */
+struct FindBlock
+{
+ int32_t num_fix;
+ buf_block_t *block;
+
+ FindBlock(buf_block_t *block_buf): num_fix(0), block(block_buf) {}
+ bool operator()(const mtr_memo_slot_t* slot)
+ {
+ if (slot->object != NULL)
+ {
+ buf_block_t *mtr_block= reinterpret_cast<buf_block_t*>(slot->object);
+ if (mtr_block == block)
+ num_fix++;
+ }
+
+ return true;
+ }
+
+ int32_t get_num_fix()
+ {
+ return num_fix;
+ }
+};
+
/** Release a resource acquired by the mini-transaction. */
struct ReleaseBlocks {
/** Release specific object */
@@ -804,6 +830,15 @@ mtr_t::release_free_extents(ulint n_reserved)
space->release_free_extents(n_reserved);
}
+int32_t mtr_t::get_fix_count(buf_block_t *block)
+{
+ struct FindBlock find_block(block);
+ Iterate<FindBlock> iteration(find_block);
+ if (m_memo.for_each_block(iteration))
+ return iteration.functor.get_num_fix();
+ return 0;
+}
+
#ifdef UNIV_DEBUG
/** Check if memo contains the given item.
@return true if contains */