MDEV-36587 InnoDB uses too much memory

log_t::clear_mmap(): Do not modify buf_size; we may have
file_size==0 here during bootstrap.

log_t::set_recovered(): If we are writing to a memory-mapped log,
update log_sys.buf_size to the record payload area of log_sys.buf.

This fixes up commit acd071f599f416ddb4821dec485c4d912844213f
(MDEV-21923).
This commit is contained in:
Marko Mäkelä 2025-04-14 10:33:22 +03:00
parent a096f12ff7
commit a524ec5951
2 changed files with 5 additions and 3 deletions

View File

@ -1237,11 +1237,10 @@ void log_t::clear_mmap() noexcept
#ifdef HAVE_PMEM
if (!is_opened())
{
latch.wr_lock(SRW_LOCK_CALL);
ut_d(latch.wr_lock(SRW_LOCK_CALL));
ut_ad(!resize_in_progress());
ut_ad(get_lsn() == get_flushed_lsn(std::memory_order_relaxed));
buf_size= unsigned(std::min<uint64_t>(capacity(), buf_size_max));
latch.wr_unlock();
ut_d(latch.wr_unlock());
return;
}
#endif

View File

@ -4590,7 +4590,10 @@ inline void log_t::set_recovered() noexcept
}
#ifdef HAVE_PMEM
else
{
buf_size= unsigned(std::min<uint64_t>(capacity(), buf_size_max));
mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE);
}
#endif
}