diff options
author | Michael Widenius <monty@askmonty.org> | 2011-07-04 04:32:53 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-07-04 04:32:53 +0300 |
commit | 7199ac591669a386f62c623e26071452ad3dd52b (patch) | |
tree | 699a67000d3bdac67743df2d59b543cee83d1c24 /storage/maria/ma_checkpoint.c | |
parent | 5e876bd3003870afe4e3e2dae866bcb0954c2298 (diff) | |
download | mariadb-git-7199ac591669a386f62c623e26071452ad3dd52b.tar.gz |
Aria fixes:
- Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
- Fixed bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
- Much more DBUG_ASSERT(!maria_assert_if_crashed_table) to detect errors early
- EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_bitmap.c:
More secure handling of first_bitmap_with_space (now we also take care of wrong values)
Don't set page to -1; This fixed unlikely bug that caused assert in move_to_next_bitmap() & _ma_read_bitmap_page()
storage/maria/ma_blockrec.c:
More DBUG_ASSERT()'s
Fixed multi-user problem with one thread doing inserts and another doing scans that gave error 175
(We should use data_file_length from start of scan, not new value as new bitmap page may not yet be in page cache)
storage/maria/ma_check.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere)
storage/maria/ma_checkpoint.c:
Made maria_checkpoint_min_activity static so that one can change it in debugger while testing.
Fixed long standing performance problem that caused write of state info at checkpoint for any file that was ever changed since open.
storage/maria/ma_create.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_dynrec.c:
Added missing MARIA_EXTERNAL_LOCKING (minor performance improvement)
storage/maria/ma_locking.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_open.c:
EXTERNAL_LOCKING -> MARIA_EXTERNAL_LOCKING (to use same define everywhere
storage/maria/ma_pagecache.c:
Added assert to detect reads outside of data file
storage/maria/maria_def.h:
Added checkpoint_state to cache state writes in checkpoint
Diffstat (limited to 'storage/maria/ma_checkpoint.c')
-rw-r--r-- | storage/maria/ma_checkpoint.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 79a9e790e70..90d4eeb0d33 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -533,10 +533,12 @@ 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; + + pthread_handler_t ma_checkpoint_background(void *arg) { /** @brief At least this of log/page bytes written between checkpoints */ - const uint checkpoint_min_activity= 2*1024*1024; /* If the interval could be changed by the user while we are in this thread, it could be annoying: for example it could cause "case 2" to be executed @@ -588,12 +590,12 @@ pthread_handler_t ma_checkpoint_background(void *arg) would decrease the amount of read pages in recovery). In case of one short statement per minute (very low load), we don't want to checkpoint every minute, hence the positive - checkpoint_min_activity. + 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) < checkpoint_min_activity) + maria_pagecache->block_size) < maria_checkpoint_min_activity) { /* don't take checkpoint, so don't know what to flush */ pages_to_flush_before_next_checkpoint= 0; @@ -1011,17 +1013,25 @@ static int collect_tables(LEX_STRING *str, LSN checkpoint_start_log_horizon) possible that Recovery does not start from before the REDO and thus the state is not recovered. A solution may be to set share->changed=1 under log mutex when writing log records. - But as anyway we have another problem below, this optimization would - be of little use. + + The current solution is to keep a copy the last saved state and + not write the state if it was same as last time. It's ok if + is_of_horizon would be different on disk if all other data is + the same. */ - /** @todo flush state only if changed since last checkpoint */ DBUG_ASSERT(share->last_version != 0); state_copy->state.is_of_horizon= share->state.is_of_horizon= - state_copies_horizon; - if (kfile.file >= 0) + share->checkpoint_state.is_of_horizon= state_copies_horizon; + if (kfile.file >= 0 && memcmp(&share->checkpoint_state, + &state_copy->state, + sizeof(state_copy->state))) + { sync_error|= _ma_state_info_write_sub(kfile.file, &state_copy->state, MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET); + memcpy(&share->checkpoint_state, + &state_copy->state, sizeof(state_copy->state)); + } /* We don't set share->changed=0 because it may interfere with a concurrent _ma_writeinfo() doing share->changed=1 (cancel its |