summaryrefslogtreecommitdiff
path: root/storage/maria/ma_checkpoint.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-09-01 21:13:09 +0300
committerMichael Widenius <monty@askmonty.org>2011-09-01 21:13:09 +0300
commit1a51fe363d3aec8a22e804b90e351ebe912ed837 (patch)
treef554ea0caa9a5aa42c21a67a9b327e9971fa6ad6 /storage/maria/ma_checkpoint.c
parent8b7a63b17f838c012f870e997a63d72c8d696fcf (diff)
downloadmariadb-git-1a51fe363d3aec8a22e804b90e351ebe912ed837.tar.gz
Added variable ARIA_CHECKPOINT_LOG_ACTIVITY to allow one to specify how often we should do a checkpoint.
Added more error printing to log if log_warnings > 2 Give an error if checkpoint record is not correct, mysql-test/suite/maria/r/compat_aliases.result: Added ARIA_CHECKPOINT_LOG_ACTIVITY mysql-test/suite/maria/r/maria3.result: Added ARIA_CHECKPOINT_LOG_ACTIVITY storage/maria/ha_maria.cc: Added ARIA_CHECKPOINT_LOG_ACTIVITY Added more error printing to log if log_warnings > 2 Added db and table name to error message when printing to log storage/maria/ma_check.c: Fixed bug where we didn't reset some variables between repair() calls storage/maria/ma_checkpoint.c: Made maria_checkpoint_min_activity global. Don't do checkpoint if no data logged. Changed test for if we should do checkpoint to test separately for if log has grown or if we have had a lot of of cache writes. storage/maria/ma_recovery.c: Give an error if checkpoint record is not correct storage/maria/trnman.c: Don't print not needed long_transaction_id entries for checkpoints.
Diffstat (limited to 'storage/maria/ma_checkpoint.c')
-rw-r--r--storage/maria/ma_checkpoint.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c
index 90d4eeb0d33..d53417142b0 100644
--- a/storage/maria/ma_checkpoint.c
+++ b/storage/maria/ma_checkpoint.c
@@ -533,8 +533,9 @@ filter_flush_file_evenly(enum pagecache_page_type type,
risk could be that while a checkpoint happens no LRD flushing happens.
*/
-static uint maria_checkpoint_min_activity= 2*1024*1024;
-
+static ulong maria_checkpoint_min_cache_activity= 10*1024*1024;
+/* Set in ha_maria.cc */
+ulong maria_checkpoint_min_log_activity= 1*1024*1024;
pthread_handler_t ma_checkpoint_background(void *arg)
{
@@ -578,6 +579,9 @@ pthread_handler_t ma_checkpoint_background(void *arg)
switch (sleeps % interval)
{
case 0:
+ {
+ TRANSLOG_ADDRESS horizon= translog_get_horizon();
+
/*
With background flushing evenly distributed over the time
between two checkpoints, we should have only little flushing to do
@@ -592,10 +596,12 @@ pthread_handler_t ma_checkpoint_background(void *arg)
want to checkpoint every minute, hence the positive
maria_checkpoint_min_activity.
*/
- if (((translog_get_horizon() - log_horizon_at_last_checkpoint) +
- (maria_pagecache->global_cache_write -
- pagecache_flushes_at_last_checkpoint) *
- maria_pagecache->block_size) < maria_checkpoint_min_activity)
+ if (horizon != log_horizon_at_last_checkpoint &&
+ (ulonglong) (horizon - log_horizon_at_last_checkpoint) <=
+ maria_checkpoint_min_log_activity &&
+ ((ulonglong) (maria_pagecache->global_cache_write -
+ pagecache_flushes_at_last_checkpoint) *
+ maria_pagecache->block_size) <= maria_checkpoint_min_cache_activity)
{
/* don't take checkpoint, so don't know what to flush */
pages_to_flush_before_next_checkpoint= 0;
@@ -618,6 +624,7 @@ pthread_handler_t ma_checkpoint_background(void *arg)
and sleep until the next checkpoint.
*/
break;
+ }
case 1:
/* set up parameters for background page flushing */
filter_param.up_to_lsn= last_checkpoint_lsn;