Commit 1b5927ee authored by unknown's avatar unknown

Don't give warnings when reading blocks when we know the block may not exist (in maria_read_log)

Don't give warnings when opening a wrong control file in ma_control_file_t (unit test)


BitKeeper/deleted/.del-ma_key_redo.c:
  Delete: storage/maria/ma_key_redo.c
storage/maria/ma_blockrec.c:
  Don't give warnings when reading blocks when we know the block may not exist
storage/maria/ma_pagecache.c:
  Keep a convinience copy of readwrite_flags
storage/maria/ma_pagecache.h:
  Keep a convinience copy of readwrite_flags
storage/maria/unittest/ma_control_file-t.c:
  Don't give warnings when opening a wrong control file
parent ca4bbe37
......@@ -5040,13 +5040,17 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn,
}
else
{
if (!(buff= pagecache_read(share->pagecache, &info->dfile,
page, 0, 0,
PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_WRITE,
&page_link.link)))
share->pagecache->readwrite_flags&= ~MY_WME;
buff= pagecache_read(share->pagecache, &info->dfile,
page, 0, 0,
PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_WRITE,
&page_link.link);
share->pagecache->readwrite_flags= share->pagecache->org_readwrite_flags;
if (!buff)
{
if (my_errno != HA_ERR_FILE_TOO_SHORT) /* If not read outside of file */
if (my_errno != HA_ERR_FILE_TOO_SHORT)
{
/* If not read outside of file */
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
......@@ -5481,14 +5485,19 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info,
}
else
{
if (!(buff= pagecache_read(share->pagecache,
&info->dfile,
page, 0, 0,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE, &page_link.link)))
share->pagecache->readwrite_flags&= ~MY_WME;
buff= pagecache_read(share->pagecache,
&info->dfile,
page, 0, 0,
PAGECACHE_PLAIN_PAGE,
PAGECACHE_LOCK_WRITE, &page_link.link);
share->pagecache->readwrite_flags= share->pagecache->
org_readwrite_flags;
if (!buff)
{
if (my_errno != HA_ERR_FILE_TOO_SHORT) /* If not read outside of file */
if (my_errno != HA_ERR_FILE_TOO_SHORT)
{
/* If not read outside of file */
pagecache_unlock_by_link(share->pagecache, page_link.link,
PAGECACHE_LOCK_WRITE_UNLOCK,
PAGECACHE_UNPIN, LSN_IMPOSSIBLE,
......
This diff is collapsed.
......@@ -723,6 +723,7 @@ ulong init_pagecache(PAGECACHE *pagecache, size_t use_mem,
pagecache->block_size= block_size;
pagecache->shift= my_bit_log2(block_size);
pagecache->readwrite_flags= my_readwrite_flags | MY_NABP | MY_WAIT_IF_FULL;
pagecache->org_readwrite_flags= pagecache->readwrite_flags;
DBUG_PRINT("info", ("block_size: %u", block_size));
DBUG_ASSERT(((uint)(1 << pagecache->shift)) == block_size);
......
......@@ -160,6 +160,7 @@ typedef struct st_pagecache
uint shift; /* block size = 2 ^ shift */
myf readwrite_flags; /* Flags to pread/pwrite() */
myf org_readwrite_flags; /* Flags to pread/pwrite() at init */
my_bool inited;
my_bool resize_in_flush; /* true during flush of resize operation */
my_bool can_be_used; /* usage of cache for read/write is allowed */
......
......@@ -87,10 +87,41 @@ static void get_options(int argc, char *argv[]);
{if (!(expr)) {diag("line %d: failure: '%s'", __LINE__, #expr); return 1;}}
/* Used to ignore error messages from ma_control_file_create_or_open */
static int my_ignore_message(uint error __attribute__((unused)),
const char *str __attribute__((unused)),
myf MyFlags __attribute__((unused)))
{
DBUG_ENTER("my_message_no_curses");
DBUG_PRINT("enter",("message: %s",str));
DBUG_RETURN(0);
}
int (*default_error_handler_hook)(uint my_err, const char *str,
myf MyFlags) = 0;
/* like ma_control_file_create_or_open(), but without error messages */
static CONTROL_FILE_ERROR local_ma_control_file_create_or_open()
{
CONTROL_FILE_ERROR error;
error_handler_hook= my_ignore_message;
error= ma_control_file_create_or_open();
error_handler_hook= default_error_handler_hook;
return error;
}
int main(int argc,char *argv[])
{
MY_INIT(argv[0]);
my_init();
maria_data_root= ".";
default_error_handler_hook= error_handler_hook;
plan(12);
......@@ -174,7 +205,7 @@ static int close_file()
static int create_or_open_file()
{
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) == CONTROL_FILE_OK);
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) == CONTROL_FILE_OK);
/* Check that the module reports expected information */
RET_ERR_UNLESS(verify_module_values_match_expected() == 0);
return 0;
......@@ -330,7 +361,7 @@ static int test_bad_magic_string()
RET_ERR_UNLESS(my_pwrite(fd, "papa", 4, 0, MYF(MY_FNABP | MY_WME)) == 0);
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) ==
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_BAD_MAGIC_STRING);
/* Restore magic string */
RET_ERR_UNLESS(my_pwrite(fd, buffer, 4, 0, MYF(MY_FNABP | MY_WME)) == 0);
......@@ -356,7 +387,7 @@ static int test_bad_checksum()
buffer[0]+= 3; /* mangle checksum */
RET_ERR_UNLESS(my_pwrite(fd, buffer, 1, 30, MYF(MY_FNABP | MY_WME)) == 0);
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) ==
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_BAD_CHECKSUM);
/* Restore checksum */
buffer[0]-= 3;
......@@ -371,7 +402,7 @@ static int test_bad_blocksize()
{
maria_block_size<<= 1;
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) ==
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_WRONG_BLOCKSIZE);
/* Restore blocksize */
maria_block_size>>= 1;
......@@ -446,7 +477,7 @@ static int test_bad_hchecksum()
buffer[0]+= 3; /* mangle checksum */
RET_ERR_UNLESS(my_pwrite(fd, buffer, 1, 26, MYF(MY_FNABP | MY_WME)) == 0);
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) ==
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_BAD_HEAD_CHECKSUM);
/* Restore checksum */
buffer[0]-= 3;
......@@ -470,14 +501,15 @@ static int test_bad_size()
MYF(MY_WME))) >= 0);
RET_ERR_UNLESS(my_write(fd, buffer, 10, MYF(MY_FNABP | MY_WME)) == 0);
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) ==
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_TOO_SMALL);
for (i= 0; i < 8; i++)
{
RET_ERR_UNLESS(my_write(fd, buffer, 66, MYF(MY_FNABP | MY_WME)) == 0);
}
/* Check that control file module sees the problem */
RET_ERR_UNLESS(ma_control_file_create_or_open(TRUE) == CONTROL_FILE_TOO_BIG);
RET_ERR_UNLESS(local_ma_control_file_create_or_open(TRUE) ==
CONTROL_FILE_TOO_BIG);
RET_ERR_UNLESS(my_close(fd, MYF(MY_WME)) == 0);
/* Leave a correct control file */
......
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