On 2010-09-30 08:24, Sergei Golubchik wrote:
> Hi, Tor!
> On Sep 30, Tor Didriksen wrote:
>>>>> + 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.
>> Well, mtr isn't really designed for crash/recovery testing. For the
>> test cases involved here, I think it is better to simply kill the
>> server immediately, rather than to do a normal exit.
> mtr is will used for crash/recovery testing.
> Note that you simply cannot use exit() - it will execute destructors of
> the statically allocated objects, so the state will be different from
> "quit here, I said, immediately".
my alternative implementation would be _exit(), which does not run any
> In particular - I'm not sure it's the case now, but it was earlier -
> MYSQL_LOG_BIN closes binlogs in the destructor and marks them as
> "properly closed". Thus there is no XA crash recovery on startup,
> because, according to binlog, mysqld was shut down gracefully.
Static objects are evil, especially in multi-threaded programs.
> In that sense kill -9 is the most close to power failure.
Which is exactly what I'm doing :-)