Commit 63cd7bdc authored by unknown's avatar unknown

Fixed errors found by valgrind

Changed bitmaps to be written before unpinning of pages in write_block_record()
Log handler now assumes we never call it for not transactional tables
Fixed bug in ma_test_all that caused it to fail


sql/unireg.cc:
  Removed 'at', as this makes it hard to find valgrind errors from the debug log
storage/maria/ma_blockrec.c:
  Changed bzero() of blocks to get rid of a (non critical) valgrind error
  Changed bitmaps to be written before unpinning of pages in write_block_record()
  fixed that we don't log tails if table isn't transactional
storage/maria/ma_key_recover.c:
  Fixed wrong log_data[] that caused us to log uninitialized data
storage/maria/ma_loghandler.c:
  Replaced not needed test with DBUG_ASSERT()
storage/maria/ma_test_all.sh:
  Remove control file if block size changes
parent 9f1aaeff
......@@ -471,7 +471,7 @@ static uint pack_keys(uchar *keybuff, uint key_count, KEY *keyinfo,
int2store(pos+6, key->block_size);
pos+=8;
key_parts+=key->key_parts;
DBUG_PRINT("loop", ("flags: %d key_parts: %d at 0x%lx",
DBUG_PRINT("loop", ("flags: %d key_parts: %d key_part: 0x%lx",
key->flags, key->key_parts,
(long) key->key_part));
for (key_part=key->key_part,key_part_end=key_part+key->key_parts ;
......
......@@ -1224,8 +1224,7 @@ static void make_empty_page(MARIA_HA *info, uchar *buff, uint page_type)
The code does not assume the block is zeroed.
*/
if (page_type != BLOB_PAGE)
bzero(buff+ PAGE_HEADER_SIZE, block_size - PAGE_HEADER_SIZE -
DIR_ENTRY_SIZE - PAGE_SUFFIX_SIZE);
bzero(buff+ PAGE_HEADER_SIZE, block_size - PAGE_HEADER_SIZE);
#endif
buff[PAGE_TYPE_OFFSET]= (uchar) page_type;
buff[DIR_COUNT_OFFSET]= 1;
......@@ -1388,6 +1387,7 @@ static my_bool write_tail(MARIA_HA *info,
memcpy(row_pos.data, row_part, length);
if (share->now_transactional)
{
/* Log changes in tail block */
uchar log_data[FILEID_STORE_SIZE + PAGE_STORE_SIZE + DIRPOS_STORE_SIZE];
......@@ -1541,7 +1541,7 @@ static my_bool write_full_pages(MARIA_HA *info,
#ifdef IDENTICAL_PAGES_AFTER_RECOVERY
if (copy_length != data_size)
bzero(buff + block_size - PAGE_SUFFIX_SIZE - (data_size - copy_length),
(data_size - copy_length));
(data_size - copy_length) + PAGE_SUFFIX_SIZE);
#endif
if (!(info->s->options & HA_OPTION_PAGE_CHECKSUM))
......@@ -1558,7 +1558,7 @@ static my_bool write_full_pages(MARIA_HA *info,
0, info->trn->rec_lsn))
DBUG_RETURN(1);
page++;
block->used= BLOCKUSED_USED;
DBUG_ASSERT(block->used & BLOCKUSED_USED);
}
DBUG_RETURN(0);
}
......@@ -2560,6 +2560,9 @@ static my_bool write_block_record(MARIA_HA *info,
}
}
}
/* Release not used space in used pages */
if (_ma_bitmap_release_unused(info, bitmap_blocks))
goto disk_err;
_ma_unpin_all_pages(info, lsn);
if (tmp_data_used)
......@@ -2595,9 +2598,6 @@ static my_bool write_block_record(MARIA_HA *info,
goto disk_err;
block+= block->sub_blocks;
}
/* Release not used space in used pages */
if (_ma_bitmap_release_unused(info, bitmap_blocks))
goto disk_err;
_ma_finalize_row(info);
DBUG_RETURN(0);
......
......@@ -72,8 +72,7 @@ my_bool _ma_write_clr(MARIA_HA *info, LSN undo_lsn,
my_bool store_checksum, ha_checksum checksum,
LSN *res_lsn, void *extra_msg)
{
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE +
PAGE_STORE_SIZE + DIRPOS_STORE_SIZE +
uchar log_data[LSN_STORE_SIZE + FILEID_STORE_SIZE + CLR_TYPE_STORE_SIZE +
HA_CHECKSUM_STORE_SIZE];
LEX_STRING log_array[TRANSLOG_INTERNAL_PARTS + 1];
struct st_msg_to_write_hook_for_clr_end msg;
......
......@@ -5185,11 +5185,7 @@ my_bool translog_write_record(LSN *lsn,
if (tbl_info)
{
MARIA_SHARE *share= tbl_info->s;
if (!share->now_transactional)
{
DBUG_PRINT("info", ("It is not transactional table"));
DBUG_RETURN(0);
}
DBUG_ASSERT(share->now_transactional);
if (unlikely(share->id == 0))
{
/*
......
......@@ -113,12 +113,16 @@ run_tests()
$maria_path/maria_chk$suffix -sm test2
$maria_path/ma_test2$suffix $silent -D -B -c $row_type
$maria_path/maria_chk$suffix -sm test2
rm -f maria_log_control maria_log.*
$maria_path/ma_test2$suffix $silent -m10000 -e4096 -K $row_type
$maria_path/maria_chk$suffix -sm test2
rm -f maria_log_control maria_log.*
$maria_path/ma_test2$suffix $silent -m10000 -e8192 -K $row_type -P
$maria_path/maria_chk$suffix -sm test2
rm -f maria_log_control maria_log.*
$maria_path/ma_test2$suffix $silent -m10000 -e16384 -E16384 -K -L $row_type
$maria_path/maria_chk$suffix -sm test2
rm -f maria_log_control maria_log.*
$maria_path/ma_test2$suffix $silent -c -b65000 $row_type
$maria_path/maria_chk$suffix -se test2
}
......
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