Commit 172356b0 authored by Michael Widenius's avatar Michael Widenius

Automatic merge

parents 7027c7fa 89e62085
...@@ -606,7 +606,7 @@ sub new_config { ...@@ -606,7 +606,7 @@ sub new_config {
# add auto-options # add auto-options
$config->insert('OPT', 'port' => sub { fix_port($self, $config) }); $config->insert('OPT', 'port' => sub { fix_port($self, $config) });
$config->insert('OPT', 'vardir' => sub { shift->{ARGS}->{vardir} }); $config->insert('OPT', 'vardir' => sub { $self->{ARGS}->{vardir} });
{ {
# Run pre rules # Run pre rules
......
...@@ -687,7 +687,7 @@ sub process_opts { ...@@ -687,7 +687,7 @@ sub process_opts {
} }
if (@plugins) { if (@plugins) {
my $sep = (IS_WIN32PERL) ? ';' : ':'; my $sep = (IS_WINDOWS) ? ';' : ':';
push @{$tinfo->{$opt_name}}, "--plugin-load=" . join($sep, @plugins); push @{$tinfo->{$opt_name}}, "--plugin-load=" . join($sep, @plugins);
} }
} }
......
...@@ -2959,7 +2959,7 @@ sub run_benchmarks ($) { ...@@ -2959,7 +2959,7 @@ sub run_benchmarks ($) {
if ( ! $benchmark ) if ( ! $benchmark )
{ {
mtr_add_arg($args, "--log"); mtr_add_arg($args, "--general-log");
mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", ""); mtr_run("$glob_mysql_bench_dir/run-all-tests", $args, "", "", "", "");
# FIXME check result code?! # FIXME check result code?!
} }
......
...@@ -422,20 +422,20 @@ test.t1 analyze status OK ...@@ -422,20 +422,20 @@ test.t1 analyze status OK
test.t2 analyze status OK test.t2 analyze status OK
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where 1 SIMPLE t1 range uid_index uid_index 4 NULL # Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1 1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid #
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id name uid id name uid id name uid id name uid
1001 A 1 1001 A 1 1001 A 1 1001 A 1
......
...@@ -383,9 +383,14 @@ analyze table t1,t2; ...@@ -383,9 +383,14 @@ analyze table t1,t2;
# This part doesn't make sense for pbxt as the result may vary becasue # This part doesn't make sense for pbxt as the result may vary becasue
# records_in_range() gives same results for t1 and t2. # records_in_range() gives same results for t1 and t2.
# Added straight_join to get predictable results # Added straight_join to get predictable results
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
--replace_column 9 #
explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0; explain select straight_join * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
......
...@@ -3070,7 +3070,20 @@ int my_message_sql(uint error, const char *str, myf MyFlags) ...@@ -3070,7 +3070,20 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
} }
else else
{ {
if (! thd->main_da.is_error()) // Return only first message if (thd->main_da.is_ok() && !thd->main_da.can_overwrite_status)
{
/*
Client has already got ok packet and we are not in net_flush(), so
we write a message to error log.
This could happen if we get an error in implicit commit.
This should never happen in normal operation, so lets
assert here in debug builds.
*/
DBUG_ASSERT(0);
func= sql_print_error;
MyFlags|= ME_NOREFRESH;
}
else if (! thd->main_da.is_error()) // Return only first message
{ {
thd->main_da.set_error_status(thd, error, str); thd->main_da.set_error_status(thd, error, str);
} }
...@@ -4185,7 +4198,6 @@ a file name for --log-bin-index option", opt_binlog_index_name); ...@@ -4185,7 +4198,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
unireg_abort(1); unireg_abort(1);
} }
#ifdef WITH_CSV_STORAGE_ENGINE
if (opt_bootstrap) if (opt_bootstrap)
log_output_options= LOG_FILE; log_output_options= LOG_FILE;
else else
...@@ -4219,10 +4231,6 @@ a file name for --log-bin-index option", opt_binlog_index_name); ...@@ -4219,10 +4231,6 @@ a file name for --log-bin-index option", opt_binlog_index_name);
logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE, logger.set_handlers(LOG_FILE, opt_slow_log ? log_output_options:LOG_NONE,
opt_log ? log_output_options:LOG_NONE); opt_log ? log_output_options:LOG_NONE);
} }
#else
logger.set_handlers(LOG_FILE, opt_slow_log ? LOG_FILE:LOG_NONE,
opt_log ? LOG_FILE:LOG_NONE);
#endif
/* /*
Check that the default storage engine is actually available. Check that the default storage engine is actually available.
...@@ -6298,13 +6306,11 @@ each time the SQL thread starts.", ...@@ -6298,13 +6306,11 @@ each time the SQL thread starts.",
"Log some extra information to update log. Please note that this option " "Log some extra information to update log. Please note that this option "
"is deprecated; see --log-short-format option.", "is deprecated; see --log-short-format option.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef WITH_CSV_STORAGE_ENGINE
{"log-output", OPT_LOG_OUTPUT, {"log-output", OPT_LOG_OUTPUT,
"Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, " "Syntax: log-output[=value[,value...]], where \"value\" could be TABLE, "
"FILE or NONE.", "FILE or NONE.",
&log_output_str, &log_output_str, 0, &log_output_str, &log_output_str, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES, {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
"Log queries that are executed without benefit of any index to the slow log if it is open.", "Log queries that are executed without benefit of any index to the slow log if it is open.",
&opt_log_queries_not_using_indexes, &opt_log_queries_not_using_indexes, &opt_log_queries_not_using_indexes, &opt_log_queries_not_using_indexes,
...@@ -8639,7 +8645,6 @@ mysqld_get_one_option(int optid, ...@@ -8639,7 +8645,6 @@ mysqld_get_one_option(int optid,
WARN_DEPRECATED(NULL, "7.0", "--log_slow_queries", "'--slow_query_log'/'--log-slow-file'"); WARN_DEPRECATED(NULL, "7.0", "--log_slow_queries", "'--slow_query_log'/'--log-slow-file'");
opt_slow_log= 1; opt_slow_log= 1;
break; break;
#ifdef WITH_CSV_STORAGE_ENGINE
case OPT_LOG_OUTPUT: case OPT_LOG_OUTPUT:
{ {
if (!argument || !argument[0]) if (!argument || !argument[0])
...@@ -8657,7 +8662,6 @@ mysqld_get_one_option(int optid, ...@@ -8657,7 +8662,6 @@ mysqld_get_one_option(int optid,
} }
break; break;
} }
#endif
case OPT_EVENT_SCHEDULER: case OPT_EVENT_SCHEDULER:
#ifndef HAVE_EVENT_SCHEDULER #ifndef HAVE_EVENT_SCHEDULER
sql_perror("Event scheduler is not supported in embedded build."); sql_perror("Event scheduler is not supported in embedded build.");
......
...@@ -750,8 +750,11 @@ static int maria_create_trn_for_mysql(MARIA_HA *info) ...@@ -750,8 +750,11 @@ static int maria_create_trn_for_mysql(MARIA_HA *info)
thd->query_length()); thd->query_length());
} }
else else
{
DBUG_PRINT("info", ("lock_type: %d trnman_flags: %u", DBUG_PRINT("info", ("lock_type: %d trnman_flags: %u",
info->lock_type, trnman_get_flags(trn))); /* QQ */ info->lock_type, trnman_get_flags(trn)));
}
#endif #endif
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -2347,6 +2350,12 @@ int ha_maria::extra(enum ha_extra_function operation) ...@@ -2347,6 +2350,12 @@ int ha_maria::extra(enum ha_extra_function operation)
int ha_maria::reset(void) int ha_maria::reset(void)
{ {
if (file->trn)
{
/* Next statement is a new statement. Ensure it's logged */
trnman_set_flags(file->trn,
trnman_get_flags(file->trn) & ~TRN_STATE_INFO_LOGGED);
}
return maria_reset(file); return maria_reset(file);
} }
......
...@@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap, ...@@ -1875,6 +1875,7 @@ static my_bool set_page_bits(MARIA_HA *info, MARIA_FILE_BITMAP *bitmap,
uint offset_page, offset, tmp, org_tmp; uint offset_page, offset, tmp, org_tmp;
uchar *data; uchar *data;
DBUG_ENTER("set_page_bits"); DBUG_ENTER("set_page_bits");
DBUG_ASSERT(fill_pattern <= 7);
bitmap_page= page - page % bitmap->pages_covered; bitmap_page= page - page % bitmap->pages_covered;
if (bitmap_page != bitmap->page && if (bitmap_page != bitmap->page &&
...@@ -2296,9 +2297,16 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks) ...@@ -2296,9 +2297,16 @@ my_bool _ma_bitmap_release_unused(MARIA_HA *info, MARIA_BITMAP_BLOCKS *blocks)
The page has all bits set; The following test is an optimization The page has all bits set; The following test is an optimization
to not set the bits to the same value as before. to not set the bits to the same value as before.
*/ */
if (bits != current_bitmap_value && if (bits != current_bitmap_value)
set_page_bits(info, bitmap, block->page, bits)) {
goto err; if (set_page_bits(info, bitmap, block->page, bits))
goto err;
}
else
{
DBUG_ASSERT(current_bitmap_value ==
_ma_bitmap_get_page_bits(info, bitmap, block->page));
}
} }
else if (!(block->used & BLOCKUSED_USED) && else if (!(block->used & BLOCKUSED_USED) &&
_ma_bitmap_reset_full_page_bits(info, bitmap, _ma_bitmap_reset_full_page_bits(info, bitmap,
......
...@@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info, ...@@ -1990,7 +1990,8 @@ static my_bool write_tail(MARIA_HA *info,
block->empty_space= (enough_free_entries(row_pos.buff, share->block_size, block->empty_space= (enough_free_entries(row_pos.buff, share->block_size,
1 + share->base.blobs) ? 1 + share->base.blobs) ?
empty_space : 0); empty_space : 0);
block->used= BLOCKUSED_USED | BLOCKUSED_TAIL; /* Keep BLOCKUSED_USE_ORG_BITMAP */
block->used|= BLOCKUSED_USED | BLOCKUSED_TAIL;
/* Increase data file size, if extended */ /* Increase data file size, if extended */
position= (my_off_t) block->page * block_size; position= (my_off_t) block->page * block_size;
......
...@@ -136,11 +136,13 @@ void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info) ...@@ -136,11 +136,13 @@ void maria_chk_init_for_check(HA_CHECK *param, MARIA_HA *info)
Set up transaction handler so that we can see all rows. When rows is read Set up transaction handler so that we can see all rows. When rows is read
we will check the found id against param->max_tried we will check the found id against param->max_tried
*/ */
if (!ma_control_file_inited()) if (param->max_trid == 0)
param->max_trid= 0; /* Give warning for first trid found */ {
else if (!ma_control_file_inited())
param->max_trid= max_trid_in_system(); param->max_trid= 0; /* Give warning for first trid found */
else
param->max_trid= max_trid_in_system();
}
maria_ignore_trids(info); maria_ignore_trids(info);
} }
...@@ -867,7 +869,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, ...@@ -867,7 +869,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo,
llstr(anc_page->pos, llbuff)); llstr(anc_page->pos, llbuff));
} }
if (anc_page->size > (uint) keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE) if (anc_page->size > share->max_index_block_size)
{ {
_ma_check_print_error(param, _ma_check_print_error(param,
"Page at %s has impossible (too big) pagelength", "Page at %s has impossible (too big) pagelength",
...@@ -2325,11 +2327,13 @@ static int initialize_variables_for_repair(HA_CHECK *param, ...@@ -2325,11 +2327,13 @@ static int initialize_variables_for_repair(HA_CHECK *param,
} }
/* Set up transaction handler so that we can see all rows */ /* Set up transaction handler so that we can see all rows */
if (!ma_control_file_inited()) if (param->max_trid == 0)
param->max_trid= 0; /* Give warning for first trid found */ {
else if (!ma_control_file_inited())
param->max_trid= max_trid_in_system(); param->max_trid= 0; /* Give warning for first trid found */
else
param->max_trid= max_trid_in_system();
}
maria_ignore_trids(info); maria_ignore_trids(info);
/* Don't write transid's during repair */ /* Don't write transid's during repair */
maria_versioning(info, 0); maria_versioning(info, 0);
...@@ -5609,7 +5613,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param, ...@@ -5609,7 +5613,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param,
a_length+=t_length; a_length+=t_length;
_ma_store_page_used(share, anc_buff, a_length); _ma_store_page_used(share, anc_buff, a_length);
key_block->end_pos+=t_length; key_block->end_pos+=t_length;
if (a_length <= (uint) (keyinfo->block_length - KEYPAGE_CHECKSUM_SIZE)) if (a_length <= share->max_index_block_size)
{ {
MARIA_KEY tmp_key2; MARIA_KEY tmp_key2;
tmp_key2.data= key_block->lastkey; tmp_key2.data= key_block->lastkey;
......
This diff is collapsed.
This diff is collapsed.
...@@ -64,17 +64,26 @@ extern my_bool write_hook_for_undo_key_delete(enum translog_record_type type, ...@@ -64,17 +64,26 @@ extern my_bool write_hook_for_undo_key_delete(enum translog_record_type type,
TRN *trn, MARIA_HA *tbl_info, TRN *trn, MARIA_HA *tbl_info,
LSN *lsn, void *hook_arg); LSN *lsn, void *hook_arg);
my_bool _ma_log_prefix(MARIA_PAGE *page, uint changed_length, int move_length); my_bool _ma_log_prefix(MARIA_PAGE *page, uint changed_length, int move_length,
enum en_key_debug debug_marker);
my_bool _ma_log_suffix(MARIA_PAGE *page, uint org_length, my_bool _ma_log_suffix(MARIA_PAGE *page, uint org_length,
uint new_length); uint new_length);
my_bool _ma_log_add(MARIA_PAGE *page, uint buff_length, uchar *key_pos, my_bool _ma_log_add(MARIA_PAGE *page, uint buff_length, uchar *key_pos,
uint changed_length, int move_length, uint changed_length, int move_length,
my_bool handle_overflow); my_bool handle_overflow);
my_bool _ma_log_delete(MARIA_PAGE *page, const uchar *key_pos, my_bool _ma_log_delete(MARIA_PAGE *page, const uchar *key_pos,
uint changed_length, uint move_length); uint changed_length, uint move_length,
uint append_length, enum en_key_debug debug_marker);
my_bool _ma_log_change(MARIA_PAGE *page, const uchar *key_pos, uint length, my_bool _ma_log_change(MARIA_PAGE *page, const uchar *key_pos, uint length,
enum en_key_debug debug_marker); enum en_key_debug debug_marker);
my_bool _ma_log_new(MARIA_PAGE *page, my_bool root_page); my_bool _ma_log_new(MARIA_PAGE *page, my_bool root_page);
#ifdef EXTRA_DEBUG_KEY_CHANGES
void _ma_log_key_changes(MARIA_PAGE *ma_page, LEX_CUSTRING *log_array,
uchar *log_pos, uint *changed_length,
uint *translog_parts);
#else
#define _ma_log_key_changes(A,B,C,D,E)
#endif
uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn, uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn,
const uchar *header, uint length); const uchar *header, uint length);
......
...@@ -172,13 +172,24 @@ enum en_key_op ...@@ -172,13 +172,24 @@ enum en_key_op
enum en_key_debug enum en_key_debug
{ {
KEY_OP_DEBUG_RTREE_COMBINE, KEY_OP_DEBUG_RTREE_COMBINE, /* 0 */
KEY_OP_DEBUG_RTREE_SPLIT, KEY_OP_DEBUG_RTREE_SPLIT, /* 1 */
KEY_OP_DEBUG_RTREE_SET_KEY, KEY_OP_DEBUG_RTREE_SET_KEY, /* 2 */
KEY_OP_DEBUG_FATHER_CHANGED_1, KEY_OP_DEBUG_FATHER_CHANGED_1, /* 3 */
KEY_OP_DEBUG_FATHER_CHANGED_2, KEY_OP_DEBUG_FATHER_CHANGED_2, /* 4 */
KEY_OP_DEBUG_LOG_SPLIT, KEY_OP_DEBUG_LOG_SPLIT, /* 5 */
KEY_OP_DEBUG_LOG_ADD KEY_OP_DEBUG_LOG_ADD, /* 6 */
KEY_OP_DEBUG_LOG_PREFIX_1, /* 7 */
KEY_OP_DEBUG_LOG_PREFIX_2, /* 8 */
KEY_OP_DEBUG_LOG_PREFIX_3, /* 9 */
KEY_OP_DEBUG_LOG_PREFIX_4, /* 10 */
KEY_OP_DEBUG_LOG_PREFIX_5, /* 11 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_1, /* 12 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_2, /* 13 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_3, /* 14 */
KEY_OP_DEBUG_LOG_DEL_CHANGE_RT, /* 15 */
KEY_OP_DEBUG_LOG_DEL_PREFIX, /* 16 */
KEY_OP_DEBUG_LOG_MIDDLE /* 17 */
}; };
......
...@@ -550,6 +550,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags) ...@@ -550,6 +550,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
strmov(share->open_file_name.str, name); strmov(share->open_file_name.str, name);
share->block_size= share->base.block_size; /* Convenience */ share->block_size= share->base.block_size; /* Convenience */
share->max_index_block_size= share->block_size - KEYPAGE_CHECKSUM_SIZE;
{ {
HA_KEYSEG *pos=share->keyparts; HA_KEYSEG *pos=share->keyparts;
uint32 ftkey_nr= 1; uint32 ftkey_nr= 1;
......
...@@ -59,6 +59,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info, ...@@ -59,6 +59,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info,
page->buff= buff; page->buff= buff;
page->pos= pos; page->pos= pos;
page->size= _ma_get_page_used(share, buff); page->size= _ma_get_page_used(share, buff);
page->org_size= page->size;
page->flag= _ma_get_keypage_flag(share, buff); page->flag= _ma_get_keypage_flag(share, buff);
page->node= ((page->flag & KEYPAGE_FLAG_ISNOD) ? page->node= ((page->flag & KEYPAGE_FLAG_ISNOD) ?
share->base.key_reflength : 0); share->base.key_reflength : 0);
...@@ -68,7 +69,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info, ...@@ -68,7 +69,7 @@ void _ma_page_setup(MARIA_PAGE *page, MARIA_HA *info,
void page_cleanup(MARIA_SHARE *share, MARIA_PAGE *page) void page_cleanup(MARIA_SHARE *share, MARIA_PAGE *page)
{ {
uint length= page->size; uint length= page->size;
DBUG_ASSERT(length <= block_size - KEYPAGE_CHECKSUM_SIZE); DBUG_ASSERT(length <= share->max_index_block_size);
bzero(page->buff + length, share->block_size - length); bzero(page->buff + length, share->block_size - length);
} }
#endif #endif
...@@ -103,7 +104,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info, ...@@ -103,7 +104,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
uint block_size= share->block_size; uint block_size= share->block_size;
DBUG_ENTER("_ma_fetch_keypage"); DBUG_ENTER("_ma_fetch_keypage");
DBUG_PRINT("enter",("pos: %ld", (long) pos)); DBUG_PRINT("enter",("page: %lu", (ulong) (pos / block_size)));
tmp= pagecache_read(share->pagecache, &share->kfile, tmp= pagecache_read(share->pagecache, &share->kfile,
(pgcache_page_no_t) (pos / block_size), level, buff, (pgcache_page_no_t) (pos / block_size), level, buff,
...@@ -142,6 +143,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info, ...@@ -142,6 +143,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
page->buff= tmp; page->buff= tmp;
page->pos= pos; page->pos= pos;
page->size= _ma_get_page_used(share, tmp); page->size= _ma_get_page_used(share, tmp);
page->org_size= page->size; /* For debugging */
page->flag= _ma_get_keypage_flag(share, tmp); page->flag= _ma_get_keypage_flag(share, tmp);
page->node= ((page->flag & KEYPAGE_FLAG_ISNOD) ? page->node= ((page->flag & KEYPAGE_FLAG_ISNOD) ?
share->base.key_reflength : 0); share->base.key_reflength : 0);
...@@ -149,7 +151,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info, ...@@ -149,7 +151,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
{ {
uint page_size= page->size; uint page_size= page->size;
if (page_size < 4 || page_size > block_size || if (page_size < 4 || page_size > share->max_index_block_size ||
_ma_get_keynr(share, tmp) != keyinfo->key_nr) _ma_get_keynr(share, tmp) != keyinfo->key_nr)
{ {
DBUG_PRINT("error",("page %lu had wrong page length: %u keynr: %u", DBUG_PRINT("error",("page %lu had wrong page length: %u keynr: %u",
...@@ -159,7 +161,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info, ...@@ -159,7 +161,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
info->last_keypage = HA_OFFSET_ERROR; info->last_keypage = HA_OFFSET_ERROR;
maria_print_error(share, HA_ERR_CRASHED); maria_print_error(share, HA_ERR_CRASHED);
my_errno= HA_ERR_CRASHED; my_errno= HA_ERR_CRASHED;
tmp= 0; DBUG_RETURN(1);
} }
} }
#endif #endif
...@@ -179,6 +181,13 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock, ...@@ -179,6 +181,13 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
DBUG_ENTER("_ma_write_keypage"); DBUG_ENTER("_ma_write_keypage");
/*
The following ensures that for transactional tables we have logged
all changes that changes the page size (as the logging code sets
page->org_size)
*/
DBUG_ASSERT(!share->now_transactional || page->size == page->org_size);
#ifdef EXTRA_DEBUG /* Safety check */ #ifdef EXTRA_DEBUG /* Safety check */
{ {
uint page_length, nod_flag; uint page_length, nod_flag;
...@@ -193,7 +202,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock, ...@@ -193,7 +202,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
(page->pos & (maria_block_size-1))) (page->pos & (maria_block_size-1)))
{ {
DBUG_PRINT("error",("Trying to write inside key status region: " DBUG_PRINT("error",("Trying to write inside key status region: "
"key_start: %lu length: %lu page: %lu", "key_start: %lu length: %lu page_pos: %lu",
(long) share->base.keystart, (long) share->base.keystart,
(long) share->state.state.key_file_length, (long) share->state.state.key_file_length,
(long) page->pos)); (long) page->pos));
...@@ -201,7 +210,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock, ...@@ -201,7 +210,7 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
DBUG_ASSERT(0); DBUG_ASSERT(0);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_PRINT("page",("write page at: %lu",(long) page->pos)); DBUG_PRINT("page",("write page at: %lu",(ulong) (page->pos / block_size)));
DBUG_DUMP("buff", buff, page_length); DBUG_DUMP("buff", buff, page_length);
DBUG_ASSERT(page_length >= share->keypage_header + nod_flag + DBUG_ASSERT(page_length >= share->keypage_header + nod_flag +
page->keyinfo->minlength || maria_in_recovery); page->keyinfo->minlength || maria_in_recovery);
...@@ -274,7 +283,7 @@ int _ma_dispose(register MARIA_HA *info, my_off_t pos, my_bool page_not_read) ...@@ -274,7 +283,7 @@ int _ma_dispose(register MARIA_HA *info, my_off_t pos, my_bool page_not_read)
enum pagecache_page_lock lock_method; enum pagecache_page_lock lock_method;
enum pagecache_page_pin pin_method; enum pagecache_page_pin pin_method;
DBUG_ENTER("_ma_dispose"); DBUG_ENTER("_ma_dispose");
DBUG_PRINT("enter",("pos: %ld", (long) pos)); DBUG_PRINT("enter",("page: %lu", (ulong) (pos / block_size)));
DBUG_ASSERT(pos % block_size == 0); DBUG_ASSERT(pos % block_size == 0);
(void) _ma_lock_key_del(info, 0); (void) _ma_lock_key_del(info, 0);
...@@ -452,32 +461,48 @@ my_off_t _ma_new(register MARIA_HA *info, int level, ...@@ -452,32 +461,48 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
Log compactation of a index page Log compactation of a index page
*/ */
static my_bool _ma_log_compact_keypage(MARIA_HA *info, my_off_t page, static my_bool _ma_log_compact_keypage(MARIA_PAGE *ma_page,
TrID min_read_from) TrID min_read_from)
{ {
LSN lsn; LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 1 + TRANSID_SIZE]; uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 1 + 7 + TRANSID_SIZE];
uchar *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 1]; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 1];
MARIA_HA *info= ma_page->info;
MARIA_SHARE *share= info->s; MARIA_SHARE *share= info->s;
uint translog_parts, extra_length;
my_off_t page= ma_page->pos;
DBUG_ENTER("_ma_log_compact_keypage"); DBUG_ENTER("_ma_log_compact_keypage");
DBUG_PRINT("enter", ("page: %lu", (ulong) page)); DBUG_PRINT("enter", ("page: %lu", (ulong) (page / share->block_size)));
/* Store address of new root page */ /* Store address of new root page */
page/= share->block_size; page/= share->block_size;
page_store(log_data + FILEID_STORE_SIZE, page); page_store(log_data + FILEID_STORE_SIZE, page);
log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE]= KEY_OP_COMPACT_PAGE; log_pos= log_data + FILEID_STORE_SIZE + PAGE_STORE_SIZE;
transid_store(log_data + FILEID_STORE_SIZE + PAGE_STORE_SIZE +1,
min_read_from); log_pos[0]= KEY_OP_COMPACT_PAGE;
transid_store(log_pos + 1, min_read_from);
log_pos+= 1 + TRANSID_SIZE;
log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data; log_array[TRANSLOG_INTERNAL_PARTS + 0].str= log_data;
log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data); log_array[TRANSLOG_INTERNAL_PARTS + 0].length= (uint) (log_pos -
log_data);
translog_parts= 1;
extra_length= 0;
_ma_log_key_changes(ma_page,
log_array + TRANSLOG_INTERNAL_PARTS + translog_parts,
log_pos, &extra_length, &translog_parts);
/* Remember new page length for future log entires for same page */
ma_page->org_size= ma_page->size;
if (translog_write_record(&lsn, LOGREC_REDO_INDEX, if (translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info, info->trn, info,
(translog_size_t) sizeof(log_data), log_array[TRANSLOG_INTERNAL_PARTS +
TRANSLOG_INTERNAL_PARTS + 1, log_array, 0].length + extra_length,
log_data, NULL)) TRANSLOG_INTERNAL_PARTS + translog_parts,
log_array, log_data, NULL))
DBUG_RETURN(1); DBUG_RETURN(1);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -525,7 +550,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from) ...@@ -525,7 +550,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from)
{ {
if (!(page= (*ma_page->keyinfo->skip_key)(&key, 0, 0, page))) if (!(page= (*ma_page->keyinfo->skip_key)(&key, 0, 0, page)))
{ {
DBUG_PRINT("error",("Couldn't find last key: page: 0x%lx", DBUG_PRINT("error",("Couldn't find last key: page_pos: 0x%lx",
(long) page)); (long) page));
maria_print_error(share, HA_ERR_CRASHED); maria_print_error(share, HA_ERR_CRASHED);
my_errno=HA_ERR_CRASHED; my_errno=HA_ERR_CRASHED;
...@@ -587,7 +612,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from) ...@@ -587,7 +612,7 @@ my_bool _ma_compact_keypage(MARIA_PAGE *ma_page, TrID min_read_from)
if (share->now_transactional) if (share->now_transactional)
{ {
if (_ma_log_compact_keypage(info, ma_page->pos, min_read_from)) if (_ma_log_compact_keypage(ma_page, min_read_from))
DBUG_RETURN(1); DBUG_RETURN(1);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -1063,6 +1063,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE) ...@@ -1063,6 +1063,7 @@ prototype_redo_exec_hook(REDO_REPAIR_TABLE)
param.isam_file_name= name= info->s->open_file_name.str; param.isam_file_name= name= info->s->open_file_name.str;
param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE); param.testflag= uint8korr(rec->header + FILEID_STORE_SIZE);
param.tmpdir= maria_tmpdir; param.tmpdir= maria_tmpdir;
param.max_trid= max_long_trid;
DBUG_ASSERT(maria_tmpdir); DBUG_ASSERT(maria_tmpdir);
info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8); info->s->state.key_map= uint8korr(rec->header + FILEID_STORE_SIZE + 8);
......
...@@ -91,7 +91,8 @@ int maria_rtree_delete_key(MARIA_PAGE *page, uchar *key, uint key_length) ...@@ -91,7 +91,8 @@ int maria_rtree_delete_key(MARIA_PAGE *page, uchar *key, uint key_length)
page->size-= key_length_with_nod_flag; page->size-= key_length_with_nod_flag;
page_store_size(share, page); page_store_size(share, page);
if (share->now_transactional && if (share->now_transactional &&
_ma_log_delete(page, key_start, 0, key_length_with_nod_flag)) _ma_log_delete(page, key_start, 0, key_length_with_nod_flag,
0, KEY_OP_DEBUG_LOG_DEL_CHANGE_RT))
return -1; return -1;
return 0; return 0;
} }
......
...@@ -308,7 +308,7 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page, ...@@ -308,7 +308,7 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page,
LSN lsn; LSN lsn;
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 1 + 2 + 1 + 2 + 2 + 7], uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + 1 + 2 + 1 + 2 + 2 + 7],
*log_pos; *log_pos;
LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 5]; LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 6];
uint translog_parts, extra_length= 0; uint translog_parts, extra_length= 0;
my_off_t page_pos; my_off_t page_pos;
DBUG_ENTER("_ma_log_rt_split"); DBUG_ENTER("_ma_log_rt_split");
...@@ -344,24 +344,11 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page, ...@@ -344,24 +344,11 @@ static my_bool _ma_log_rt_split(MARIA_PAGE *page,
translog_parts+= 2; translog_parts+= 2;
} }
#ifdef EXTRA_DEBUG_KEY_CHANGES _ma_log_key_changes(page,
{ log_array + TRANSLOG_INTERNAL_PARTS + translog_parts,
int page_length= page->size; log_pos, &extra_length, &translog_parts);
ha_checksum crc; /* Remember new page length for future log entires for same page */
uchar *check_start= log_pos; page->org_size= page->size;
crc= my_checksum(0, page->buff + LSN_STORE_SIZE,
page_length - LSN_STORE_SIZE);
log_pos[0]= KEY_OP_CHECK;
log_pos++;
int2store(log_pos, page_length);
log_pos+= 2;
int4store(log_pos, crc);
log_pos+= 4;
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].str= check_start;
log_array[TRANSLOG_INTERNAL_PARTS + translog_parts].length= 7;
translog_parts++;
}
#endif
if (translog_write_record(&lsn, LOGREC_REDO_INDEX, if (translog_write_record(&lsn, LOGREC_REDO_INDEX,
info->trn, info, info->trn, info,
......
This diff is collapsed.
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#define SANITY_CHECKS 1 #define SANITY_CHECKS 1
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
#define EXTRA_DEBUG_KEY_CHANGES #define EXTRA_DEBUG_KEY_CHANGES
#define EXTRA_STORE_FULL_PAGE_IN_KEY_CHANGES
#endif #endif
#define MAX_NONMAPPED_INSERTS 1000 #define MAX_NONMAPPED_INSERTS 1000
...@@ -361,6 +362,7 @@ typedef struct st_maria_share ...@@ -361,6 +362,7 @@ typedef struct st_maria_share
uint in_trans; /* Number of references by trn */ uint in_trans; /* Number of references by trn */
uint w_locks, r_locks, tot_locks; /* Number of read/write locks */ uint w_locks, r_locks, tot_locks; /* Number of read/write locks */
uint block_size; /* block_size of keyfile & data file*/ uint block_size; /* block_size of keyfile & data file*/
uint max_index_block_size; /* block_size - end_of_page_info */
/* Fixed length part of a packed row in BLOCK_RECORD format */ /* Fixed length part of a packed row in BLOCK_RECORD format */
uint base_length; uint base_length;
myf write_flag; myf write_flag;
...@@ -833,6 +835,7 @@ typedef struct st_maria_page ...@@ -833,6 +835,7 @@ typedef struct st_maria_page
uchar *buff; /* Data for page */ uchar *buff; /* Data for page */
my_off_t pos; /* Disk address to page */ my_off_t pos; /* Disk address to page */
uint size; /* Size of data on page */ uint size; /* Size of data on page */
uint org_size; /* Size of page at read or after log */
uint node; /* 0 or share->base.key_reflength */ uint node; /* 0 or share->base.key_reflength */
uint flag; /* Page flag */ uint flag; /* Page flag */
uint link_offset; uint link_offset;
......
...@@ -363,6 +363,7 @@ TRN *trnman_new_trn(WT_THD *wt) ...@@ -363,6 +363,7 @@ TRN *trnman_new_trn(WT_THD *wt)
trn->used_tables= 0; trn->used_tables= 0;
trn->locked_tables= 0; trn->locked_tables= 0;
trn->flags= 0;
/* /*
only after the following function TRN is considered initialized, only after the following function TRN is considered initialized,
......
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