diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
|
index e77df7c61d5..12bbc1a61a9 100644
|
--- a/storage/innobase/mtr/mtr0mtr.cc
|
+++ b/storage/innobase/mtr/mtr0mtr.cc
|
@@ -294,50 +294,56 @@ struct DebugCheck {
|
};
|
#endif
|
|
-/** Release a resource acquired by the mini-transaction. */
|
-struct ReleaseBlocks {
|
- /** Release specific object */
|
- ReleaseBlocks(lsn_t start_lsn, lsn_t end_lsn)
|
- :
|
- m_end_lsn(end_lsn),
|
- m_start_lsn(start_lsn)
|
- {
|
- /* Do nothing */
|
- }
|
-
|
- /** Add the modified page to the buffer flush list. */
|
- void add_dirty_page_to_flush_list(mtr_memo_slot_t* slot) const
|
- {
|
- ut_ad(m_end_lsn > 0);
|
- ut_ad(m_start_lsn > 0);
|
-
|
- buf_block_t* block;
|
-
|
- block = reinterpret_cast<buf_block_t*>(slot->object);
|
-
|
- buf_flush_note_modification(block, m_start_lsn, m_end_lsn);
|
- }
|
-
|
- /** @return true always. */
|
- bool operator()(mtr_memo_slot_t* slot) const
|
- {
|
- if (slot->object != NULL) {
|
-
|
- if (slot->type == MTR_MEMO_PAGE_X_FIX
|
- || slot->type == MTR_MEMO_PAGE_SX_FIX) {
|
-
|
- add_dirty_page_to_flush_list(slot);
|
- }
|
- }
|
+/** Release page latches held by the mini-transaction. */
|
+struct ReleaseBlocks
|
+{
|
+ const lsn_t start, end;
|
+#ifdef UNIV_DEBUG
|
+ const mtr_buf_t &memo;
|
|
- return(true);
|
- }
|
+ 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);
|
+ }
|
|
- /** Mini-transaction REDO start LSN */
|
- lsn_t m_end_lsn;
|
+ /** @return true always */
|
+ bool operator()(mtr_memo_slot_t* slot) const
|
+ {
|
+ if (!slot->object)
|
+ return true;
|
+ switch (slot->type) {
|
+ case MTR_MEMO_PAGE_X_FIX:
|
+ case MTR_MEMO_PAGE_SX_FIX:
|
+ break;
|
+ default:
|
+ return true;
|
+ }
|
|
- /** Mini-transaction REDO end LSN */
|
- lsn_t m_start_lsn;
|
+ buf_block_t *block= static_cast<buf_block_t*>(slot->object);
|
+#ifdef UNIV_DEBUG
|
+ /* We add to the flush list only blocks for which redo log records
|
+ have been written, or blocks that have really been modified. */
|
+ extern my_bool opt_bootstrap;
|
+ if (opt_bootstrap && block->page.id == page_id_t(0, FSP_TRX_SYS_PAGE_NO))
|
+ /* FIXME: On bootstrap, buf_dblwr_create() is X-latching the TRX_SYS page
|
+ even though it is not writing redo log for it. */;
|
+ else if (block->page.id.space() == SRV_TMP_SPACE_ID)
|
+ /* modify() is not invoked on pages of temporary tablespaces */;
|
+ else
|
+ {
|
+ Iterate<FindPage> iteration(FindPage(block->frame, MTR_MEMO_MODIFY));
|
+ ut_ad(!memo.for_each_block_in_reverse(iteration));
|
+ }
|
+#endif /* UNIV_DEBUG */
|
+ buf_flush_note_modification(block, start, end);
|
+ return true;
|
+ }
|
};
|
|
/** Write the block contents to the REDO log */
|
@@ -414,7 +420,8 @@ void mtr_t::commit()
|
log_mutex_exit();
|
|
m_memo.for_each_block_in_reverse(CIterate<const ReleaseBlocks>
|
- (ReleaseBlocks(start_lsn, m_commit_lsn)));
|
+ (ReleaseBlocks(start_lsn, m_commit_lsn,
|
+ m_memo)));
|
if (m_made_dirty)
|
log_flush_order_mutex_exit();
|
|