Skip to content

Commit

Permalink
MDEV-22718: purge_sys.low_limit_no() is not protected
Browse files Browse the repository at this point in the history
purge_sys_t::low_limit_no(): Adjust a comment. Actually, this
is protected after all.

TrxUndoRsegsIterator::set_next(): Reduce the critical section
of purge_sys.rseg->latch. Some purge_sys fields are accessed
only by the purge coordinator task.
  • Loading branch information
dr-m committed Oct 6, 2022
1 parent 97b0eee commit ea1415c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 4 additions & 1 deletion storage/innobase/include/trx0purge.h
Expand Up @@ -269,7 +269,10 @@ class purge_sys_t
/** A wrapper around ReadView::low_limit_no(). */
trx_id_t low_limit_no() const
{
/* MDEV-22718 FIXME: We are not holding latch here! */
/* Other callers than purge_coordinator_callback() must be holding
purge_sys.latch here. The purge coordinator task may call this
without holding any latch, because it is the only thread that may
modify purge_sys.view. */
return view.low_limit_no();
}
/** A wrapper around trx_sys_t::clone_oldest_view(). */
Expand Down
12 changes: 6 additions & 6 deletions storage/innobase/trx/trx0purge.cc
Expand Up @@ -110,7 +110,7 @@ TRANSACTIONAL_INLINE inline bool TrxUndoRsegsIterator::set_next()
ut_ad(purge_sys.rseg->space->id == TRX_SYS_SPACE
|| srv_is_undo_tablespace(purge_sys.rseg->space->id));

trx_id_t last_trx_no, tail_trx_no;
trx_id_t last_trx_no;
{
#ifdef SUX_LOCK_GENERIC
purge_sys.rseg->latch.rd_lock(SRW_LOCK_CALL);
Expand All @@ -119,9 +119,7 @@ TRANSACTIONAL_INLINE inline bool TrxUndoRsegsIterator::set_next()
{purge_sys.rseg->latch};
#endif
last_trx_no = purge_sys.rseg->last_trx_no();
tail_trx_no = purge_sys.tail.trx_no;

purge_sys.tail.trx_no = last_trx_no;
purge_sys.hdr_offset = purge_sys.rseg->last_offset();
purge_sys.hdr_page_no = purge_sys.rseg->last_page_no;

Expand All @@ -130,11 +128,13 @@ TRANSACTIONAL_INLINE inline bool TrxUndoRsegsIterator::set_next()
#endif
}

/* Only the purge coordinator task will access
purge_sys.rseg_iter or purge_sys.hdr_page_no. */
/* Only the purge coordinator task will access this object
purge_sys.rseg_iter, or any of purge_sys.hdr_page_no,
purge_sys.tail, purge_sys.head, or modify purge_sys.view. */
ut_ad(last_trx_no == m_rsegs.trx_no);
ut_a(purge_sys.hdr_page_no != FIL_NULL);
ut_a(tail_trx_no <= last_trx_no);
ut_a(purge_sys.tail.trx_no <= last_trx_no);
purge_sys.tail.trx_no = last_trx_no;

return(true);
}
Expand Down

0 comments on commit ea1415c

Please sign in to comment.