Commit fa05e9c9 authored by unknown's avatar unknown

WL#3071 - Maria checkpoint

Adding rec_lsn to Maria's page cache. Misc fixes to Checkpoint.


mysys/mf_pagecache.c:
  adding rec_lsn, the LSN when a page first became dirty.
  It is set when unlocking a page (TODO: should also be set when
  the unlocking is an implicit part of pagecache_write()).
  It is reset in link_to_file_list() and free_block()
  (one of which is used every time we flush a block).
  It is a ulonglong and not LSN, because its destination is comparisons
  for which ulonglong is better than a struct.
storage/maria/ma_checkpoint.c:
  misc fixes to Checkpoint (updates now that the transaction manager
  and the page cache are more known)
storage/maria/ma_close.c:
  an important note for the future.
storage/maria/ma_least_recently_dirtied.c:
  comment
parent ad29d552
......@@ -295,6 +295,7 @@ struct st_pagecache_block_link
enum pagecache_page_type type; /* type of the block */
uint hits_left; /* number of hits left until promotion */
ulonglong last_hit_time; /* timestamp of the last hit */
ulonglong rec_lsn; /* LSN when first became dirty */
KEYCACHE_CONDVAR *condvar; /* condition variable for 'no readers' event */
};
......@@ -1202,6 +1203,7 @@ static void link_to_file_list(PAGECACHE *pagecache,
if (block->status & BLOCK_CHANGED)
{
block->status&= ~BLOCK_CHANGED;
block->rec_lsn= 0;
pagecache->blocks_changed--;
pagecache->global_blocks_changed--;
}
......@@ -2509,6 +2511,8 @@ void pagecache_unlock_page(PAGECACHE *pagecache,
DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE_UNLOCK &&
pin == PAGECACHE_UNPIN);
/* TODO: insert LSN writing code */
DBUG_ASSERT(first_REDO_LSN_for_page > 0);
set_if_bigger(block->rec_lsn, first_REDO_LSN_for_page);
}
#ifndef DBUG_OFF
......@@ -2671,6 +2675,8 @@ void pagecache_unlock(PAGECACHE *pagecache,
DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE_UNLOCK &&
pin == PAGECACHE_UNPIN);
/* TODO: insert LSN writing code */
DBUG_ASSERT(first_REDO_LSN_for_page > 0);
set_if_bigger(block->rec_lsn, first_REDO_LSN_for_page);
}
#ifndef DBUG_OFF
......@@ -3012,10 +3018,9 @@ my_bool pagecache_delete_page(PAGECACHE *pagecache,
pagecache->blocks_changed--;
pagecache->global_blocks_changed--;
/*
free_block() will change the status of the block so no need to change
it here.
free_block() will change the status and rec_lsn of the block so no
need to change them here.
*/
}
/* Cache is locked, so we can relese page before freeing it */
pagecache_make_lock_and_pin(pagecache, block,
......@@ -3328,6 +3333,7 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block)
#ifndef DBUG_OFF
block->type= PAGECACHE_EMPTY_PAGE;
#endif
block->rec_lsn= 0;
KEYCACHE_THREAD_TRACE("free block");
KEYCACHE_DBUG_PRINT("free_block",
("block is freed"));
......
This diff is collapsed.
......@@ -57,6 +57,12 @@ int maria_close(register MARIA_HA *info)
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
}
flag= !--share->reopen;
/*
RECOVERYTODO:
Below we are going to make the table unknown to future checkpoints, so it
needs to have fsync'ed itself entirely (bitmap, pages, etc) at this
point.
*/
maria_open_list=list_delete(maria_open_list,&info->open_list);
pthread_mutex_unlock(&share->intern_lock);
......
......@@ -94,7 +94,10 @@ pthread_handler_decl background_flush_and_checkpoint_thread()
while (this_thread_not_killed)
{
if ((flush_calls++) & ((2<<CHECKPOINT_PROBING_PERIOD_LOG2)-1) == 0)
execute_asynchronous_checkpoint_if_any();
{
/* note that we don't care of the checkpoint's success */
(void)execute_asynchronous_checkpoint_if_any();
}
lock(global_LRD_mutex);
flush_one_group_from_LRD();
safemutex_assert_not_owner(global_LRD_mutex);
......
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