Commit fa4f5fcf authored by marko's avatar marko

branches/zip: Fix two bugs.

mtr_commit(): Do not acquire the log mutex if no log records are to be written.

ibuf_set_free_bits_func(): Do not clear mtr.modifications, because that would
prevent the dirty insert buffer bitmap block from being moved to the flush
list.  Instead, assume that mtr_commit() will not acquire log_sys->mutex
because redo logging is disabled.

buf_page_init_for_read(): I/O-fix the block before buf_buddy_alloc(), because
the newly allocated block could otherwise be reused by the compressed page.
parent eec93804
......@@ -2440,6 +2440,7 @@ buf_page_init_for_read(
io-handler thread. */
rw_lock_x_lock_gen(&block->lock, BUF_IO_READ);
buf_page_set_io_fix(bpage, BUF_IO_READ);
if (UNIV_UNLIKELY(zip_size)) {
page_zip_set_size(&block->page.zip, zip_size);
......@@ -2458,8 +2459,6 @@ buf_page_init_for_read(
block->page.zip.data = data;
}
buf_page_set_io_fix(bpage, BUF_IO_READ);
mutex_exit(&block->mutex);
} else {
/* Defer buf_buddy_alloc() until after the block has
......
......@@ -860,6 +860,11 @@ ibuf_set_free_bits_func(
mtr_start(&mtr);
if (recv_recovery_is_on()) {
/* Do not write to the redo log, because there is
crash recovery in progress. Flushing the log would
require the possession of log_sys->mutex, which is
being held by the main thread. */
mtr_set_log_mode(&mtr, MTR_LOG_NONE);
}
......@@ -896,14 +901,6 @@ ibuf_set_free_bits_func(
#endif /* UNIV_IBUF_DEBUG */
ibuf_bitmap_page_set_bits(bitmap_page, page_no, zip_size,
IBUF_BITMAP_FREE, val, &mtr);
if (recv_recovery_is_on()) {
/* Do not acquire log_sys->mutex or attempt to
write to the redo log, because the lock is being
held by the crash recovery thread. */
mtr.modifications = FALSE;
}
mtr_commit(&mtr);
}
......
......@@ -167,13 +167,17 @@ mtr_commit(
/*=======*/
mtr_t* mtr) /* in: mini-transaction */
{
ibool write_log;
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_ACTIVE);
#ifdef UNIV_DEBUG
mtr->state = MTR_COMMITTING;
#endif
if (mtr->modifications) {
write_log = mtr->modifications && mtr->n_log_recs;
if (write_log) {
mtr_log_reserve_and_write(mtr);
}
......@@ -187,7 +191,7 @@ mtr_commit(
mtr_memo_pop_all(mtr);
if (mtr->modifications) {
if (write_log) {
log_release();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment