Commit e063e3fd authored by Michael Widenius's avatar Michael Widenius

Merge with 5.2

parents 3c78bfe7 5e876bd3
......@@ -1061,14 +1061,18 @@ static my_bool move_to_next_bitmap(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap)
MARIA_STATE_INFO *state= &info->s->state;
DBUG_ENTER("move_to_next_bitmap");
if (state->first_bitmap_with_space != ~(ulonglong) 0 &&
if (state->first_bitmap_with_space != ~(pgcache_page_no_t) 0 &&
state->first_bitmap_with_space != page)
{
page= state->first_bitmap_with_space;
state->first_bitmap_with_space= ~(ulonglong) 0;
state->first_bitmap_with_space= ~(pgcache_page_no_t) 0;
DBUG_ASSERT(page % bitmap->pages_covered == 0);
}
else
{
page+= bitmap->pages_covered;
DBUG_ASSERT(page % bitmap->pages_covered == 0);
}
DBUG_RETURN(_ma_change_bitmap_page(info, bitmap, page));
}
......@@ -2039,8 +2043,7 @@ my_bool _ma_bitmap_find_new_place(MARIA_HA *info, MARIA_ROW *row,
goto abort;
/* Switch bitmap to current head page */
bitmap_page= page / share->bitmap.pages_covered;
bitmap_page*= share->bitmap.pages_covered;
bitmap_page= page - page % share->bitmap.pages_covered;
if (share->bitmap.page != bitmap_page &&
_ma_change_bitmap_page(info, &share->bitmap, bitmap_page))
......
......@@ -6568,6 +6568,17 @@ static void copy_data_file_state(MARIA_STATE_INFO *to,
}
/* Return 1 if block is full of zero's */
static my_bool zero_filled_block(uchar *tmp, uint length)
{
while (length--)
if (*(tmp++) != 0)
return 0;
return 1;
}
/*
Read 'safely' next record while scanning table.
......@@ -6669,9 +6680,21 @@ static int _ma_safe_scan_block_record(MARIA_SORT_INFO *sort_info,
{
if (my_errno == HA_ERR_WRONG_CRC)
{
_ma_check_print_info(sort_info->param,
"Wrong CRC on datapage at %s",
llstr(page, llbuff));
/*
Don't give errors for zero filled blocks. These can
sometimes be found at end of a bitmap when we wrote a big
record last that was moved to the next bitmap.
*/
if (!zero_filled_block(info->scan.page_buff, share->block_size) ||
_ma_check_bitmap_data(info, UNALLOCATED_PAGE, 0,
_ma_bitmap_get_page_bits(info,
&share->bitmap,
page)))
{
_ma_check_print_info(sort_info->param,
"Wrong CRC on datapage at %s",
llstr(page, llbuff));
}
continue;
}
DBUG_RETURN(my_errno);
......
......@@ -3519,7 +3519,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
}
else
{
if (!(status & PCBLOCK_ERROR))
if (status & PCBLOCK_READ)
{
#if !defined(SERIALIZED_READ_FROM_CACHE)
pagecache_pthread_mutex_unlock(&pagecache->cache_lock);
......@@ -3533,7 +3533,7 @@ uchar *pagecache_read(PAGECACHE *pagecache,
pagecache_pthread_mutex_lock(&pagecache->cache_lock);
#endif
}
else
if (status & PCBLOCK_ERROR)
my_errno= block->error;
}
......
......@@ -878,9 +878,9 @@ static void get_options(register int *argc,register char ***argv)
load_defaults("my", load_default_groups, argc, argv);
default_argv= *argv;
check_param.testflag= T_UPDATE_STATE;
if (isatty(fileno(stdout)))
check_param.testflag|=T_WRITE_LOOP;
check_param.testflag= T_UPDATE_STATE;
if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option)))
exit(ho_error);
......
......@@ -32,7 +32,7 @@ const char *default_dbug_option= "d:t:o,/tmp/aria_read_log.trace";
static my_bool opt_display_only, opt_apply, opt_apply_undo, opt_silent;
static my_bool opt_check;
static const char *opt_tmpdir;
static ulong opt_page_buffer_size;
static ulong opt_page_buffer_size, opt_translog_buffer_size;
static ulonglong opt_start_from_lsn, opt_end_lsn, opt_start_from_checkpoint;
static MY_TMPDIR maria_chk_tmpdir;
......@@ -80,9 +80,8 @@ int main(int argc, char **argv)
But if it finds a log and this log was crashed, it will create a new log,
which is useless. TODO: start log handler in read-only mode.
*/
if (init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, MY_WME) == 0 ||
if (init_pagecache(maria_log_pagecache, opt_translog_buffer_size,
0, 0, TRANSLOG_PAGE_SIZE, MY_WME) == 0 ||
translog_init(maria_data_root, TRANSLOG_FILE_SIZE,
0, 0, maria_log_pagecache, TRANSLOG_DEFAULT_FLAGS,
opt_display_only))
......@@ -166,7 +165,7 @@ int main(int argc, char **argv)
#include "ma_check_standalone.h"
enum options_mc {
OPT_CHARSETS_DIR=256, OPT_FORCE_CRASH
OPT_CHARSETS_DIR=256, OPT_FORCE_CRASH, OPT_TRANSLOG_BUFFER_SIZE
};
static struct my_option my_long_options[] =
......@@ -228,6 +227,12 @@ static struct my_option my_long_options[] =
"colon (:)"
#endif
, (char**) &opt_tmpdir, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "translog-buffer-size", OPT_TRANSLOG_BUFFER_SIZE,
"The size of the buffer used for transaction log for Aria tables",
&opt_translog_buffer_size, &opt_translog_buffer_size, 0,
GET_ULONG, REQUIRED_ARG, (long) TRANSLOG_PAGECACHE_SIZE,
1024L*1024L, (long) ~(ulong) 0, (long) MALLOC_OVERHEAD,
(long) IO_SIZE, 0},
{"undo", 'u', "Apply UNDO records to tables. (disable with --disable-undo)",
(uchar **) &opt_apply_undo, (uchar **) &opt_apply_undo, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
......
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