Bug #58296 MTR does no create error log if run with manual-gdb
Submitted: 18 Nov 2010 18:09 Modified: 12 Jan 2011 11:55
Reporter: Sveta Smirnova Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.1-bzr OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[18 Nov 2010 18:09] Sveta Smirnova
Description:
If run MTR with manual-gdb option error log file contains only information about which test were run, but not usual mysqld error log file content.

How to repeat:
$./mtr alias
Logging: ./mtr  alias
101118 19:02:52 [Note] Plugin 'FEDERATED' is disabled.
101118 19:02:52 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.1.54
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var'...
Installing system database...
Using server port 55261

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.alias                               [ pass ]     63
------------------------------------------------------------
The servers were restarted 0 times
Spent 0.063 of 2 seconds executing testcases

Completed: All 1 tests were successful.

$cat var/log/mysqld.1.err
CURRENT_TEST: main.alias
101118 21:02:53 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
101118 21:02:53 [Note] Plugin 'FEDERATED' is disabled.
101118 21:02:53 [Note] Plugin 'InnoDB' is disabled.
101118 21:02:53 [Note] Plugin 'ndbcluster' is disabled.
101118 21:02:53 [Note] Event Scheduler: Loaded 0 events
101118 21:02:53 [Note] /users/ssmirnova/blade12/src/mysql-5.1/sql/mysqld: ready for connections.
Version: '5.1.54-debug-log'  socket: '/users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var/tmp/mysqld.1.sock'  port: 13000  Source distribution
101118 21:02:54 [Note] Got signal 15 to shutdown mysqld
101118 21:02:54 [Note] /users/ssmirnova/blade12/src/mysql-5.1/sql/mysqld: Normal shutdown

101118 21:02:54 [Note] Event Scheduler: Purging the queue. 0 events
101118 21:02:54 [Note] Debug sync points hit:                   255
101118 21:02:54 [Note] Debug sync points executed:              0
101118 21:02:54 [Note] Debug sync points max active per thread: 0
101118 21:02:54 [Note] /users/ssmirnova/blade12/src/mysql-5.1/sql/mysqld: Shutdown complete

$./mtr alias --manual-gdb
Logging: ./mtr  alias --manual-gdb
101118 19:04:11 [Note] Plugin 'FEDERATED' is disabled.
101118 19:04:11 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.1.54
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Using "../libtool" when running valgrind or debugger
Collecting tests...
vardir: /users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var'...
Installing system database...
Using server port 38026

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009

To start gdb for mysqld.1, type in another window:
gdb -cd /users/ssmirnova/blade12/src/mysql-5.1/mysql-test -x /users/ssmirnova/blade12/src/mysql-5.1/mysql-test/var/tmp/gdbinit.mysqld.1 /users/ssmirnova/blade12/src/mysql-5.1/sql/mysqld
main.alias                               [ pass ]   2001
------------------------------------------------------------
The servers were restarted 0 times
Spent 2.001 of 9 seconds executing testcases

Completed: All 1 tests were successful.

$cat var/log/mysqld.1.err
CURRENT_TEST: main.alias
[2 Dec 2010 14:00] Bjørn Munch
This would be doable, but I'm not sure it is desirable. I would think the debugger (the person I mean) would prefer to get errors and warnings shown in the debugger window? You can't have both.

The lines with CURRENT_TEST are written by mtr, not the server.
[2 Dec 2010 17:19] Sveta Smirnova
Correct.

Feel free to close it as !Bg

I created this after tested some replication bug where I needed to see errors in slave error log, but was interesting in breakpoints only in master. I could turn logging option in gdb though.
[3 Dec 2010 9:06] Bjørn Munch
There are three ways to achieve what you want from the current mtr:

1) Add --mysqld==-log-error=<path> to the mtr command line. For some reason, the path must be the full path starting with /, a relative path seems to end up nowhere.

2) The above will affect both servers if you run both master and slave. You can also manually add the --log-error to the gdbinit.mysqld.1 (or .2) file before running the gdb command.

3) Finally, the --log-error may be added to <test>-master.opt or <test>-slave.opt. But please make sure not to commit any such changes!

While the existing behavior wasn't coded for but just comes as a consequence of the implementation, it's also IMHO the most useful one. And it can be overridden; should we implement automatic redirection to the error log, I don't know if it would be possible to revert that back to stdout.
[12 Jan 2011 11:55] Bjørn Munch
Closing to get it off my list.