Commit e7de50a8 authored by Monty's avatar Monty

Bug fixes for S3

- Fixed wrong DBUG_ASSERT when waiting for big-block-read
- Update S3_pagecache_reads counter when reading a block from S3.
  Before this patch the variable value was always 0

Reviewer: Oleksandr Byelkin <sanja@mariadb.com>
parent 2840d775
...@@ -2824,8 +2824,14 @@ static void read_big_block(PAGECACHE *pagecache, ...@@ -2824,8 +2824,14 @@ static void read_big_block(PAGECACHE *pagecache,
have read our block for us have read our block for us
*/ */
struct st_my_thread_var *thread; struct st_my_thread_var *thread;
DBUG_ASSERT(page_st == PAGE_WAIT_TO_BE_READ); /*
DBUG_ASSERT(page_st != PAGE_TO_BE_READ); Either the page was not yet read and there is another thread
doing the read (page_st == PAGE_WAIT_TO_BE_READ) or the page
was just read and there are other threads waiting for the page
but they have not yet unmarked the PCLBOCK_BIG_READ flag
(page_st == PAGE_READ)
*/
DBUG_ASSERT(page_st == PAGE_READ || page_st == PAGE_WAIT_TO_BE_READ);
block->status|= PCBLOCK_BIG_READ; // will be read by other thread block->status|= PCBLOCK_BIG_READ; // will be read by other thread
/* /*
Block read failed because somebody else is reading the first block Block read failed because somebody else is reading the first block
...@@ -2844,12 +2850,12 @@ static void read_big_block(PAGECACHE *pagecache, ...@@ -2844,12 +2850,12 @@ static void read_big_block(PAGECACHE *pagecache,
&pagecache->cache_lock); &pagecache->cache_lock);
} }
while (thread->next); while (thread->next);
// page should be read by other thread // page should be read by other thread
DBUG_ASSERT(block->status & PCBLOCK_READ || DBUG_ASSERT(block->status & PCBLOCK_READ ||
block->status & PCBLOCK_ERROR); block->status & PCBLOCK_ERROR);
/* /*
It is possible that other thread already removed the flag (in It is possible that other thread already removed the flag (in
case of two threads waiting) but it will not make harm to try to case of two threads waiting) but it will not harm to try to
remove it even in that case. remove it even in that case.
*/ */
block->status&= ~PCBLOCK_BIG_READ; block->status&= ~PCBLOCK_BIG_READ;
...@@ -2883,6 +2889,7 @@ static void read_big_block(PAGECACHE *pagecache, ...@@ -2883,6 +2889,7 @@ static void read_big_block(PAGECACHE *pagecache,
args.pageno= page_to_read; args.pageno= page_to_read;
args.data= block->hash_link->file.callback_data; args.data= block->hash_link->file.callback_data;
pagecache->global_cache_read++;
if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file, if (pagecache->big_block_read(pagecache, &args, &block->hash_link->file,
&data)) &data))
{ {
......
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