Bug #16646 mysql-test-run.pl ignores --socket , when not running in --extern mode
Submitted: 19 Jan 2006 18:18 Modified: 19 Jan 2006 18:19
Reporter: Matthias Leich Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version: OS:Any (4.1)
Assigned to: CPU Architecture:Any

[19 Jan 2006 18:18] Matthias Leich
Description:
mysql-test-run.pl:
If I initiate the databases and start a MySQL server
      ./mysql-test-run.pl --socket=/tmp/weg .... --start-and-exit
or  do the same but start some tests
      ./mysql-test-run.pl --socket=/tmp/weg ....
any socket setting will be ignored.
It is neither documented that this will be ignored nor comes
a message about this fact.
So this bug report is a bit more than a pure change request.
Example:
./mysql-test-run.pl --socket=/tmp/weg --master_port=9999 
                             --skip-ndb  --start-and-exit

matthias@three:..../mysql-test> ps -elf | grep mysqld
0 S matthias ...........
/home/matthias/Arbeit/mysql-5.0/src-Z/sql/mysqld
 ......
--socket=/home/matthias/Arbeit/mysql-5.0/src-Z/mysql-test/var/tmp/master.sock
 ......

I assume the problem comes from the following source lines:
  if ( $opt_extern )
  {
    $glob_use_running_server=  1;
    $opt_skip_rpl= 1;                   # We don't run rpl test cases
    $master->[0]->{'path_mysock'}=  $opt_socket;
  }

The problem disappears, when
    $master->[0]->{'path_mysock'}=  $opt_socket;
is moved out of the "if ( $opt_extern )".

This solution runs fine in the following situations
1. ./mysql-test-run.pl --socket=/tmp/weg --master_port=9999 
                                --skip-ndb  --start-and-exit
2. "Simple" standard testcases in extern mode
    ./mysql-test-run.pl --socket=/tmp/weg --master_port=9999 
                                --skip-ndb --extern alias null 
3. Replication testcases might be critical when using custom
    socket settings, but there is no problem, because 
    --extern causes that these tests are omitted.
    ./mysql-test-run.pl  --socket=/tmp/weg --master_port=9999
                                --force --extern --do-test=rpl
4. Full regression test:
    
    All tests pass except  "query_cache_notembedded"  which fails
    on two connects
       connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock);
    I replaced 'master.sock' by   $MASTER_MYSOCK and it immediately
    helped.
     
My environment:
   - Intel PC with Linux(SuSE 9.3)
   - MySQL compiled from source
         4.1, 5.0, 5.1 last ChangeSet around 2006-01-17
   I analyzed the bug within MySQL 5.1.
   A colleague had the same problem with MySQL 5.0.
   I assume that the 4.1 version of mysql-test-run.pl 
   shows the same behaviour, because it contains
   similar code setting the socket.

How to repeat:
Please start mysql-test-run.pl with the options mentioned above.

Suggested fix:
I think a fix of this problem in MySQL 4.1 is not needed,
but in 5.0 it would give significant benefits.