summaryrefslogtreecommitdiff
path: root/storage/innobase/mtr
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-09-09 15:00:21 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-09-09 15:00:21 +0300
commit66ae50a564f1d145d36f7de8dc266ce9266acf26 (patch)
tree7fe24cde51d4a3f53a4b7a67d48c168016f3dc10 /storage/innobase/mtr
parent9b688471274868ff94115fd6e4255ee01befedad (diff)
parent7e07e38cf687ccd7fa3bd3a35c1eb7e4b307ca5f (diff)
downloadmariadb-git-66ae50a564f1d145d36f7de8dc266ce9266acf26.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase/mtr')
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 235c2807b60..15d7cc4b5a4 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -308,6 +308,24 @@ struct DebugCheck {
};
#endif
+/** Find buffer fix count of the given block acquired by the
+mini-transaction */
+struct FindBlock
+{
+ int32_t num_fix;
+ const buf_block_t *const block;
+
+ FindBlock(const buf_block_t *block_buf): num_fix(0), block(block_buf) {}
+
+ bool operator()(const mtr_memo_slot_t* slot)
+ {
+ if (slot->object == block)
+ ut_d(if (slot->type != MTR_MEMO_MODIFY))
+ num_fix++;
+ return true;
+ }
+};
+
/** Release a resource acquired by the mini-transaction. */
struct ReleaseBlocks {
/** Release specific object */
@@ -735,6 +753,14 @@ inline lsn_t mtr_t::finish_write(ulint len)
return start_lsn;
}
+uint32_t mtr_t::get_fix_count(const buf_block_t *block)
+{
+ Iterate<FindBlock> iteration((FindBlock(block)));
+ if (m_memo.for_each_block(iteration))
+ return iteration.functor.num_fix;
+ return 0;
+}
+
#ifdef UNIV_DEBUG
/** Check if memo contains the given item.
@return true if contains */