Commit c087a5d5 authored by marko's avatar marko

branches/zip: Minor cleanup.

buf_page_get_gen(): Cache the result of fil_space_get_zip_size().

trx_commit_off_kernel(): Eliminate the flag must_flush_log.  Initialize lsn = 0
to signify must_flush_log == FALSE.

log_flush_margin(): Eliminate the flag do_flush.  Initialize lsn = 0
to signify do_flush == FALSE.
parent 631da97d
...@@ -1484,6 +1484,7 @@ buf_page_get_gen( ...@@ -1484,6 +1484,7 @@ buf_page_get_gen(
ulint fix_type; ulint fix_type;
ibool success; ibool success;
ibool must_read; ibool must_read;
const ulint zip_size = fil_space_get_zip_size(space);
ut_ad(mtr); ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH) ut_ad((rw_latch == RW_S_LATCH)
...@@ -1493,8 +1494,7 @@ buf_page_get_gen( ...@@ -1493,8 +1494,7 @@ buf_page_get_gen(
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL) ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
|| (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT)); || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
#ifndef UNIV_LOG_DEBUG #ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() ut_ad(!ibuf_inside() || ibuf_page(space, zip_size, offset));
|| ibuf_page(space, fil_space_get_zip_size(space), offset));
#endif #endif
buf_pool->n_page_gets++; buf_pool->n_page_gets++;
loop: loop:
...@@ -1527,7 +1527,7 @@ loop: ...@@ -1527,7 +1527,7 @@ loop:
return(NULL); return(NULL);
} }
buf_read_page(space, fil_space_get_zip_size(space), offset); buf_read_page(space, zip_size, offset);
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(++buf_dbg_counter % 37 || buf_validate()); ut_a(++buf_dbg_counter % 37 || buf_validate());
...@@ -1636,8 +1636,7 @@ loop: ...@@ -1636,8 +1636,7 @@ loop:
/* In the case of a first access, try to apply linear /* In the case of a first access, try to apply linear
read-ahead */ read-ahead */
buf_read_ahead_linear(space, buf_block_get_zip_size(block), buf_read_ahead_linear(space, zip_size, offset);
offset);
} }
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
......
...@@ -1536,9 +1536,8 @@ void ...@@ -1536,9 +1536,8 @@ void
log_flush_margin(void) log_flush_margin(void)
/*==================*/ /*==================*/
{ {
ibool do_flush = FALSE; log_t* log = log_sys;
log_t* log = log_sys; ib_uint64_t lsn = 0;
ib_uint64_t lsn;
mutex_enter(&(log->mutex)); mutex_enter(&(log->mutex));
...@@ -1548,14 +1547,13 @@ log_flush_margin(void) ...@@ -1548,14 +1547,13 @@ log_flush_margin(void)
/* A flush is running: hope that it will provide enough /* A flush is running: hope that it will provide enough
free space */ free space */
} else { } else {
do_flush = TRUE;
lsn = log->lsn; lsn = log->lsn;
} }
} }
mutex_exit(&(log->mutex)); mutex_exit(&(log->mutex));
if (do_flush) { if (lsn) {
log_write_up_to(lsn, LOG_NO_WAIT, FALSE); log_write_up_to(lsn, LOG_NO_WAIT, FALSE);
} }
} }
......
...@@ -743,10 +743,9 @@ trx_commit_off_kernel( ...@@ -743,10 +743,9 @@ trx_commit_off_kernel(
trx_t* trx) /* in: transaction */ trx_t* trx) /* in: transaction */
{ {
page_t* update_hdr_page; page_t* update_hdr_page;
ib_uint64_t lsn; ib_uint64_t lsn = 0;
trx_rseg_t* rseg; trx_rseg_t* rseg;
trx_undo_t* undo; trx_undo_t* undo;
ibool must_flush_log = FALSE;
mtr_t mtr; mtr_t mtr;
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
...@@ -763,8 +762,6 @@ trx_commit_off_kernel( ...@@ -763,8 +762,6 @@ trx_commit_off_kernel(
mtr_start(&mtr); mtr_start(&mtr);
must_flush_log = TRUE;
/* Change the undo log segment states from TRX_UNDO_ACTIVE /* Change the undo log segment states from TRX_UNDO_ACTIVE
to some other state: these modifications to the file data to some other state: these modifications to the file data
structure define the transaction as committed in the file structure define the transaction as committed in the file
...@@ -883,7 +880,7 @@ trx_commit_off_kernel( ...@@ -883,7 +880,7 @@ trx_commit_off_kernel(
trx->read_view = NULL; trx->read_view = NULL;
if (must_flush_log) { if (lsn) {
mutex_exit(&kernel_mutex); mutex_exit(&kernel_mutex);
......
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