Commit 05ed9fec authored by Monty's avatar Monty

Use MEM_CHECK_DEFINED to check if blocks contain uninitialized data

Fixed failure in tests when running optimized code
- Some assert() was using code that had to be executed
Fixed copying of some uninitialized data (fixed valgrind warning)
parent e3868ee0
......@@ -219,13 +219,8 @@ my_bool _ma_write_keypage(MARIA_PAGE *page, enum pagecache_page_lock lock,
/* Verify that keynr is correct */
DBUG_ASSERT(_ma_get_keynr(share, buff) == page->keyinfo->key_nr);
#if defined(EXTRA_DEBUG) && defined(HAVE_valgrind) && defined(NOT_ANYMORE)
{
/* This is here to catch uninitialized bytes */
uint length= page->size;
ulong crc= my_checksum(0, buff, length);
int4store(buff + block_size - KEYPAGE_CHECKSUM_SIZE, crc);
}
#if defined(EXTRA_DEBUG) && defined(HAVE_valgrind) && defined(WHEN_DEBUGGING)
MEM_CHECK_DEFINED(buff, block_size);
#endif
page_cleanup(share, page);
......
......@@ -309,7 +309,7 @@ static int run_test(const char *filename)
}
/* Read through all rows and update them */
assert(maria_scan_init(file) == 0);
maria_scan_init(file);
found=0;
while ((error= maria_scan(file,read_record)) == 0)
......
......@@ -665,7 +665,7 @@ int main(int argc, char *argv[])
if (!silent)
puts("- Test if: Read rrnd - same");
DBUG_PRINT("progpos",("Read rrnd - same"));
assert(maria_scan_init(file) == 0);
maria_scan_init(file);
for (i=0 ; i < write_count ; i++)
{
int tmp;
......@@ -818,7 +818,7 @@ int main(int argc, char *argv[])
}
}
ant=0;
assert(maria_scan_init(file) == 0);
maria_scan_init(file);
while ((error= maria_scan(file,record)) != HA_ERR_END_OF_FILE &&
ant < write_count + 10)
ant+= error ? 0 : 1;
......
......@@ -1319,7 +1319,7 @@ static int _ma_balance_page(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
pos= right_page->buff + share->keypage_header + length;
memcpy(father_key_pos, pos, (size_t) k_length);
bmove(right_page->buff + share->keypage_header,
pos + k_length, new_right_length);
pos + k_length, new_right_length - share->keypage_header);
if (share->now_transactional)
{
......
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