Commit 09e4e954 authored by unknown's avatar unknown

Fixed crashing bug when starting mysqld with --dbug

Fixed crash when using other maria block size than 8192
Fixed bug that caused tables to be reported as crashed if maria_log_control was deleted


mysql-test/valgrind.supp:
  Suppress leaks on SuSE 10.3, x86 64 bit
sql/mysqld.cc:
  Don't give warning in case of timeout for pthread_cond_timedwait
  Fixed crashing bug when starting mysqld with --dbug
storage/maria/ha_maria.cc:
  Fixed crash when using other block size than 8192 (Crash happend later in bitmap page handling)
storage/maria/ma_locking.c:
  When we write a new uuid for a zerofilled file, also update the lsn's
storage/maria/ma_open.c:
  Don't update lsn on open. Wait until first time file is changed
  Fixed bug that caused tables to be reported as crashed if maria_log_control was deleted
strings/strmake.c:
  Fixed warnings for strings without end 0 when running under valgrind.
parent 79ca1004
......@@ -23,6 +23,15 @@
}
{
pthread allocate_tls memory loss
Memcheck:Leak
fun:calloc
obj:/lib64/ld*.so
fun:_dl_allocate_tls
fun:pthread_create*
}
{
pthead_exit memory loss 1
Memcheck:Leak
......@@ -369,6 +378,41 @@
fun:_Z8udf_freev
}
{
dlopen / ptread_cancel_init memory loss on Suse Linux 10.3 64 bit
Memcheck:Leak
fun:*alloc
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/libc-*.so
obj:/lib64/ld-*.so
obj:/lib64/libc-*.so
fun:__libc_dlopen_mode
fun:pthread_cancel_init
fun:_Unwind_ForcedUnwind
}
{
dlopen / ptread_cancel_init memory loss on Suse Linux 10.3 64 bit
Memcheck:Leak
fun:*alloc
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/ld-*.so
obj:/lib64/libc-*.so
obj:/lib64/ld-*.so
obj:/lib64/libc-*.so
fun:__libc_dlopen_mode
fun:pthread_cancel_init
fun:_Unwind_ForcedUnwind
}
#
# These seem to be libc threading stuff, not related to MySQL code (allocations
......
......@@ -800,7 +800,7 @@ static void close_connections(void)
break;
}
#ifdef EXTRA_DEBUG
if (error != 0 && !count++)
if (error != 0 && error != ETIMEDOUT && !count++)
sql_print_error("Got error %d from pthread_cond_timedwait",error);
#endif
close_server_sock();
......@@ -7445,15 +7445,17 @@ mysqld_get_one_option(int optid,
{
switch(optid) {
case '#':
if (*argument == '0')
if (!argument)
argument= (char*) default_dbug_option;
if (argument[0] == '0' && !argument[1])
{
DEBUGGER_OFF;
break;
}
DEBUGGER_ON;
if (*argument == '1')
if (argument[0] == '1' && !argument[1])
break;
DBUG_SET_INITIAL(argument ? argument : default_dbug_option);
DBUG_SET_INITIAL(argument);
opt_endinfo=1; /* unireg: memory allocation */
break;
case 'a':
......
......@@ -2759,7 +2759,7 @@ static int ha_maria_init(void *p)
res= maria_init() || ma_control_file_create_or_open() ||
!init_pagecache(maria_pagecache,
(size_t) pagecache_buffer_size, pagecache_division_limit,
pagecache_age_threshold, MARIA_KEY_BLOCK_LENGTH, 0) ||
pagecache_age_threshold, maria_block_size, 0) ||
!init_pagecache(maria_log_pagecache,
TRANSLOG_PAGECACHE_SIZE, 0, 0,
TRANSLOG_PAGE_SIZE, 0) ||
......
......@@ -488,10 +488,10 @@ int _ma_test_if_changed(register MARIA_HA *info)
/*
Put a mark in the .MYI file that someone is updating the table
Put a mark in the .MAI file that someone is updating the table
DOCUMENTATION
state.open_count in the .MYI file is used the following way:
state.open_count in the .MAI file is used the following way:
- For the first change of the .MYI file in this process open_count is
incremented by _ma_mark_file_changed(). (We have a write lock on the file
when this happens)
......@@ -505,7 +505,6 @@ int _ma_test_if_changed(register MARIA_HA *info)
open_count is not maintained on disk for transactional or temporary tables.
*/
int _ma_mark_file_changed(MARIA_HA *info)
{
uchar buff[3];
......@@ -541,7 +540,10 @@ int _ma_mark_file_changed(MARIA_HA *info)
!(share->state.changed & STATE_NOT_MOVABLE))
{
/* Lock table to current installation */
if (_ma_set_uuid(info, 0))
if (_ma_set_uuid(info, 0) ||
(share->state.create_rename_lsn == LSN_REPAIRED_BY_MARIA_CHK &&
_ma_update_state_lsns_sub(share, translog_get_horizon(),
TRUE, TRUE)))
DBUG_RETURN(1);
share->state.changed|= STATE_NOT_MOVABLE;
}
......
......@@ -396,8 +396,12 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
goto err;
}
/*
We can ignore testing uuid if STATE_NOT_MOVABLE is set, as in this
case the uuid will be set in _ma_mark_file_changed()
*/
if ((share->state.changed & STATE_NOT_MOVABLE) &&
share->now_transactional &&
share->base.born_transactional &&
!(open_flags & HA_OPEN_IGNORE_MOVED_STATE) &&
memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE))
{
......@@ -654,7 +658,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
import into the server. It starts its existence (from the point of
view of the server, including server's recovery) now.
*/
if ((open_flags & HA_OPEN_FROM_SQL_LAYER) || maria_in_recovery)
if (((open_flags & HA_OPEN_FROM_SQL_LAYER) &&
(share->state.changed & STATE_NOT_MOVABLE)) || maria_in_recovery)
_ma_update_state_lsns_sub(share, translog_get_horizon(),
TRUE, TRUE);
}
......
......@@ -29,26 +29,38 @@
char *strmake(register char *dst, register const char *src, size_t length)
{
#ifdef EXTRA_DEBUG
/*
'length' is the maximum length of the string; the buffer needs
to be one character larger to accomodate the terminating '\0'.
This is easy to get wrong, so we make sure we write to the
entire length of the buffer to identify incorrect buffer-sizes.
We only initialise the "unused" part of the buffer here, a) for
efficiency, and b) because dst==src is allowed, so initialising
the entire buffer would overwrite the source-string. Also, we
write a character rather than '\0' as this makes spotting these
problems in the results easier.
*/
uint n= strlen(src) + 1;
if (n <= length)
memset(dst + n, (int) 'Z', length - n + 1);
#endif
while (length--)
{
if (! (*dst++ = *src++))
{
#ifdef EXTRA_DEBUG
/*
'length' is the maximum length of the string; the buffer needs
to be one character larger to accommodate the terminating
'\0'. This is easy to get wrong, so we make sure we write to
the entire length of the buffer to identify incorrect
buffer-sizes. We only initialism the "unused" part of the
buffer here, a) for efficiency, and b) because dst==src is
allowed, so initializing the entire buffer would overwrite the
source-string. Also, we write a character rather than '\0' as
this makes spotting these problems in the results easier.
If we are using purify/valgrind, we only set one character at
end to be able to detect also wrong accesses after the end of
dst.
*/
if (length)
{
#ifdef HAVE_purify
dst[length-1]= 'Z';
#else
bfill(dst, length-1, (int) 'Z');
#endif /* HAVE_purify */
}
#endif /* EXTRA_DEBUG */
return dst-1;
}
}
*dst=0;
return dst;
}
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