• unknown's avatar
    WL#3071 Maria checkpoint · 0f1feefa
    unknown authored
    Ability for flush_pagecache_blocks() to flush only certain pages of
    a file, as instructed by an option "filter" pointer-to-function argument;
    Checkpoint and background dirty page flushing use that to flush only
    pages which have been dirty for long enough and bitmap pages.
    Fix for a bug in flush_cached_blocks() (no idea if it could produce
    a bug in real life, but theoretically it is).
    Testing checkpoint in ma_test_recovery via ma_test1 and ma_test2.
    Background checkpoint & dirty pages flush thread is still disabled
    by default in ha_maria.
    
    
    mysql-test/r/maria.result:
      result update
    storage/maria/ha_maria.cc:
      blank after function comment
    storage/maria/ma_checkpoint.c:
      Using an enum instead of 0/1/2 (applying Sanja's review comments).
      The comment about "this is an horizon" can be removed as Sanja
      created translog_next_LSN() which parse_checkpoint_record() uses.
      Variables in ma_checkpoint_background() cannot be declared in the
      for() as their value must not be reset at each iteration!
    storage/maria/ma_pagecache.c:
      adding to flush_pagecache_blocks() optional arguments 'filter'
      (pointer to function) and 'filter_arg'; if filter!=NULL this function
      will be called for each block of the file and will reply if this
      block and following ones should be flushed or not (3 possible
      replies).
      Fixing a bug when flush_cached_blocks() skips a pinned page: it has
      to unset PCBLOCK_IN_FLUSH set by flush_pagecache_blocks_int().
    storage/maria/ma_pagecache.h:
      flush_pagecache_blocks() is changed to take "filter" and "filter_arg"
      arguments. "filter", if it is not NULL, may return one value
      among enum pagecache_flush_filter_result.
    storage/maria/ma_recovery.c:
      open_count=0 when closing tables at the end of recovery.
    storage/maria/ma_test1.c:
      Optional checkpoints (-H#) at various stages (stages similar
      to --testflag), for testing of checkpoints.
    storage/maria/ma_test2.c:
      Optional checkpoints (-H#) at various stages (stages similar
      to -t), for testing of checkpoints.
    storage/maria/ma_test_recovery.expected:
      Result update: the results of the additional test run with -H#
      (checkpoints) are added here. They are exactly identical to without
      checkpoints except that the index's Root (printed by maria_chk)
      is more correct when using checkpoints. This is because checkpoint
      flushed the state, so it happens to be correct, while no-checkpoint
      does not flush the state, and recovery does not recover indexes
      so Root is never fixed. When we recover indices, this will go away.
    storage/maria/ma_test_recovery:
      We duplicate the loop of tests to add an additional run with
      checkpoints at various stages, to see if maria_read_log
      uses them fine.
    0f1feefa
ma_checkpoint.c 41.2 KB