srv0srv.c:

  In background loop run purge to completion before doing other background operations: it does not make sense to flush buffer pool pages if they are soon modified again by purge
trx0purge.c:
  Increase purge_sys->n_pages_handled for every undo log we purge, even if that log would be only a hundred bytes: that way we get the purge batches of 20 pages to set a fresh purge view (limit) more often, and we can reduce the number of old row versions purge has to look at when it decides if it can remove some delete-marked index record
parent fe025d40
......@@ -3009,10 +3009,29 @@ background_loop:
srv_main_thread_op_info = (char*)"purging";
if (srv_fast_shutdown && srv_shutdown_state > 0) {
n_pages_purged = 0;
} else {
n_pages_purged = trx_purge();
/* Run a full purge */
n_pages_purged = 1;
last_flush_time = time(NULL);
while (n_pages_purged) {
if (srv_fast_shutdown && srv_shutdown_state > 0) {
break;
}
srv_main_thread_op_info = (char*)"purging";
n_pages_purged = trx_purge();
current_time = time(NULL);
if (difftime(current_time, last_flush_time) > 1) {
srv_main_thread_op_info = (char*) "flushing log";
log_buffer_flush_to_disk();
last_flush_time = current_time;
}
}
srv_main_thread_op_info = (char*)"reserving kernel mutex";
......
......@@ -593,7 +593,7 @@ trx_purge_rseg_get_next_history_log(
mutex_enter(&(rseg->mutex));
ut_ad(rseg->last_page_no != FIL_NULL);
ut_a(rseg->last_page_no != FIL_NULL);
purge_sys->purge_trx_no = ut_dulint_add(rseg->last_trx_no, 1);
purge_sys->purge_undo_no = ut_dulint_zero;
......@@ -606,16 +606,9 @@ trx_purge_rseg_get_next_history_log(
log_hdr = undo_page + rseg->last_offset;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
if ((mach_read_from_2(log_hdr + TRX_UNDO_NEXT_LOG) == 0)
&& (mach_read_from_2(seg_hdr + TRX_UNDO_STATE)
== TRX_UNDO_TO_PURGE)) {
/* This is the last log header on this page and the log
segment cannot be reused: we may increment the number of
pages handled */
/* Increase the purge page count by one for every handled log */
purge_sys->n_pages_handled++;
}
purge_sys->n_pages_handled++;
prev_log_addr = trx_purge_get_log_from_hist(
flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE,
......
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