|
|
|
|
@@ -887,11 +887,11 @@ size_t init_pagecache(PAGECACHE *pagecache, size_t use_mem,
|
|
|
|
|
pagecache->waiting_for_hash_link.last_thread= NULL;
|
|
|
|
|
pagecache->waiting_for_block.last_thread= NULL;
|
|
|
|
|
DBUG_PRINT("exit",
|
|
|
|
|
("disk_blocks: %ld block_root: 0x%lx hash_entries: %ld\
|
|
|
|
|
hash_root: 0x%lx hash_links: %ld hash_link_root: 0x%lx",
|
|
|
|
|
pagecache->disk_blocks, (long) pagecache->block_root,
|
|
|
|
|
pagecache->hash_entries, (long) pagecache->hash_root,
|
|
|
|
|
pagecache->hash_links, (long) pagecache->hash_link_root));
|
|
|
|
|
("disk_blocks: %ld block_root: %p hash_entries: %ld\
|
|
|
|
|
hash_root: %p hash_links: %ld hash_link_root: %p",
|
|
|
|
|
(long) pagecache->disk_blocks, pagecache->block_root,
|
|
|
|
|
(long) pagecache->hash_entries, pagecache->hash_root,
|
|
|
|
|
(long) pagecache->hash_links, pagecache->hash_link_root));
|
|
|
|
|
|
|
|
|
|
pagecache->blocks= pagecache->disk_blocks > 0 ? pagecache->disk_blocks : 0;
|
|
|
|
|
DBUG_RETURN((size_t)pagecache->disk_blocks);
|
|
|
|
|
@@ -1163,7 +1163,7 @@ void check_pagecache_is_cleaned_up(PAGECACHE *pagecache)
|
|
|
|
|
void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("end_pagecache");
|
|
|
|
|
DBUG_PRINT("enter", ("key_cache: 0x%lx", (long) pagecache));
|
|
|
|
|
DBUG_PRINT("enter", ("key_cache: %p", pagecache));
|
|
|
|
|
|
|
|
|
|
if (!pagecache->inited)
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
@@ -1188,8 +1188,8 @@ void end_pagecache(PAGECACHE *pagecache, my_bool cleanup)
|
|
|
|
|
|
|
|
|
|
DBUG_PRINT("status", ("used: %lu changed: %lu w_requests: %lu "
|
|
|
|
|
"writes: %lu r_requests: %lu reads: %lu",
|
|
|
|
|
pagecache->blocks_used,
|
|
|
|
|
pagecache->global_blocks_changed,
|
|
|
|
|
(ulong) pagecache->blocks_used,
|
|
|
|
|
(ulong) pagecache->global_blocks_changed,
|
|
|
|
|
(ulong) pagecache->global_cache_w_requests,
|
|
|
|
|
(ulong) pagecache->global_cache_write,
|
|
|
|
|
(ulong) pagecache->global_cache_r_requests,
|
|
|
|
|
@@ -1411,7 +1411,7 @@ static void link_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block,
|
|
|
|
|
static void unlink_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("unlink_block");
|
|
|
|
|
DBUG_PRINT("pagecache", ("unlink 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("pagecache", ("unlink %p", block));
|
|
|
|
|
DBUG_ASSERT(block->next_used != NULL);
|
|
|
|
|
if (block->next_used == block)
|
|
|
|
|
{
|
|
|
|
|
@@ -1436,8 +1436,8 @@ static void unlink_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
KEYCACHE_DBUG_ASSERT(pagecache->blocks_available != 0);
|
|
|
|
|
pagecache->blocks_available--;
|
|
|
|
|
KEYCACHE_DBUG_PRINT("pagecache",
|
|
|
|
|
("unlinked block: 0x%lx (%u) status: %x #requests: %u #available: %u",
|
|
|
|
|
(ulong)block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
("unlinked block: %p (%u) status: %x #requests: %u #available: %u",
|
|
|
|
|
block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
block->status,
|
|
|
|
|
block->requests, pagecache->blocks_available));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
@@ -1505,8 +1505,8 @@ static void unreg_request(PAGECACHE *pagecache,
|
|
|
|
|
PAGECACHE_BLOCK_LINK *block, int at_end)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("unreg_request");
|
|
|
|
|
DBUG_PRINT("enter", ("block 0x%lx (%u) status: %x requests: %u",
|
|
|
|
|
(ulong)block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
DBUG_PRINT("enter", ("block %p (%u) status: %x requests: %u",
|
|
|
|
|
block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
block->status, block->requests));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
DBUG_ASSERT(block->requests > 0);
|
|
|
|
|
@@ -1523,7 +1523,7 @@ static void unreg_request(PAGECACHE *pagecache,
|
|
|
|
|
pagecache->warm_blocks--;
|
|
|
|
|
block->temperature= PCBLOCK_HOT;
|
|
|
|
|
KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
|
|
|
|
|
pagecache->warm_blocks));
|
|
|
|
|
(ulong) pagecache->warm_blocks));
|
|
|
|
|
}
|
|
|
|
|
link_block(pagecache, block, hot, (my_bool)at_end);
|
|
|
|
|
block->last_hit_time= pagecache->time;
|
|
|
|
|
@@ -1542,7 +1542,7 @@ static void unreg_request(PAGECACHE *pagecache,
|
|
|
|
|
block->temperature= PCBLOCK_WARM;
|
|
|
|
|
}
|
|
|
|
|
KEYCACHE_DBUG_PRINT("unreg_request", ("#warm_blocks: %lu",
|
|
|
|
|
pagecache->warm_blocks));
|
|
|
|
|
(ulong) pagecache->warm_blocks));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
@@ -2051,8 +2051,8 @@ restart:
|
|
|
|
|
block->hash_link= hash_link;
|
|
|
|
|
hash_link->block= block;
|
|
|
|
|
page_status= PAGE_TO_BE_READ;
|
|
|
|
|
DBUG_PRINT("info", ("page to be read set for page 0x%lx (%u)",
|
|
|
|
|
(ulong) block, PCBLOCK_NUMBER(pagecache, block)));
|
|
|
|
|
DBUG_PRINT("info", ("page to be read set for page %p (%u)",
|
|
|
|
|
block, PCBLOCK_NUMBER(pagecache, block)));
|
|
|
|
|
KEYCACHE_PRINT("find_block",
|
|
|
|
|
("got free or never used block %u",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block)));
|
|
|
|
|
@@ -2187,8 +2187,7 @@ restart:
|
|
|
|
|
my_debug_put_break_here();
|
|
|
|
|
#endif
|
|
|
|
|
page_status= PAGE_TO_BE_READ;
|
|
|
|
|
DBUG_PRINT("info", ("page to be read set for page 0x%lx",
|
|
|
|
|
(ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("page to be read set for page %p", block));
|
|
|
|
|
|
|
|
|
|
KEYCACHE_DBUG_ASSERT(block->hash_link->block == block);
|
|
|
|
|
KEYCACHE_DBUG_ASSERT(hash_link->block->hash_link == hash_link);
|
|
|
|
|
@@ -2235,13 +2234,12 @@ restart:
|
|
|
|
|
KEYCACHE_DBUG_ASSERT(page_status != -1);
|
|
|
|
|
*page_st= page_status;
|
|
|
|
|
DBUG_PRINT("info",
|
|
|
|
|
("block: 0x%lx fd: %u pos: %lu block->status: %u page_status: %u",
|
|
|
|
|
(ulong) block, (uint) file->file,
|
|
|
|
|
("block: %p fd: %u pos: %lu block->status: %u page_status: %u",
|
|
|
|
|
block, (uint) file->file,
|
|
|
|
|
(ulong) pageno, block->status, (uint) page_status));
|
|
|
|
|
KEYCACHE_PRINT("find_block",
|
|
|
|
|
("block: 0x%lx fd: %d pos: %lu block->status: %u page_status: %d",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
file->file, (ulong) pageno, block->status,
|
|
|
|
|
("block: %p fd: %d pos: %lu block->status: %u page_status: %d",
|
|
|
|
|
block, file->file, (ulong) pageno, block->status,
|
|
|
|
|
page_status));
|
|
|
|
|
|
|
|
|
|
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
|
|
|
|
|
@@ -2256,9 +2254,7 @@ restart:
|
|
|
|
|
static void add_pin(PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("add_pin");
|
|
|
|
|
DBUG_PRINT("enter", ("block: 0x%lx pins: %u",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
block->pins));
|
|
|
|
|
DBUG_PRINT("enter", ("block: %p pins: %u", block, block->pins));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
block->pins++;
|
|
|
|
|
#ifndef DBUG_OFF
|
|
|
|
|
@@ -2279,9 +2275,8 @@ static void remove_pin(PAGECACHE_BLOCK_LINK *block, my_bool any
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("remove_pin");
|
|
|
|
|
DBUG_PRINT("enter", ("block: 0x%lx pins: %u any: %d",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
block->pins, (int)any));
|
|
|
|
|
DBUG_PRINT("enter", ("block: %p pins: %u any: %d", block, block->pins,
|
|
|
|
|
(int)any));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
DBUG_ASSERT(block->pins > 0);
|
|
|
|
|
block->pins--;
|
|
|
|
|
@@ -2352,7 +2347,7 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache,
|
|
|
|
|
/* Lock failed we will wait */
|
|
|
|
|
struct st_my_thread_var *thread= my_thread_var;
|
|
|
|
|
DBUG_ENTER("pagecache_wait_lock");
|
|
|
|
|
DBUG_PRINT("info", ("fail to lock, waiting... 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("fail to lock, waiting... %p", block));
|
|
|
|
|
thread->lock_type= lock_type;
|
|
|
|
|
wqueue_add_to_queue(&block->wqueue[COND_FOR_WRLOCK], thread);
|
|
|
|
|
dec_counter_for_resize_op(pagecache);
|
|
|
|
|
@@ -2371,10 +2366,9 @@ static my_bool pagecache_wait_lock(PAGECACHE *pagecache,
|
|
|
|
|
file.file != block->hash_link->file.file ||
|
|
|
|
|
pageno != block->hash_link->pageno)
|
|
|
|
|
{
|
|
|
|
|
DBUG_PRINT("info", ("the block 0x%lx changed => need retry "
|
|
|
|
|
DBUG_PRINT("info", ("the block %p changed => need retry "
|
|
|
|
|
"status: %x files %d != %d or pages %lu != %lu",
|
|
|
|
|
(ulong)block, block->status,
|
|
|
|
|
file.file,
|
|
|
|
|
block, block->status, file.file,
|
|
|
|
|
block->hash_link ? block->hash_link->file.file : -1,
|
|
|
|
|
(ulong) pageno,
|
|
|
|
|
(ulong) (block->hash_link ? block->hash_link->pageno : 0)));
|
|
|
|
|
@@ -2414,10 +2408,9 @@ static my_bool get_wrlock(PAGECACHE *pagecache,
|
|
|
|
|
pgcache_page_no_t pageno= block->hash_link->pageno;
|
|
|
|
|
pthread_t locker= pthread_self();
|
|
|
|
|
DBUG_ENTER("get_wrlock");
|
|
|
|
|
DBUG_PRINT("info", ("the block 0x%lx "
|
|
|
|
|
DBUG_PRINT("info", ("the block %p "
|
|
|
|
|
"files %d(%d) pages %lu(%lu)",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
file.file, block->hash_link->file.file,
|
|
|
|
|
block, file.file, block->hash_link->file.file,
|
|
|
|
|
(ulong) pageno, (ulong) block->hash_link->pageno));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
/*
|
|
|
|
|
@@ -2435,7 +2428,7 @@ static my_bool get_wrlock(PAGECACHE *pagecache,
|
|
|
|
|
/* we are doing it by global cache mutex protection, so it is OK */
|
|
|
|
|
block->wlocks++;
|
|
|
|
|
block->write_locker= locker;
|
|
|
|
|
DBUG_PRINT("info", ("WR lock set, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("WR lock set, block %p", block));
|
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -2462,10 +2455,9 @@ static my_bool get_rdlock(PAGECACHE *pagecache,
|
|
|
|
|
pgcache_page_no_t pageno= block->hash_link->pageno;
|
|
|
|
|
pthread_t locker= pthread_self();
|
|
|
|
|
DBUG_ENTER("get_rdlock");
|
|
|
|
|
DBUG_PRINT("info", ("the block 0x%lx "
|
|
|
|
|
DBUG_PRINT("info", ("the block %p "
|
|
|
|
|
"files %d(%d) pages %lu(%lu)",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
file.file, block->hash_link->file.file,
|
|
|
|
|
block, file.file, block->hash_link->file.file,
|
|
|
|
|
(ulong) pageno, (ulong) block->hash_link->pageno));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
while (block->wlocks && !pthread_equal(block->write_locker, locker))
|
|
|
|
|
@@ -2480,12 +2472,12 @@ static my_bool get_rdlock(PAGECACHE *pagecache,
|
|
|
|
|
{
|
|
|
|
|
DBUG_ASSERT(pthread_equal(block->write_locker, locker));
|
|
|
|
|
block->rlocks_queue++;
|
|
|
|
|
DBUG_PRINT("info", ("RD lock put into queue, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("RD lock put into queue, block %p", block));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
block->rlocks++;
|
|
|
|
|
DBUG_PRINT("info", ("RD lock set, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("RD lock set, block %p", block));
|
|
|
|
|
}
|
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
}
|
|
|
|
|
@@ -2518,7 +2510,7 @@ static void release_wrlock(PAGECACHE_BLOCK_LINK *block, my_bool read_lock)
|
|
|
|
|
block->wlocks--;
|
|
|
|
|
if (block->wlocks > 0)
|
|
|
|
|
DBUG_VOID_RETURN; /* Multiple write locked */
|
|
|
|
|
DBUG_PRINT("info", ("WR lock reset, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("WR lock reset, block %p", block));
|
|
|
|
|
/* release all threads waiting for read lock or one waiting for write */
|
|
|
|
|
if (block->wqueue[COND_FOR_WRLOCK].last_thread)
|
|
|
|
|
wqueue_release_one_locktype_from_queue(&block->wqueue[COND_FOR_WRLOCK]);
|
|
|
|
|
@@ -2545,16 +2537,16 @@ static void release_rdlock(PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
DBUG_ASSERT(block->rlocks == 0);
|
|
|
|
|
DBUG_ASSERT(block->rlocks_queue > 0);
|
|
|
|
|
block->rlocks_queue--;
|
|
|
|
|
DBUG_PRINT("info", ("RD lock queue decreased, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("RD lock queue decreased, block %p", block));
|
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
|
}
|
|
|
|
|
DBUG_ASSERT(block->rlocks > 0);
|
|
|
|
|
DBUG_ASSERT(block->rlocks_queue == 0);
|
|
|
|
|
block->rlocks--;
|
|
|
|
|
DBUG_PRINT("info", ("RD lock decreased, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("RD lock decreased, block %p", block));
|
|
|
|
|
if (block->rlocks > 0)
|
|
|
|
|
DBUG_VOID_RETURN; /* Multiple write locked */
|
|
|
|
|
DBUG_PRINT("info", ("RD lock reset, block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("RD lock reset, block %p", block));
|
|
|
|
|
/* release all threads waiting for read lock or one waiting for write */
|
|
|
|
|
if (block->wqueue[COND_FOR_WRLOCK].last_thread)
|
|
|
|
|
wqueue_release_one_locktype_from_queue(&block->wqueue[COND_FOR_WRLOCK]);
|
|
|
|
|
@@ -2584,8 +2576,8 @@ static my_bool make_lock_and_pin(PAGECACHE *pagecache,
|
|
|
|
|
my_bool any)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("make_lock_and_pin");
|
|
|
|
|
DBUG_PRINT("enter", ("block: 0x%lx (%u) lock: %s pin: %s any %d",
|
|
|
|
|
(ulong)block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
DBUG_PRINT("enter", ("block: %p (%u) lock: %s pin: %s any %d",
|
|
|
|
|
block, PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
page_cache_page_lock_str[lock],
|
|
|
|
|
page_cache_page_pin_str[pin], (int)any));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
@@ -2662,7 +2654,7 @@ static my_bool make_lock_and_pin(PAGECACHE *pagecache,
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
retry:
|
|
|
|
|
DBUG_PRINT("INFO", ("Retry block 0x%lx", (ulong)block));
|
|
|
|
|
DBUG_PRINT("INFO", ("Retry block %p", block));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
DBUG_ASSERT(block->hash_link->requests > 0);
|
|
|
|
|
block->hash_link->requests--;
|
|
|
|
|
@@ -2698,8 +2690,7 @@ static void read_block(PAGECACHE *pagecache,
|
|
|
|
|
my_bool primary)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("read_block");
|
|
|
|
|
DBUG_PRINT("enter", ("read block: 0x%lx primary: %d",
|
|
|
|
|
(ulong)block, primary));
|
|
|
|
|
DBUG_PRINT("enter", ("read block: %p primary: %d", block, primary));
|
|
|
|
|
if (primary)
|
|
|
|
|
{
|
|
|
|
|
size_t error;
|
|
|
|
|
@@ -2894,8 +2885,7 @@ void pagecache_unlock(PAGECACHE *pagecache,
|
|
|
|
|
if (!(block->status & PCBLOCK_CHANGED) && was_changed)
|
|
|
|
|
link_to_changed_list(pagecache, block);
|
|
|
|
|
block->status&= ~PCBLOCK_DIRECT_W;
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: 0x%lx",
|
|
|
|
|
(ulong) block));
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: %p", block));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (make_lock_and_pin(pagecache, block, lock, pin, FALSE))
|
|
|
|
|
@@ -3018,9 +3008,8 @@ void pagecache_unlock_by_link(PAGECACHE *pagecache,
|
|
|
|
|
my_bool any)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("pagecache_unlock_by_link");
|
|
|
|
|
DBUG_PRINT("enter", ("block: 0x%lx fd: %u page: %lu changed: %d %s %s",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
(uint) block->hash_link->file.file,
|
|
|
|
|
DBUG_PRINT("enter", ("block: %p fd: %u page: %lu changed: %d %s %s",
|
|
|
|
|
block, (uint) block->hash_link->file.file,
|
|
|
|
|
(ulong) block->hash_link->pageno, was_changed,
|
|
|
|
|
page_cache_page_lock_str[lock],
|
|
|
|
|
page_cache_page_pin_str[pin]));
|
|
|
|
|
@@ -3090,8 +3079,7 @@ void pagecache_unlock_by_link(PAGECACHE *pagecache,
|
|
|
|
|
if (!(block->status & PCBLOCK_CHANGED) && was_changed)
|
|
|
|
|
link_to_changed_list(pagecache, block);
|
|
|
|
|
block->status&= ~PCBLOCK_DIRECT_W;
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: 0x%lx",
|
|
|
|
|
(ulong) block));
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: %p", block));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (make_lock_and_pin(pagecache, block, lock, pin, any))
|
|
|
|
|
@@ -3131,9 +3119,8 @@ void pagecache_unpin_by_link(PAGECACHE *pagecache,
|
|
|
|
|
LSN lsn)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("pagecache_unpin_by_link");
|
|
|
|
|
DBUG_PRINT("enter", ("block: 0x%lx fd: %u page: %lu",
|
|
|
|
|
(ulong) block,
|
|
|
|
|
(uint) block->hash_link->file.file,
|
|
|
|
|
DBUG_PRINT("enter", ("block: %p fd: %u page: %lu",
|
|
|
|
|
block, (uint) block->hash_link->file.file,
|
|
|
|
|
(ulong) block->hash_link->pageno));
|
|
|
|
|
|
|
|
|
|
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
|
|
|
|
|
@@ -3355,10 +3342,10 @@ uchar *pagecache_read(PAGECACHE *pagecache,
|
|
|
|
|
#ifndef DBUG_OFF
|
|
|
|
|
char llbuf[22];
|
|
|
|
|
DBUG_ENTER("pagecache_read");
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %u page: %s buffer: 0x%lx level: %u "
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %u page: %s buffer: %p level: %u "
|
|
|
|
|
"t:%s (%d)%s->%s %s->%s",
|
|
|
|
|
(uint) file->file, ullstr(pageno, llbuf),
|
|
|
|
|
(ulong) buff, level,
|
|
|
|
|
buff, level,
|
|
|
|
|
page_cache_page_type_str[type],
|
|
|
|
|
lock_to_read[lock].need_lock_change,
|
|
|
|
|
page_cache_page_lock_str[lock_to_read[lock].new_lock],
|
|
|
|
|
@@ -3452,8 +3439,7 @@ restart:
|
|
|
|
|
lock == PAGECACHE_LOCK_LEFT_WRITELOCKED))
|
|
|
|
|
{
|
|
|
|
|
block->status|= PCBLOCK_DIRECT_W;
|
|
|
|
|
DBUG_PRINT("info", ("Set PCBLOCK_DIRECT_W for block: 0x%lx",
|
|
|
|
|
(ulong) block));
|
|
|
|
|
DBUG_PRINT("info", ("Set PCBLOCK_DIRECT_W for block: %p", block));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@@ -3548,10 +3534,9 @@ no_key_cache: /* Key cache is not used */
|
|
|
|
|
void pagecache_set_write_on_delete_by_link(PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
{
|
|
|
|
|
DBUG_ENTER("pagecache_set_write_on_delete_by_link");
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %d block 0x%lx %d -> TRUE",
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %d block %p %d -> TRUE",
|
|
|
|
|
block->hash_link->file.file,
|
|
|
|
|
(ulong) block,
|
|
|
|
|
(int) block->status & PCBLOCK_DEL_WRITE));
|
|
|
|
|
block, (int) block->status & PCBLOCK_DEL_WRITE));
|
|
|
|
|
DBUG_ASSERT(block->pins); /* should be pinned */
|
|
|
|
|
DBUG_ASSERT(block->wlocks); /* should be write locked */
|
|
|
|
|
|
|
|
|
|
@@ -3628,9 +3613,9 @@ static my_bool pagecache_delete_internal(PAGECACHE *pagecache,
|
|
|
|
|
args.pageno= block->hash_link->pageno;
|
|
|
|
|
args.data= filedesc->callback_data;
|
|
|
|
|
/* We are not going to write the page but have to call callbacks */
|
|
|
|
|
DBUG_PRINT("info", ("flush_callback :0x%lx data: 0x%lx",
|
|
|
|
|
(ulong) filedesc->flush_log_callback,
|
|
|
|
|
(ulong) filedesc->callback_data));
|
|
|
|
|
DBUG_PRINT("info", ("flush_callback: %p data: %p",
|
|
|
|
|
filedesc->flush_log_callback,
|
|
|
|
|
filedesc->callback_data));
|
|
|
|
|
if ((*filedesc->flush_log_callback)(&args))
|
|
|
|
|
{
|
|
|
|
|
DBUG_PRINT("error", ("flush or write callback problem"));
|
|
|
|
|
@@ -3694,9 +3679,9 @@ my_bool pagecache_delete_by_link(PAGECACHE *pagecache,
|
|
|
|
|
my_bool error= 0;
|
|
|
|
|
enum pagecache_page_pin pin= PAGECACHE_PIN_LEFT_PINNED;
|
|
|
|
|
DBUG_ENTER("pagecache_delete_by_link");
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %d block 0x%lx %s %s",
|
|
|
|
|
DBUG_PRINT("enter", ("fd: %d block %p %s %s",
|
|
|
|
|
block->hash_link->file.file,
|
|
|
|
|
(ulong) block,
|
|
|
|
|
block,
|
|
|
|
|
page_cache_page_lock_str[lock],
|
|
|
|
|
page_cache_page_pin_str[pin]));
|
|
|
|
|
DBUG_ASSERT(lock == PAGECACHE_LOCK_WRITE ||
|
|
|
|
|
@@ -4069,8 +4054,7 @@ restart:
|
|
|
|
|
block->type= type;
|
|
|
|
|
/* we write to the page so it has no sense to keep the flag */
|
|
|
|
|
block->status&= ~PCBLOCK_DIRECT_W;
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: 0x%lx",
|
|
|
|
|
(ulong) block));
|
|
|
|
|
DBUG_PRINT("info", ("Drop PCBLOCK_DIRECT_W for block: %p", block));
|
|
|
|
|
|
|
|
|
|
if (make_lock_and_pin(pagecache, block,
|
|
|
|
|
write_lock_change_table[lock].new_lock,
|
|
|
|
|
@@ -4240,9 +4224,9 @@ static void free_block(PAGECACHE *pagecache, PAGECACHE_BLOCK_LINK *block)
|
|
|
|
|
uint status= block->status;
|
|
|
|
|
KEYCACHE_THREAD_TRACE("free block");
|
|
|
|
|
KEYCACHE_DBUG_PRINT("free_block",
|
|
|
|
|
("block: %u hash_link 0x%lx",
|
|
|
|
|
("block: %u hash_link %p",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block),
|
|
|
|
|
(long) block->hash_link));
|
|
|
|
|
block->hash_link));
|
|
|
|
|
mysql_mutex_assert_owner(&pagecache->cache_lock);
|
|
|
|
|
if (block->hash_link)
|
|
|
|
|
{
|
|
|
|
|
@@ -4371,10 +4355,10 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
|
|
|
|
|
if ((type == FLUSH_KEEP_LAZY && block->pins) || block->wlocks)
|
|
|
|
|
{
|
|
|
|
|
KEYCACHE_DBUG_PRINT("flush_cached_blocks",
|
|
|
|
|
("block: %u (0x%lx) pinned",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("block: %u (0x%lx) pinned",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), (ulong)block));
|
|
|
|
|
("block: %u (%p) pinned",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), block));
|
|
|
|
|
DBUG_PRINT("info", ("block: %u (%p) pinned",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), block));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
/* undo the mark put by flush_pagecache_blocks_int(): */
|
|
|
|
|
block->status&= ~PCBLOCK_IN_FLUSH;
|
|
|
|
|
@@ -4390,10 +4374,10 @@ static int flush_cached_blocks(PAGECACHE *pagecache,
|
|
|
|
|
DBUG_ASSERT(0);
|
|
|
|
|
|
|
|
|
|
KEYCACHE_PRINT("flush_cached_blocks",
|
|
|
|
|
("block: %u (0x%lx) to be flushed",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), (ulong)block));
|
|
|
|
|
DBUG_PRINT("info", ("block: %u (0x%lx) to be flushed",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), (ulong)block));
|
|
|
|
|
("block: %u (%p) to be flushed",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), block));
|
|
|
|
|
DBUG_PRINT("info", ("block: %u (%p) to be flushed",
|
|
|
|
|
PCBLOCK_NUMBER(pagecache, block), block));
|
|
|
|
|
PCBLOCK_INFO(block);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -4500,8 +4484,8 @@ static int flush_pagecache_blocks_int(PAGECACHE *pagecache,
|
|
|
|
|
DBUG_ENTER("flush_pagecache_blocks_int");
|
|
|
|
|
DBUG_PRINT("enter",
|
|
|
|
|
("fd: %d blocks_used: %lu blocks_changed: %lu type: %d",
|
|
|
|
|
file->file, pagecache->blocks_used, pagecache->blocks_changed,
|
|
|
|
|
type));
|
|
|
|
|
file->file, (ulong) pagecache->blocks_used,
|
|
|
|
|
(ulong) pagecache->blocks_changed, type));
|
|
|
|
|
|
|
|
|
|
#if !defined(DBUG_OFF) && defined(EXTRA_DEBUG)
|
|
|
|
|
DBUG_EXECUTE("check_pagecache",
|
|
|
|
|
@@ -4806,7 +4790,7 @@ int flush_pagecache_blocks_with_filter(PAGECACHE *pagecache,
|
|
|
|
|
{
|
|
|
|
|
int res;
|
|
|
|
|
DBUG_ENTER("flush_pagecache_blocks_with_filter");
|
|
|
|
|
DBUG_PRINT("enter", ("pagecache: 0x%lx", (long) pagecache));
|
|
|
|
|
DBUG_PRINT("enter", ("pagecache: %p", pagecache));
|
|
|
|
|
|
|
|
|
|
if (pagecache->disk_blocks <= 0)
|
|
|
|
|
DBUG_RETURN(0);
|
|
|
|
|
@@ -4965,7 +4949,7 @@ my_bool pagecache_collect_changed_blocks_with_lsn(PAGECACHE *pagecache,
|
|
|
|
|
ptr= str->str;
|
|
|
|
|
int8store(ptr, (ulonglong)stored_list_size);
|
|
|
|
|
ptr+= 8;
|
|
|
|
|
DBUG_PRINT("info", ("found %lu dirty pages", stored_list_size));
|
|
|
|
|
DBUG_PRINT("info", ("found %lu dirty pages", (ulong) stored_list_size));
|
|
|
|
|
if (stored_list_size == 0)
|
|
|
|
|
goto end;
|
|
|
|
|
for (file_hash= 0; file_hash < pagecache->changed_blocks_hash_size; file_hash++)
|
|
|
|
|
|