Skip to content

Commit a524ec5

Browse files
committed
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 acd071f (MDEV-21923).
1 parent a096f12 commit a524ec5

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

storage/innobase/log/log0log.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -1237,11 +1237,10 @@ void log_t::clear_mmap() noexcept
12371237
#ifdef HAVE_PMEM
12381238
if (!is_opened())
12391239
{
1240-
latch.wr_lock(SRW_LOCK_CALL);
1240+
ut_d(latch.wr_lock(SRW_LOCK_CALL));
12411241
ut_ad(!resize_in_progress());
12421242
ut_ad(get_lsn() == get_flushed_lsn(std::memory_order_relaxed));
1243-
buf_size= unsigned(std::min<uint64_t>(capacity(), buf_size_max));
1244-
latch.wr_unlock();
1243+
ut_d(latch.wr_unlock());
12451244
return;
12461245
}
12471246
#endif

storage/innobase/log/log0recv.cc

+3
Original file line numberDiff line numberDiff line change
@@ -4590,7 +4590,10 @@ inline void log_t::set_recovered() noexcept
45904590
}
45914591
#ifdef HAVE_PMEM
45924592
else
4593+
{
4594+
buf_size= unsigned(std::min<uint64_t>(capacity(), buf_size_max));
45934595
mprotect(buf, size_t(file_size), PROT_READ | PROT_WRITE);
4596+
}
45944597
#endif
45954598
}
45964599

0 commit comments

Comments
 (0)