> -----Original Message-----
> From: Tor Didriksen [mailto:tor.didriksen@stripped]
> Sent: Wednesday, September 29, 2010 9:25 AM
> To: commits@stripped
> Subject: bzr commit into mysql-next-mr-bugfixing branch (tor.didriksen:3305)
> Bug#52002
>
> #At file:///export/home/didrik/repo/next-mr-bf-binlogcore/ based on
> revid:alik@stripped
>
> 3305 Tor Didriksen 2010-09-29
> Bug#52002 binlog_index may cause incorrect failure report on failing test that
> follows it
>
> For crash testing: kill the server without generating core file.
> @ include/my_dbug.h
> Use kill(getpid(), SIGKILL) which cannot be caught by signal handlers.
> All DBUG_XXX macros should be no-ops in optimized mode, do that for
> DBUG_ABORT as well.
> @ sql/binlog.cc
> Kill server without generating core.
> @ sql/handler.cc
> Kill server without generating core.
> @ unittest/gunit/CMakeLists.txt
> Add unit test.
> @ unittest/gunit/dbug-t.cc
> Add unit test.
>
> added:
> unittest/gunit/dbug-t.cc
> modified:
> include/my_dbug.h
> sql/binlog.cc
> sql/handler.cc
> unittest/gunit/CMakeLists.txt
> === modified file 'include/my_dbug.h'
> --- a/include/my_dbug.h 2010-07-15 11:16:06 +0000
> +++ b/include/my_dbug.h 2010-09-29 07:24:36 +0000
> @@ -16,6 +16,14 @@
> #ifndef _dbug_h
> #define _dbug_h
>
> +#ifdef HAVE_SYS_TYPES_H
> +#include <sys/types.h>
> +#endif
Hi Tor,
since you do not use signals on Windows (as there is no kill() there ), you do not really
need to include that header, right ?
Neither sys/types.h above , if I understand it correctly.
> +#ifndef __WIN__
> +#include <signal.h>
> +#endif
>
> +/*
> + Make the program fail, without creating a core file.
> + abort() will send SIGABRT which (most likely) generates core.
> + Use SIGKILL instead, which cannot be caught.
> + An alternative would be to use _exit(EXIT_FAILURE),
> + but then valgrind would report lots of memory leaks.
> + */
Somehow I'm unhappy with valgrind workarounds, it obfuscates of correct code in order to
please the tool, but well. I cannot propose
anything better either.
> +#ifdef __WIN__
> +#define DBUG_SUICIDE() DBUG_ABORT()
> +#else
> +#define DBUG_SUICIDE() (_db_flush_(), kill(getpid(), SIGKILL))
> +#endif
> +