Bug #45367 mtr --start-and-exit does not always start mysqld with correct options
Submitted: 8 Jun 2009 10:27 Modified: 27 Oct 2009 13:12
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:6.0.12-alpha OS:Any
Assigned to: John Embretsen CPU Architecture:Any

[8 Jun 2009 10:27] Olav Sandstå
Description:
In some situations MTR does not correctly handle arguments that should be given to mysqld. If MTR_VERSION is set to 1 and the following command is run:

  ./mysql-test-run.pl --start-and-exit --mysqld=--falcon_page_size=2K

then --falcon_page_size=2K is not given to mysqld on the initial mysqld start-up. 

It seems like MTR starts mysqld two times. On the second start the correct argument is given to mysqld but at this time it is "too late" since the data devices are already created using the default page size.

How to repeat:
1. Set the MTR VERSION to 1 (to get support for --start-and-exit.

2. Start MTR like this:

   ./mysql-test-run.pl --start-and-exit --mysqld=--falcon_page_size=2K

This should give a Falcon database that uses 2K data pages but it now results in the default page size of 4K.
[9 Jun 2009 6:59] Sveta Smirnova
Thank you for the report.

When I try to repeat it I get:

$MTR_VERSION=1  ./mysql-test-run.pl --start-and-exit --mysqld=--falcon_page_size=2K
=======================================================
  WARNING: Using mysql-test-run.pl version 1!  
=======================================================
Logging: lib/v1/mysql-test-run.pl --start-and-exit --mysqld=--falcon_page_size=2K
090609  8:57:47 [Warning] Forcing shutdown of 2 plugins
MySQL Version 6.0.12
Using dynamic switching of binlog format
Using ndbcluster when necessary, mysqld supports it
Setting mysqld to support SSL connections
Binaries are debug compiled
mysql-test-run: WARNING: Could not find all required instance manager binaries, all im tests will fail, use --skip-im to continue without instance manager
Use of uninitialized value in scalar assignment at lib/v1/mysql-test-run.pl line 1956.
Using MTR_BUILD_THREAD      = 0
Using MASTER_MYPORT         = 9306
Using MASTER_MYPORT1        = 9307
Using SLAVE_MYPORT          = 9308
Using SLAVE_MYPORT1         = 9309
Using SLAVE_MYPORT2         = 9310
Using NDBCLUSTER_PORT       = 9311
Using NDBCLUSTER_PORT_SLAVE = 9312
Using IM_PORT               = 9313
Using IM_MYSQLD1_PORT       = 9314
Using IM_MYSQLD2_PORT       = 9315
mysql-test-run: *** ERROR: opt file referense $SIMPLE_PARSER_OPT that is unknown

Which tree do you use?
[9 Jun 2009 14:10] John Embretsen
Sveta, the issue you are observing (SIMPLE_PARSER_OPT) is Bug#42586 which is set to "Won't fix". The workaround is to specify a test when using --start-and-exit, e.g.

./mysql-test-run.pl --start-and-exit --mysqld=--falcon_page_size=2K alias

That said, this seems to me like another case of Bug#41502 (MTR v2 should not load plugins during server bootstrap) which is closed and is fixed (by me) for MTR2, but not with MTR_VERSION=1. 

I did not implement the fix for MTR_VERSION=1 back then because it would not work anyway when multiple tests where run in succession, each using different static settings (e.g. falcon_page_size). I did not think of the --start-and-exit option, but the fix will most likely work. I can do some more testing and possibly implement the fix, as described in Bug#41014 and Bug#41502, hence assigning to myself.

The issue cannot be verified by executing a SHOW VARIABLES query due to Bug#41331 (SHOW VARIABLES should report values used by Falcon instead of ignored
values). Instead, one has to inspect page headers in a debugger as Olav has indicated, or try to create a special table as described in Bug#41331:

CREATE TABLE t1(a VARCHAR(140) CHARACTER SET utf8, KEY(a)) ENGINE=falcon;

(this should fail for 2K page size, but be OK for 4K (default) page size).
[9 Jun 2009 14:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/75906

2722 John H. Embretsen	2009-06-09
      Fix for Bug#45367 (mtr --start-and-exit does not always start mysqld with correct options).
      This patch adds --loose-skip-falcon to MTR's bootstrap options when MTR_VERSION=1.
      This makes it possible to use (set) non-default static Falcon options such as falcon_page_size when actually starting mysqld for the first time after bootstrap (otherwise the default value is used and set during bootstrap).
      See also MTR bug 41502.