#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
2676 Guilhem Bichot 2008-10-13
Allow a thread to unlock and unpin a write-locked page, when using pagecache_unlock_by_link().
This is a hack for _ma_bitmap_unpin_all() which needs to unlock and unpin pages which were
write-locked and pinned by other threads in write_changed_bitmap(). Original patch by Sanja,
simplified by me as limited to write-lock. Worklog WL#4595 "Maria - no write-lock when
pinning bitmap pages" is about revisiting this later.
modified:
storage/maria/ma_bitmap.c
storage/maria/ma_blockrec.c
storage/maria/ma_check.c
storage/maria/ma_key_recover.c
storage/maria/ma_loghandler.c
storage/maria/ma_pagecache.c
storage/maria/ma_pagecache.h
storage/maria/ma_preload.c
storage/maria/unittest/ma_pagecache_rwconsist.c
storage/maria/unittest/ma_pagecache_single.c
per-file messages:
storage/maria/ma_bitmap.c
new prototype
storage/maria/ma_blockrec.c
new prototype
storage/maria/ma_check.c
new prototype
storage/maria/ma_key_recover.c
new prototype
storage/maria/ma_loghandler.c
new prototype
storage/maria/ma_pagecache.c
Allow a thread to unlock and unpin a write-locked page, when using pagecache_unlock_by_link().
This is a hack for _ma_bitmap_unpin_all() which needs to unlock and unpin pages which were
write-locked and pinned by other threads in write_changed_bitmap().
storage/maria/ma_pagecache.h
new prototype
storage/maria/ma_preload.c
new prototype
storage/maria/unittest/ma_pagecache_rwconsist.c
new prototype
storage/maria/unittest/ma_pagecache_single.c
new prototype
=== modified file 'storage/maria/ma_bitmap.c'
--- a/storage/maria/ma_bitmap.c 2008-04-03 13:40:25 +0000
+++ b/storage/maria/ma_bitmap.c 2008-10-13 15:50:28 +0000
@@ -164,6 +164,7 @@ static inline my_bool write_changed_bitm
else
{
MARIA_PINNED_PAGE page_link;
+ /* Removing this write-lock is WL#4595 */
int res= pagecache_write(share->pagecache,
&bitmap->file, bitmap->page, 0,
(uchar*) bitmap->map, PAGECACHE_PLAIN_PAGE,
@@ -437,7 +438,7 @@ static void _ma_bitmap_unpin_all(MARIA_S
while (pinned_page-- != page_link)
pagecache_unlock_by_link(share->pagecache, pinned_page->link,
pinned_page->unlock, PAGECACHE_UNPIN,
- LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, TRUE);
+ LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, TRUE, FALSE);
bitmap->pinned_pages.elements= 0;
DBUG_VOID_RETURN;
}
=== modified file 'storage/maria/ma_blockrec.c'
--- a/storage/maria/ma_blockrec.c 2008-10-09 20:03:54 +0000
+++ b/storage/maria/ma_blockrec.c 2008-10-13 15:50:28 +0000
@@ -1964,7 +1964,7 @@ static my_bool write_tail(MARIA_HA *info
pagecache_unlock_by_link(share->pagecache, page_link->link,
PAGECACHE_LOCK_WRITE_TO_READ,
PAGECACHE_PIN_LEFT_PINNED, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 1);
+ LSN_IMPOSSIBLE, 1, FALSE);
DBUG_ASSERT(page_link->changed);
page_link->unlock= PAGECACHE_LOCK_READ_UNLOCK;
res= 0;
@@ -3026,7 +3026,7 @@ static my_bool write_block_record(MARIA_
pagecache_unlock_by_link(share->pagecache, page_link->link,
PAGECACHE_LOCK_WRITE_TO_READ,
PAGECACHE_PIN_LEFT_PINNED, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 1);
+ LSN_IMPOSSIBLE, 1, FALSE);
page_link->unlock= PAGECACHE_LOCK_READ_UNLOCK;
page_link->changed= 1;
}
@@ -4025,7 +4025,7 @@ static my_bool delete_head_or_tail(MARIA
pagecache_unlock_by_link(share->pagecache, page_link.link,
lock_at_write,
PAGECACHE_PIN_LEFT_PINNED, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 1);
+ LSN_IMPOSSIBLE, 1, FALSE);
page_link.unlock= lock_at_unpin;
set_dynamic(&info->pinned_pages, (void*) &page_link,
info->pinned_pages.elements-1);
@@ -6033,7 +6033,7 @@ uint _ma_apply_redo_insert_row_head_or_t
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
DBUG_RETURN(0);
}
@@ -6123,7 +6123,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
_ma_mark_file_crashed(share);
DBUG_RETURN((my_errno= error));
}
@@ -6193,7 +6193,7 @@ uint _ma_apply_redo_purge_row_head_or_ta
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
DBUG_RETURN(0);
}
@@ -6221,7 +6221,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
_ma_mark_file_crashed(share);
DBUG_RETURN((my_errno= error));
@@ -6325,7 +6325,7 @@ uint _ma_apply_redo_free_head_or_tail(MA
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
goto err;
}
if (lsn_korr(buff) >= lsn)
@@ -6334,7 +6334,7 @@ uint _ma_apply_redo_free_head_or_tail(MA
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
}
else
{
@@ -6474,7 +6474,7 @@ uint _ma_apply_redo_insert_row_blobs(MAR
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
goto err;
}
/*
@@ -6494,7 +6494,7 @@ uint _ma_apply_redo_insert_row_blobs(MAR
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
continue;
}
}
=== modified file 'storage/maria/ma_check.c'
--- a/storage/maria/ma_check.c 2008-08-25 11:49:47 +0000
+++ b/storage/maria/ma_check.c 2008-10-13 15:50:28 +0000
@@ -3184,7 +3184,7 @@ static my_bool maria_zerofill_index(HA_C
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
_ma_check_print_error(param,
"Page %9s: Got error %d when reading index file",
llstr(pos, llbuff), my_errno);
@@ -3218,7 +3218,7 @@ static my_bool maria_zerofill_index(HA_C
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 1);
+ LSN_IMPOSSIBLE, 1, FALSE);
}
if (flush_pagecache_blocks(share->pagecache, &share->kfile,
FLUSH_FORCE_WRITE))
@@ -3342,7 +3342,7 @@ static my_bool maria_zerofill_data(HA_CH
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 1);
+ LSN_IMPOSSIBLE, 1, FALSE);
}
DBUG_RETURN(_ma_bitmap_flush(share) ||
flush_pagecache_blocks(share->pagecache, &info->dfile,
@@ -3352,7 +3352,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
DBUG_RETURN(1);
}
=== modified file 'storage/maria/ma_key_recover.c'
--- a/storage/maria/ma_key_recover.c 2008-08-26 12:34:57 +0000
+++ b/storage/maria/ma_key_recover.c 2008-10-13 15:50:28 +0000
@@ -70,7 +70,7 @@ void _ma_unpin_all_pages(MARIA_HA *info,
pagecache_unlock_by_link(info->s->pagecache, pinned_page->link,
pinned_page->unlock, PAGECACHE_UNPIN,
info->trn->rec_lsn, undo_lsn,
- pinned_page->changed);
+ pinned_page->changed, FALSE);
}
info->pinned_pages.elements= 0;
@@ -700,7 +700,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
DBUG_RETURN(result);
}
@@ -779,7 +779,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
DBUG_RETURN(result);
}
@@ -1047,7 +1047,7 @@ err:
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
- LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, 0, FALSE);
if (result)
_ma_mark_file_crashed(share);
DBUG_RETURN(result);
=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c 2008-08-28 18:52:23 +0000
+++ b/storage/maria/ma_loghandler.c 2008-10-13 15:50:28 +0000
@@ -3028,7 +3028,7 @@ static void translog_free_link(PAGECACHE
if (direct_link)
pagecache_unlock_by_link(log_descriptor.pagecache, direct_link,
PAGECACHE_LOCK_READ_UNLOCK, PAGECACHE_UNPIN,
- LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, 0);
+ LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, 0, FALSE);
DBUG_VOID_RETURN;
}
=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c 2008-08-25 18:26:50 +0000
+++ b/storage/maria/ma_pagecache.c 2008-10-13 15:50:28 +0000
@@ -267,16 +267,21 @@ static void info_unlink(PAGECACHE_PIN_IN
list the list where to find the thread
thread thread ID (reference to the st_my_thread_var
of the thread)
+ any return any thread of the list
RETURN
0 - the thread was not found
- pointer to the information node of the thread in the list
+ pointer to the information node of the thread in the list, or, if 'any',
+ to any thread of the list.
*/
static PAGECACHE_PIN_INFO *info_find(PAGECACHE_PIN_INFO *list,
- struct st_my_thread_var *thread)
+ struct st_my_thread_var *thread,
+ my_bool any)
{
register PAGECACHE_PIN_INFO *i= list;
+ if (any)
+ return i;
for(; i != 0; i= i->next)
if (i->thread == thread)
return i;
@@ -2150,19 +2155,25 @@ static void add_pin(PAGECACHE_BLOCK_LINK
DBUG_VOID_RETURN;
}
-static void remove_pin(PAGECACHE_BLOCK_LINK *block)
+static void remove_pin(PAGECACHE_BLOCK_LINK *block, my_bool any
+#ifdef DBUG_OFF
+ __attribute__((unused))
+#endif
+ )
{
DBUG_ENTER("remove_pin");
- DBUG_PRINT("enter", ("block: 0x%lx pins: %u",
+ DBUG_PRINT("enter", ("block: 0x%lx pins: %u any: %d",
(ulong) block,
- block->pins));
+ block->pins, (int)any));
PCBLOCK_INFO(block);
DBUG_ASSERT(block->pins > 0);
block->pins--;
#ifndef DBUG_OFF
{
- PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var);
+ PAGECACHE_PIN_INFO *info= info_find(block->pin_list, my_thread_var, any);
DBUG_ASSERT(info != 0);
+ /* 'any' works only for write-locked see make_lock_and_pin() */
+ DBUG_ASSERT(!any || (block->pins == 0));
info_unlink(info);
my_free((uchar*) info, MYF(0));
}
@@ -2179,12 +2190,14 @@ static void info_add_lock(PAGECACHE_BLOC
info_link((PAGECACHE_PIN_INFO **)&block->lock_list,
(PAGECACHE_PIN_INFO *)info);
}
-static void info_remove_lock(PAGECACHE_BLOCK_LINK *block)
+static void info_remove_lock(PAGECACHE_BLOCK_LINK *block, my_bool any)
{
PAGECACHE_LOCK_INFO *info=
(PAGECACHE_LOCK_INFO *)info_find((PAGECACHE_PIN_INFO *)block->lock_list,
- my_thread_var);
+ my_thread_var, any);
DBUG_ASSERT(info != 0);
+ /* 'any' works only for write-locked see make_lock_and_pin() */
+ DBUG_ASSERT(!any || info->write_lock);
info_unlink((PAGECACHE_PIN_INFO *)info);
my_free((uchar*)info, MYF(0));
}
@@ -2192,14 +2205,14 @@ static void info_change_lock(PAGECACHE_B
{
PAGECACHE_LOCK_INFO *info=
(PAGECACHE_LOCK_INFO *)info_find((PAGECACHE_PIN_INFO *)block->lock_list,
- my_thread_var);
+ my_thread_var, FALSE);
DBUG_ASSERT(info != 0);
DBUG_ASSERT(info->write_lock != wl);
info->write_lock= wl;
}
#else
#define info_add_lock(B,W)
-#define info_remove_lock(B)
+#define info_remove_lock(B,A)
#define info_change_lock(B,W)
#endif
@@ -2448,6 +2461,9 @@ static void release_rdlock(PAGECACHE_BLO
@param lock lock change mode
@param pin pinchange mode
@param file File handler requesting pin
+ @param any allowance unlock&unpin block locked/pinned
+ by any thread; possible only if this is a write-lock,
+ see pagecache_unlock_by_link().
@retval 0 OK
@retval 1 Try to lock the block failed
@@ -2456,7 +2472,8 @@ static void release_rdlock(PAGECACHE_BLO
static my_bool make_lock_and_pin(PAGECACHE *pagecache,
PAGECACHE_BLOCK_LINK *block,
enum pagecache_page_lock lock,
- enum pagecache_page_pin pin)
+ enum pagecache_page_pin pin,
+ my_bool any)
{
DBUG_ENTER("make_lock_and_pin");
@@ -2465,16 +2482,20 @@ static my_bool make_lock_and_pin(PAGECAC
if (block)
{
DBUG_PRINT("enter", ("block: 0x%lx (%u) wrlocks: %u rdlocks: %u "
- "rdlocks_q: %u pins: %u lock: %s pin: %s",
+ "rdlocks_q: %u pins: %u lock: %s pin: %s any %d",
(ulong)block, PCBLOCK_NUMBER(pagecache, block),
block->wlocks, block->rlocks, block->rlocks_queue,
block->pins,
page_cache_page_lock_str[lock],
- page_cache_page_pin_str[pin]));
+ page_cache_page_pin_str[pin], (int)any));
PCBLOCK_INFO(block);
}
#endif
+ DBUG_ASSERT(!any ||
+ ((lock == PAGECACHE_LOCK_WRITE_UNLOCK) &&
+ (pin == PAGECACHE_UNPIN)));
+
switch (lock) {
case PAGECACHE_LOCK_WRITE: /* free -> write */
/* Writelock and pin the buffer */
@@ -2500,7 +2521,7 @@ static my_bool make_lock_and_pin(PAGECAC
case PAGECACHE_LOCK_LEFT_READLOCKED: /* read -> read */
if (pin == PAGECACHE_UNPIN)
{
- remove_pin(block);
+ remove_pin(block, any);
}
if (lock == PAGECACHE_LOCK_WRITE_TO_READ)
{
@@ -2509,7 +2530,7 @@ static my_bool make_lock_and_pin(PAGECAC
else if (lock == PAGECACHE_LOCK_WRITE_UNLOCK ||
lock == PAGECACHE_LOCK_READ_UNLOCK)
{
- info_remove_lock(block);
+ info_remove_lock(block, any);
}
break;
case PAGECACHE_LOCK_READ: /* free -> read */
@@ -2529,7 +2550,7 @@ static my_bool make_lock_and_pin(PAGECAC
case PAGECACHE_LOCK_LEFT_UNLOCKED: /* free -> free */
if (pin == PAGECACHE_UNPIN)
{
- remove_pin(block);
+ remove_pin(block, FALSE);
}
/* fall through */
case PAGECACHE_LOCK_LEFT_WRITELOCKED: /* write -> write */
@@ -2793,7 +2814,7 @@ void pagecache_unlock(PAGECACHE *pagecac
(ulong) block));
}
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
{
DBUG_ASSERT(0); /* should not happend */
}
@@ -2863,7 +2884,7 @@ void pagecache_unpin(PAGECACHE *pagecach
*/
if (make_lock_and_pin(pagecache, block,
PAGECACHE_LOCK_LEFT_READLOCKED,
- PAGECACHE_UNPIN))
+ PAGECACHE_UNPIN, FALSE))
DBUG_ASSERT(0); /* should not happend */
remove_reader(block);
@@ -2886,15 +2907,24 @@ void pagecache_unpin(PAGECACHE *pagecach
@brief Unlock/unpin page and put LSN stamp if it need
(uses direct block/page pointer)
- @param pagecache pointer to a page cache data structure
- @param link direct link to page (returned by read or write)
- @param lock lock change
- @param pin pin page
+ @param pagecache pointer to a page cache data structure
+ @param link direct link to page (returned by read or write)
+ @param lock lock change
+ @param pin pin page
@param first_REDO_LSN_for_page do not set it if it is LSN_IMPOSSIBLE (0)
- @param lsn if it is not LSN_IMPOSSIBLE and it is bigger then
- LSN on the page it will be written on the page
- @param was_changed should be true if the page was write locked with
- direct link giving and the page was changed
+ @param lsn if it is not LSN_IMPOSSIBLE and it is bigger then
+ LSN on the page it will be written on the page
+ @param was_changed should be true if the page was write locked with
+ direct link giving and the page was changed
+ @param any allowance unlock&unpin block locked/pinned
+ by any thread; possible only if this is a write-lock
+
+ @note 'any' is a hack so that _ma_bitmap_unpin_all() is allowed to unlock
+ and unpin bitmap pages locked and pinned by other threads. Because such
+ locks and pins are always PAGECACHE_LOCK_WRITE_UNLOCK and PAGECACHE_UNPIN
+ (see write_changed_bitmap()) (so, single lock is present), the hack is
+ limited to these condition. We should revisit this hack when we remove the
+ write lock in write_changed_bitmap(), see WL#4595.
*/
void pagecache_unlock_by_link(PAGECACHE *pagecache,
@@ -2902,7 +2932,8 @@ void pagecache_unlock_by_link(PAGECACHE
enum pagecache_page_lock lock,
enum pagecache_page_pin pin,
LSN first_REDO_LSN_for_page,
- LSN lsn, my_bool was_changed)
+ LSN lsn, my_bool was_changed,
+ my_bool any)
{
DBUG_ENTER("pagecache_unlock_by_link");
DBUG_PRINT("enter", ("block: 0x%lx fd: %u page: %lu changed: %d %s %s",
@@ -2922,7 +2953,7 @@ void pagecache_unlock_by_link(PAGECACHE
if (pin == PAGECACHE_PIN_LEFT_UNPINNED &&
lock == PAGECACHE_LOCK_READ_UNLOCK)
{
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
DBUG_ASSERT(0); /* should not happend */
DBUG_VOID_RETURN;
}
@@ -2976,7 +3007,7 @@ void pagecache_unlock_by_link(PAGECACHE
(ulong) block));
}
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, any))
DBUG_ASSERT(0); /* should not happend */
/*
@@ -3039,7 +3070,7 @@ void pagecache_unpin_by_link(PAGECACHE *
*/
if (make_lock_and_pin(pagecache, block,
PAGECACHE_LOCK_LEFT_READLOCKED,
- PAGECACHE_UNPIN))
+ PAGECACHE_UNPIN, FALSE))
DBUG_ASSERT(0); /* should not happend */
/*
@@ -3190,7 +3221,7 @@ restart:
block->type == PAGECACHE_EMPTY_PAGE)
block->type= type;
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
{
/*
We failed to write lock the block, cache is unlocked,
@@ -3334,7 +3365,7 @@ static my_bool pagecache_delete_internal
/* Cache is locked, so we can relese page before freeing it */
if (make_lock_and_pin(pagecache, block,
PAGECACHE_LOCK_WRITE_UNLOCK,
- PAGECACHE_UNPIN))
+ PAGECACHE_UNPIN, FALSE))
DBUG_ASSERT(0);
DBUG_ASSERT(block->hash_link->requests > 0);
page_link->requests--;
@@ -3396,7 +3427,7 @@ my_bool pagecache_delete_by_link(PAGECAC
make_lock_and_pin() can't fail here, because we are keeping pin on the
block and it can't be evicted (which is cause of lock fail and retry)
*/
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
DBUG_ASSERT(0);
/*
@@ -3514,7 +3545,7 @@ restart:
if (pin == PAGECACHE_PIN)
reg_requests(pagecache, block, 1);
DBUG_ASSERT(block != 0);
- if (make_lock_and_pin(pagecache, block, lock, pin))
+ if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
{
/*
We failed to writelock the block, cache is unlocked, and last write
@@ -3736,7 +3767,7 @@ restart:
write_lock_change_table[lock].new_lock,
(need_lock_change ?
write_pin_change_table[pin].new_pin :
- pin)))
+ pin), FALSE))
{
/*
We failed to writelock the block, cache is unlocked, and last write
@@ -3823,7 +3854,7 @@ restart:
*/
if (make_lock_and_pin(pagecache, block,
write_lock_change_table[lock].unlock_lock,
- write_pin_change_table[pin].unlock_pin))
+ write_pin_change_table[pin].unlock_pin, FALSE))
DBUG_ASSERT(0);
}
@@ -4034,7 +4065,7 @@ static int flush_cached_blocks(PAGECACHE
DBUG_ASSERT(block->wlocks == 0);
DBUG_ASSERT(block->pins == 0);
if (make_lock_and_pin(pagecache, block,
- PAGECACHE_LOCK_WRITE, PAGECACHE_PIN))
+ PAGECACHE_LOCK_WRITE, PAGECACHE_PIN, FALSE))
DBUG_ASSERT(0);
DBUG_ASSERT(block->pins == 1);
@@ -4068,7 +4099,7 @@ static int flush_cached_blocks(PAGECACHE
if (make_lock_and_pin(pagecache, block,
PAGECACHE_LOCK_WRITE_UNLOCK,
- PAGECACHE_UNPIN))
+ PAGECACHE_UNPIN, FALSE))
DBUG_ASSERT(0);
pagecache->global_cache_write++;
=== modified file 'storage/maria/ma_pagecache.h'
--- a/storage/maria/ma_pagecache.h 2008-03-04 11:58:21 +0000
+++ b/storage/maria/ma_pagecache.h 2008-10-13 15:50:28 +0000
@@ -242,7 +242,8 @@ extern void pagecache_unlock_by_link(PAG
enum pagecache_page_lock lock,
enum pagecache_page_pin pin,
LSN first_REDO_LSN_for_page,
- LSN lsn, my_bool was_changed);
+ LSN lsn, my_bool was_changed,
+ my_bool any);
extern void pagecache_unpin(PAGECACHE *pagecache,
PAGECACHE_FILE *file,
pgcache_page_no_t pageno,
=== modified file 'storage/maria/ma_preload.c'
--- a/storage/maria/ma_preload.c 2008-03-04 11:47:02 +0000
+++ b/storage/maria/ma_preload.c 2008-10-13 15:50:28 +0000
@@ -104,7 +104,7 @@ int maria_preload(MARIA_HA *info, ulongl
else /* otherwise it stays in cache: */
pagecache_unlock_by_link(share->pagecache, page_link,
PAGECACHE_LOCK_WRITE_UNLOCK, PAGECACHE_UNPIN,
- LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, FALSE);
+ LSN_IMPOSSIBLE, LSN_IMPOSSIBLE, FALSE, FALSE);
}
my_free(buff, MYF(0));
=== modified file 'storage/maria/unittest/ma_pagecache_rwconsist.c'
--- a/storage/maria/unittest/ma_pagecache_rwconsist.c 2008-04-21 14:17:21 +0000
+++ b/storage/maria/unittest/ma_pagecache_rwconsist.c 2008-10-13 15:50:28 +0000
@@ -114,7 +114,7 @@ void reader(int num)
check_page(buff, num);
pagecache_unlock_by_link(&pagecache, link,
PAGECACHE_LOCK_READ_UNLOCK,
- PAGECACHE_UNPIN, 0, 0, 0);
+ PAGECACHE_UNPIN, 0, 0, 0, FALSE);
{
int lim= rand() % read_sleep_limit;
int j;
@@ -149,7 +149,7 @@ void writer(int num)
check_page(buff, num);
pagecache_unlock_by_link(&pagecache, link,
PAGECACHE_LOCK_WRITE_UNLOCK,
- PAGECACHE_UNPIN, 0, 0, 1);
+ PAGECACHE_UNPIN, 0, 0, 1, FALSE);
SLEEP;
}
}
=== modified file 'storage/maria/unittest/ma_pagecache_single.c'
--- a/storage/maria/unittest/ma_pagecache_single.c 2008-03-04 11:58:21 +0000
+++ b/storage/maria/unittest/ma_pagecache_single.c 2008-10-13 15:50:28 +0000
@@ -391,7 +391,7 @@ int simple_pin_no_lock_test()
&link, LSN_IMPOSSIBLE);
pagecache_unlock_by_link(&pagecache, link,
PAGECACHE_LOCK_WRITE_UNLOCK,
- PAGECACHE_PIN_LEFT_PINNED, 0, 0, 1);
+ PAGECACHE_PIN_LEFT_PINNED, 0, 0, 1, FALSE);
if (!flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE))
{
diag("Did not get error in flush_pagecache_blocks 3\n");
| Thread |
|---|
| • bzr commit into MySQL/Maria:mysql-maria branch (guilhem:2676) WL#4595 | Guilhem Bichot | 13 Oct |