summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorheikki@hundin.mysql.fi <>2003-07-06 16:17:02 +0300
committerheikki@hundin.mysql.fi <>2003-07-06 16:17:02 +0300
commite387dac04206abfd4164be6c5569d152d2da1a9f (patch)
tree26734a5f5dbce22fed7d57ad9f66cd02ec2c46a4 /innobase
parentfe025d40c48d28542aa2169f417c8127a737356d (diff)
downloadmariadb-git-e387dac04206abfd4164be6c5569d152d2da1a9f.tar.gz
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
Diffstat (limited to 'innobase')
-rw-r--r--innobase/srv/srv0srv.c27
-rw-r--r--innobase/trx/trx0purge.c13
2 files changed, 26 insertions, 14 deletions
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 083cbfd2609..a2314cde2dd 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -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";
diff --git a/innobase/trx/trx0purge.c b/innobase/trx/trx0purge.c
index d58240d3c11..fa9c287b0ad 100644
--- a/innobase/trx/trx0purge.c
+++ b/innobase/trx/trx0purge.c
@@ -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,