diff options
Diffstat (limited to 'myisam/mi_cache.c')
-rw-r--r-- | myisam/mi_cache.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/myisam/mi_cache.c b/myisam/mi_cache.c index 69a1cb0d7a5..18a56870e78 100644 --- a/myisam/mi_cache.c +++ b/myisam/mi_cache.c @@ -45,11 +45,11 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, buff+=read_length; } if ((offset= (my_off_t) (pos - info->pos_in_file)) < - (my_off_t) (info->rc_end - info->rc_request_pos)) + (my_off_t) (info->read_end - info->request_pos)) { - in_buff_pos=info->rc_request_pos+(uint) offset; - in_buff_length= min(length,(uint) (info->rc_end-in_buff_pos)); - memcpy(buff,info->rc_request_pos+(uint) offset,(size_t) in_buff_length); + in_buff_pos=info->request_pos+(uint) offset; + in_buff_length= min(length,(uint) (info->read_end-in_buff_pos)); + memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); if (!(length-=in_buff_length)) DBUG_RETURN(0); pos+=in_buff_length; @@ -60,19 +60,22 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, if (flag & READING_NEXT) { if (pos != ((info)->pos_in_file + - (uint) ((info)->rc_end - (info)->rc_request_pos))) + (uint) ((info)->read_end - (info)->request_pos))) { info->pos_in_file=pos; /* Force start here */ - info->rc_pos=info->rc_end=info->rc_request_pos; /* Everything used */ + info->read_pos=info->read_end=info->request_pos; /* Everything used */ info->seek_not_done=1; } else - info->rc_pos=info->rc_end; /* All block used */ + info->read_pos=info->read_end; /* All block used */ if (!(*info->read_function)(info,buff,length)) DBUG_RETURN(0); if (!(flag & READING_HEADER) || info->error == -1 || (uint) info->error+in_buff_length < 3) { + DBUG_PRINT("error", + ("Error %d reading next-multi-part block (Got %d bytes)", + my_errno, info->error)); if (!my_errno || my_errno == -1) my_errno=HA_ERR_WRONG_IN_RECORD; DBUG_RETURN(1); @@ -87,6 +90,9 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, if (!(flag & READING_HEADER) || (int) read_length == -1 || read_length+in_buff_length < 3) { + DBUG_PRINT("error", + ("Error %d reading new block (Got %d bytes)", + my_errno, (int) read_length)); if (!my_errno || my_errno == -1) my_errno=HA_ERR_WRONG_IN_RECORD; DBUG_RETURN(1); |