#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-maria/
2665 Michael Widenius 2008-08-25
Fixed some wrong usage of my_bool
Fixed compiler warning
Ensure that pagecache returns correct error number
modified:
storage/maria/ma_pagecache.c
per-file messages:
storage/maria/ma_pagecache.c
Ensure that block->error contain error code from my_errno (not return value from pread/pwrite)
Went through usage of my_pread/my_pwrite and ensured that result was threated correctly
Fixed some wrong usage of my_bool
=== modified file 'storage/maria/ma_pagecache.c'
--- a/storage/maria/ma_pagecache.c 2008-08-25 11:49:47 +0000
+++ b/storage/maria/ma_pagecache.c 2008-08-25 18:26:50 +0000
@@ -593,16 +593,16 @@ extern my_bool translog_flush(TRANSLOG_A
RETURN
0 - OK
- !=0 - Error
+ 1 - Error
*/
-static uint pagecache_fwrite(PAGECACHE *pagecache,
- PAGECACHE_FILE *filedesc,
- uchar *buffer,
- pgcache_page_no_t pageno,
- enum pagecache_page_type type
- __attribute__((unused)),
- myf flags)
+static my_bool pagecache_fwrite(PAGECACHE *pagecache,
+ PAGECACHE_FILE *filedesc,
+ uchar *buffer,
+ pgcache_page_no_t pageno,
+ enum pagecache_page_type type
+ __attribute__((unused)),
+ myf flags)
{
DBUG_ENTER("pagecache_fwrite");
DBUG_ASSERT(type != PAGECACHE_READ_UNKNOWN_PAGE);
@@ -2069,7 +2069,7 @@ restart:
(my_bool)(block->hash_link ? 1 : 0));
PCBLOCK_INFO(block);
block->status= error ? PCBLOCK_ERROR : 0;
- block->error= error;
+ block->error= (int16) my_errno;
#ifndef DBUG_OFF
block->type= PAGECACHE_EMPTY_PAGE;
if (error)
@@ -2608,7 +2608,7 @@ static void read_block(PAGECACHE *pageca
if (error)
{
block->status|= PCBLOCK_ERROR;
- block->error= error;
+ block->error= (int16) my_errno;
my_debug_put_break_here();
}
else
@@ -2621,7 +2621,7 @@ static void read_block(PAGECACHE *pageca
{
DBUG_PRINT("error", ("read callback problem"));
block->status|= PCBLOCK_ERROR;
- block->error= my_errno;
+ block->error= (int16) my_errno;
my_debug_put_break_here();
}
}
@@ -3111,7 +3111,7 @@ uchar *pagecache_read(PAGECACHE *pagecac
enum pagecache_page_lock lock,
PAGECACHE_BLOCK_LINK **page_link)
{
- int error= 0;
+ my_bool error= 0;
enum pagecache_page_pin pin= lock_to_pin[test(buff==0)][lock];
PAGECACHE_BLOCK_LINK *fake_link;
my_bool reg_request;
@@ -3292,7 +3292,7 @@ static my_bool pagecache_delete_internal
PAGECACHE_HASH_LINK *page_link,
my_bool flush)
{
- int error= 0;
+ my_bool error= 0;
if (block->status & PCBLOCK_CHANGED)
{
if (flush)
@@ -3319,7 +3319,7 @@ static my_bool pagecache_delete_internal
if (error)
{
block->status|= PCBLOCK_ERROR;
- block->error= error;
+ block->error= (int16) my_errno;
my_debug_put_break_here();
goto err;
}
@@ -3368,7 +3368,7 @@ my_bool pagecache_delete_by_link(PAGECAC
enum pagecache_page_lock lock,
my_bool flush)
{
- int error= 0;
+ 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",
@@ -3467,7 +3467,7 @@ my_bool pagecache_delete(PAGECACHE *page
enum pagecache_page_lock lock,
my_bool flush)
{
- int error= 0;
+ my_bool error= 0;
enum pagecache_page_pin pin= lock_to_pin[0][lock];
DBUG_ENTER("pagecache_delete");
DBUG_PRINT("enter", ("fd: %u page: %lu %s %s",
@@ -3655,7 +3655,7 @@ my_bool pagecache_write_part(PAGECACHE *
{
PAGECACHE_BLOCK_LINK *block= NULL;
PAGECACHE_BLOCK_LINK *fake_link;
- int error= 0;
+ my_bool error= 0;
int need_lock_change= write_lock_change_table[lock].need_lock_change;
my_bool reg_request;
#ifndef DBUG_OFF
@@ -3778,7 +3778,7 @@ restart:
{
DBUG_PRINT("error", ("read callback problem"));
block->status|= PCBLOCK_ERROR;
- block->error= my_errno;
+ block->error= (int16) my_errno;
my_debug_put_break_here();
}
KEYCACHE_DBUG_PRINT("key_cache_insert",
@@ -3868,10 +3868,10 @@ no_key_cache:
uchar *page_buffer= (uchar *) alloca(pagecache->block_size);
pagecache->global_cache_read++;
- if ((error= pagecache_fread(pagecache, file,
- page_buffer,
- pageno,
- pagecache->readwrite_flags)))
+ if ((error= (pagecache_fread(pagecache, file,
+ page_buffer,
+ pageno,
+ pagecache->readwrite_flags) != 0)))
goto end;
if ((file->read_callback)(page_buffer, pageno, file->callback_data))
{
@@ -3995,7 +3995,7 @@ static int flush_cached_blocks(PAGECACHE
int *first_errno)
{
int rc= PCFLUSH_OK;
- int error;
+ my_bool error;
uint count= (uint) (end-cache);
DBUG_ENTER("flush_cached_blocks");
*first_errno= 0;
@@ -4075,7 +4075,7 @@ static int flush_cached_blocks(PAGECACHE
if (error)
{
block->status|= PCBLOCK_ERROR;
- block->error= error;
+ block->error= (int16) my_errno;
my_debug_put_break_here();
if (!*first_errno)
*first_errno= my_errno ? my_errno : -1;
| Thread |
|---|
| • bzr commit into MySQL/Maria:mysql-maria branch (monty:2665) | Michael Widenius | 25 Aug |