summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2008-03-04 17:13:34 +0200
committerunknown <monty@mysql.com/narttu.mysql.fi>2008-03-04 17:13:34 +0200
commit09e4e954c36663bb7824b9b8b5daff706f53a2a6 (patch)
tree9e10c98a209dd0ecefc7b4e3b81d5c549ec3c088
parent79ca1004cb5c5470569e03f6200b351a3e390bbc (diff)
downloadmariadb-git-09e4e954c36663bb7824b9b8b5daff706f53a2a6.tar.gz
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.
-rw-r--r--mysql-test/valgrind.supp44
-rw-r--r--sql/mysqld.cc10
-rw-r--r--storage/maria/ha_maria.cc2
-rw-r--r--storage/maria/ma_locking.c10
-rw-r--r--storage/maria/ma_open.c9
-rw-r--r--strings/strmake.c46
6 files changed, 93 insertions, 28 deletions
diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp
index 52f800cb16f..1335ea10fc5 100644
--- a/mysql-test/valgrind.supp
+++ b/mysql-test/valgrind.supp
@@ -24,6 +24,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
fun:malloc
@@ -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
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 36dda2a4178..b2d2f4cae92 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -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':
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index e9d47c4b4f3..76e036be3cb 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -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) ||
diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c
index 1569e7bbcd5..4476cf1decf 100644
--- a/storage/maria/ma_locking.c
+++ b/storage/maria/ma_locking.c
@@ -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;
}
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index 9df0bf4e830..a3fcac91d9a 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -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);
}
diff --git a/strings/strmake.c b/strings/strmake.c
index df8d78e8476..903a1b83626 100644
--- a/strings/strmake.c
+++ b/strings/strmake.c
@@ -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;
}