Bug #53532 RQG: internal mysqldump commands fail if mysqldump is not in PATH
Submitted: 10 May 2010 8:24
Reporter: John Embretsen Email Updates:
Status: Verified Impact on me:
Category:Tools: Random Query Generator Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Bernt Marius Johnsen CPU Architecture:Any

[10 May 2010 8:24] John Embretsen
When running the RQG with certain options/features mysqldump commands are issued in order to compare database dumps while the test is running.


From a test using the Transformer validator:

# 2010-05-06T16:52:05 Unable to run mysqldump -uroot --extended-insert=FALSE --no-set-names --compact --force --protocol=tcp --port=19300 query010883 E: No such file or directory

This apparently comes from lib/GenTest/Simplifier/Test.pm, which has:

  my $mysqldump_cmd = "mysqldump -uroot --extended-insert=FALSE --no-set-names --compact --force --protocol=tcp --port=$tcp_port $simplified_database ";
  $mysqldump_cmd .= join(' ', @participating_tables) if $#participating_tables > -1;
  open (MYSQLDUMP, "$mysqldump_cmd|") or say("Unable to run $mysqldump_cmd: $!");

If "mysqldump" is not in PATH, the command fails. It would be more robust and possibly more correct if the RQG used the mysqldump binary from the basedir under test. runall.pl is already doing something like this:

  my $dump_result = system("\"$client_basedir/mysqldump\" --hex-blob ...(etc.)

There is a similar issue in lib/GenTest/Validator/DatabaseComparator.pm it seems.

How to repeat:
Assuming there is no mysqldump in PATH: 

perl ./runall.pl \
--threads=1 \
--grammar=conf/optimizer/outer_join.yy \
--queries=10000 \
--basedir=/path/to/basedir \
--vardir=$PWD/var-transformer \
--validator=Transformer \

Observe mysqldump-related error messages during the test run.

Suggested fix:
Have all RQG modules look for binaries in the test's basedir.
[10 May 2010 8:44] Philip Stoev
Bernt, we need a Server object accessible in all contexts (including from inside the grammar), that provides access to client_basedir or to mysqldump directly.
[10 Mar 2011 5:53] Roel Van de Paar
I also get this error regularly. From a grep:

The only correct one:

runall.pl:              my $dump_result = system("\"$client_basedir/mysqldump\" --hex-blob --no-tablespaces --skip-triggers --compact --order-by-primary --skip-extended-insert --no-create-info --host= --port=$dump_ports[$i] --user=root $database | sort > $dump_files[$i]");

The ones that need fixing:

lib/GenTest/Validator/DatabaseComparator.pm:            my $mysqldump_result = system("mysqldump --compact --order-by-primary --skip-triggers --skip-extended-insert --no-create-info --host= --port=$ports[$port_id] --user=root $database | sort > $files[$port_id]");

lib/GenTest/Simplifier/Test.pm:         my $mysqldump_cmd = "mysqldump -uroot --net_buffer_length=4096 --max_allowed_packet=4096 --no-set-names --compact --force --protocol=tcp --port=$tcp_port $simplified_database ";

lib/GenTest/Reporter/BackupInterop.pm:my $mysqldump_result = system("mysqldump --compact --order-by-primary --skip-triggers --skip-extended-insert --no-create-info --host= --port=13000 --user=root $database | sort > $file_bak");

lib/GenTest/Reporter/BackupInterop.pm:  my $mysqldump_result = system("mysqldump --compact --order-by-primary --skip-triggers --skip-extended-insert --no-create-info --host=localhost --port=13000 --user=root $database | sort > $file_res");

And maybe:

lib/DBServer/MySQL/MySQLd.pm:                                          osWindows()?"mysqldump.exe":"mysqldump");
[14 Mar 2011 23:33] Roel Van de Paar
shell> sudo ln -s /your_mysql_path/bin/mysqldump /usr/bin/mysqldump