Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-34909 DDL hang during SET GLOBAL innodb_log_file_size on PMEM #3533

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions storage/innobase/include/log0log.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,9 @@ struct log_t

#ifdef HAVE_PMEM
/** Persist the log.
@param lsn desired new value of flushed_to_disk_lsn */
inline void persist(lsn_t lsn) noexcept;
@param lsn desired new value of flushed_to_disk_lsn
@param holding_latch whether the caller is holding exclusive latch */
void persist(lsn_t lsn, bool holding_latch) noexcept;
#endif

bool check_for_checkpoint() const
Expand Down
17 changes: 9 additions & 8 deletions storage/innobase/log/log0log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -730,21 +730,22 @@ static size_t log_pad(lsn_t lsn, size_t pad, byte *begin, byte *extra)
#endif

#ifdef HAVE_PMEM
/** Persist the log.
@param lsn desired new value of flushed_to_disk_lsn */
inline void log_t::persist(lsn_t lsn) noexcept
void log_t::persist(lsn_t lsn, bool holding_latch) noexcept
{
ut_ad(is_pmem());
ut_ad(!write_lock.is_owner());
ut_ad(!flush_lock.is_owner());
#ifdef LOG_LATCH_DEBUG
ut_ad(holding_latch == latch_have_wr());
#endif

lsn_t old= flushed_to_disk_lsn.load(std::memory_order_relaxed);

if (old >= lsn)
return;

const lsn_t resizing{resize_in_progress()};
if (UNIV_UNLIKELY(resizing))
const bool latching{!holding_latch && resize_in_progress()};
if (UNIV_UNLIKELY(latching))
latch.rd_lock(SRW_LOCK_CALL);
const size_t start(calc_lsn_offset(old));
const size_t end(calc_lsn_offset(lsn));
Expand All @@ -771,7 +772,7 @@ inline void log_t::persist(lsn_t lsn) noexcept
DBUG_EXECUTE_IF("crash_after_log_write_upto", DBUG_SUICIDE(););
}

if (UNIV_UNLIKELY(resizing))
if (UNIV_UNLIKELY(latching))
latch.rd_unlock();
}
#endif
Expand Down Expand Up @@ -976,7 +977,7 @@ void log_write_up_to(lsn_t lsn, bool durable,
{
ut_ad(!callback);
if (durable)
log_sys.persist(lsn);
log_sys.persist(lsn, false);
return;
}
#endif
Expand Down Expand Up @@ -1043,7 +1044,7 @@ ATTRIBUTE_COLD void log_write_and_flush()
}
#ifdef HAVE_PMEM
else
log_sys.persist(log_sys.get_lsn());
log_sys.persist(log_sys.get_lsn(), true);
#endif
}

Expand Down