Bug #42444 main.change_user: result from com_select differs between embedded and other runs
Submitted: 29 Jan 2009 10:23 Modified: 30 Jan 2009 18:09
Reporter: Luis Soares Email Updates:
Status: Closed Impact on me:
None 
Category:Tests: Replication Severity:S7 (Test Cases)
Version:6.0-rpl OS:Any
Assigned to: Luis Soares CPU Architecture:Any
Tags: 6.0-rpl-green, pushbuild, test failure

[29 Jan 2009 10:23] Luis Soares
Description:
Failure:
  The change_user test fails in 6.0-rpl trees in embedded modes.

Why:
  At some point, SHOW GLOBAL STATUS LIKE 'com_select'; returns 114 (in embedded mode) instead of 119.

DETAILS:

Going through the test file one finds that inside there are:

  * 14 query logged SELECTS altogether before the change_user test (belonging to previous test cases in the test file)
  * 100 not query logged SELECTS in a loop

The total amount of SELECTS accounts to 114 as got in the embedded run. However, in other runs (eg, n_mix, ps_row), the
SHOW instruction gets 119.

Faulty behavior:

main.change_user                         [ fail ]
        Test ended at 2009-01-26 20:53:46

CURRENT_TEST: main.change_user
--- /data0/pushbuild/pb2/pb/bzr_mysql-6.0-rpl/154/mysql-6.0.10-alpha-pb154/mysql-test/r/change_user.result	2009-01-26 20:01:20.000000000 +0300
+++ /data0/pushbuild/pb2/pb/bzr_mysql-6.0-rpl/154/mysql-6.0.10-alpha-pb154/mysql-test/r/change_user.reject	2009-01-26 22:53:46.468570412 +0300
@@ -53,7 +53,7 @@
 FLUSH STATUS;
 SHOW GLOBAL STATUS LIKE 'com_select';
 Variable_name	Value
-Com_select	119
+Com_select	114
 SHOW GLOBAL STATUS LIKE 'com_select';
 Variable_name	Value
-Com_select	119
+Com_select	114

mysqltest: Result content mismatch

How to repeat:
https://intranet.mysql.com/secure/pushbuild/showpush.pl?dir=bzr_mysql-6.0-rpl&order=154

debx86-b: embedded
pb-valgrind: embedded
sapsrv1: embedded
sapsrv2: embedded
sol10-amd64-a: embedded
vm-win2003-32-a: embedded
vm-win2003-64-b: embedded
win2003-x86: embedded

http://tinyurl.com/b3z97k
[29 Jan 2009 10:25] Luis Soares
OBSERVATIONS
------------

  --> 1. This test passes in main trees both in embedded and other runs with value 114 (according to my 6.0-main local clone).

  --> 2. I digged into this and by setting a SHOW GLOBAL STATUS LIKE com_select'; as the first instruction in the test file, ie, before any select is done, the result obtained when running the test in -rpl trees is the following:

     * RUNNING IN EMBEDDED MODE

       ./mtr --embedded change_user

       (...)

       +SHOW GLOBAL STATUS LIKE 'com_select';
       +Variable_name	Value
       +Com_select	0

     * RUNNING IN OTHER MODE

       ./mtr change_user

       (...)

       +SHOW GLOBAL STATUS LIKE 'com_select';
       +Variable_name	Value
       +Com_select	5

  --> 3. There is a "--force-restart" in the  t/change_user-master.opt file, which I assume it states that the server should be restarted before running the test (so that global server variables get reset!?).

  --> 4. I started the server manually and as first instruction I issued the SHOW command in a mysql shell. Got the following:

mysql> SHOW GLOBAL STATUS LIKE 'com_select';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| Com_select    | 1     |
+---------------+-------+
1 row in set (0.00 sec)

CONCLUSION
----------

 a) From 2. and 3. I get the impression that mtr is doing some selects after starting a mysqld instance. This does not seem to happen in embedded mode, thence the difference (embedded: 0, other: 5).

 b) From 4. I get the impression that some other select is happening behind the curtains either when mysql client connects to the server (just to be sure, running SHOW GLOBAL STATUS LIKE 'com_select' several times we get the same value, so ruling out that some select happens on behalf of the SHOW command).
[29 Jan 2009 10:26] Luis Soares
After discuss this with magnus, he said that:

"The difference is probably that "check_testcase" is not run in embedded mode."
[29 Jan 2009 10:40] 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/64434

2805 Luis Soares	2009-01-29
      BUG#42444: main.change_user: result from com_select differs between embedded and other runs
      
      In 6.0-rpl this test was failing when mtr was running tests in embedded mode.
      
      This happened because when in embedded mode, mtr does run "check_testcase" which seems to cause
      extra selects. Since this test case relies on SHOW GLOBAL STATUS LIKE 'com_select'; for passing
      this will get different values whether mtr is run in embedded mode or other modes.
      
      This patch address this issue by making the part of the test dependent from SHOW GLOBAL STATUS LIKE 'com_select'; 
      to work with relative instead of absolute values (have a test start timestamp and then 
      subtract it in the checks).
[29 Jan 2009 11:05] 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/64438

2805 Luis Soares	2009-01-29
      BUG#42444: main.change_user: result from com_select differs between embedded and other runs
            
      In 6.0-rpl this test was failing when mtr was running tests in embedded mode.
            
      This happened because when in embedded mode, mtr does run "check_testcase" which
      seems to cause extra selects. Since this test case relies on:
      
      SHOW GLOBAL STATUS LIKE 'com_select';
      
      for passing, this will get different values whether mtr is run in embedded 
      mode or other modes, therefore the test failure surfaces.
            
      This patch address this issue by making the part of the test dependent from 
      SHOW GLOBAL STATUS LIKE 'com_select'; to work with relative instead of 
      absolute values (have a test start timestamp and then subtract it in 
      the checks).
[30 Jan 2009 13:27] Bugs System
Pushed into 6.0.10-alpha (revid:luis.soares@sun.com-20090129165607-wiskabxm948yx463) (version source revid:luis.soares@sun.com-20090129163120-e2ntks4wgpqde6zt) (merge vers: 6.0.10-alpha) (pib:6)
[30 Jan 2009 18:09] Paul DuBois
Test case changes. No changelog entry needed.