diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2022-05-27 13:08:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2022-05-27 13:08:44 +0300 |
commit | 41bae618ddb195d2b7c84ee90c1410a3f580ce9a (patch) | |
tree | 2192081081a5e080ffc47566d0cbbebbde809f46 | |
parent | ea40c75c2793f15e57482a0b374ab48b81b8e3ac (diff) | |
download | mariadb-git-41bae618ddb195d2b7c84ee90c1410a3f580ce9a.tar.gz |
Clean up mtr_t
mtr_t::is_empty(): Replaces mtr_t::get_log() and mtr_t::get_memo().
mtr_t::get_log_size(): Replaces mtr_t::get_log().
mtr_t::print(): Remove, unused function.
ReleaseBlocks::ReleaseBlocks(): Remove an unused parameter.
-rw-r--r-- | storage/innobase/fil/fil0crypt.cc | 3 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 2 | ||||
-rw-r--r-- | storage/innobase/include/mtr0mtr.h | 29 | ||||
-rw-r--r-- | storage/innobase/mtr/mtr0mtr.cc | 34 |
4 files changed, 12 insertions, 56 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 5830634692b..395dfc8590e 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1961,8 +1961,7 @@ fil_crypt_rotate_page( /* If block read failed mtr memo and log should be empty. */ ut_ad(!mtr.has_modifications()); ut_ad(!mtr.is_dirty()); - ut_ad(mtr.get_memo()->size() == 0); - ut_ad(mtr.get_log()->size() == 0); + ut_ad(mtr.is_empty()); mtr.commit(); } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 7d4938b1cd6..fcb0b06c1c2 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -3676,7 +3676,7 @@ fil_names_clear( for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.named_spaces); space != NULL; ) { - if (mtr.get_log()->size() + if (mtr.get_log_size() + strlen(space->chain.start->name) >= RECV_SCAN_SIZE - (3 + 5 + 1)) { /* Prevent log parse buffer overflow */ diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 0c7051ed31a..903b3f4699f 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -54,13 +54,6 @@ savepoint. */ #define mtr_memo_release(m, o, t) \ (m)->memo_release((o), (t)) -/** Print info of an mtr handle. */ -#define mtr_print(m) (m)->print() - -/** Return the log object of a mini-transaction buffer. -@return log */ -#define mtr_get_log(m) (m)->get_log() - /** Push an object to an mtr memo stack. */ #define mtr_memo_push(m, o, t) (m)->memo_push(o, t) @@ -360,30 +353,13 @@ public: const byte* ptr, ulint flags) const; - /** Print info of an mtr handle. */ - void print() const; - /** @return true if mini-transaction contains modifications. */ bool has_modifications() const { return m_modifications; } - - /** @return the memo stack */ - const mtr_buf_t* get_memo() const { return &m_memo; } - - /** @return the memo stack */ - mtr_buf_t* get_memo() { return &m_memo; } #endif /* UNIV_DEBUG */ /** @return true if a record was added to the mini-transaction */ bool is_dirty() const { return m_made_dirty; } - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - const mtr_buf_t* get_log() const { return &m_log; } - - /** Get the buffered redo log of this mini-transaction. - @return redo log */ - mtr_buf_t* get_log() { return &m_log; } - /** Push an object to an mtr memo stack. @param object object @param type object type: MTR_MEMO_S_LOCK, ... */ @@ -395,6 +371,11 @@ public: static inline bool is_block_dirtied(const buf_block_t* block) MY_ATTRIBUTE((warn_unused_result)); + /** @return the size of the log is empty */ + size_t get_log_size() const { return m_log.size(); } + /** @return whether the log and memo are empty */ + bool is_empty() const { return m_memo.size() == 0 && m_log.size() == 0; } + /** Write request types */ enum write_type { diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 2daada16a91..2feb5a0583f 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -360,22 +360,10 @@ struct DebugCheck { struct ReleaseBlocks { const lsn_t start, end; -#ifdef UNIV_DEBUG - const mtr_buf_t &memo; - - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t &memo) : - start(start), end(end), memo(memo) -#else /* UNIV_DEBUG */ - ReleaseBlocks(lsn_t start, lsn_t end, const mtr_buf_t&) : - start(start), end(end) -#endif /* UNIV_DEBUG */ - { - ut_ad(start); - ut_ad(end); - } + ReleaseBlocks(lsn_t start, lsn_t end) : start(start), end(end) {} /** @return true always */ - bool operator()(mtr_memo_slot_t* slot) const + bool operator()(mtr_memo_slot_t *slot) const { if (!slot->object) return true; @@ -492,9 +480,8 @@ void mtr_t::commit() else ut_ad(!m_freed_space); - m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> - (ReleaseBlocks(lsns.first, m_commit_lsn, - m_memo))); + m_memo.for_each_block_in_reverse + (CIterate<const ReleaseBlocks>(ReleaseBlocks(lsns.first, m_commit_lsn))); if (m_made_dirty) mysql_mutex_unlock(&log_sys.flush_order_mutex); @@ -615,8 +602,7 @@ void mtr_t::commit_shrink(fil_space_t &space) m_memo.for_each_block_in_reverse(CIterate<Shrink>{space}); m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks> - (ReleaseBlocks(start_lsn, m_commit_lsn, - m_memo))); + (ReleaseBlocks(start_lsn, m_commit_lsn))); mysql_mutex_unlock(&log_sys.flush_order_mutex); mutex_enter(&fil_system.mutex); @@ -1238,16 +1224,6 @@ mtr_t::memo_contains_page_flagged( return m_memo.for_each_block_in_reverse(iteration) ? NULL : iteration.functor.get_block(); } - -/** Print info of an mtr handle. */ -void -mtr_t::print() const -{ - ib::info() << "Mini-transaction handle: memo size " - << m_memo.size() << " bytes log size " - << get_log()->size() << " bytes"; -} - #endif /* UNIV_DEBUG */ |