Bug #44412 mysqlslap ignores --csv flag without a filename
Submitted: 22 Apr 2009 20:42 Modified: 8 Aug 2009 0:03
Reporter: philip antoniades Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:Ver 1.0 Distrib 5.1.31sp1 OS:Linux (unknown-linux-gnu (x86_64) )
Assigned to: Jim Winstead CPU Architecture:Any
Tags: on Fedora 10 x86_64

[22 Apr 2009 20:42] philip antoniades
Description:
Per the man pages:

--csv[=file_name]

Generate output in comma-separated values format. The output goes to the named file, or to the standard output if no file is given. This option was added in MySQL 5.1.5. 

Yet it produces normally formatted results with just the --csv parameter passed in. 

How to repeat:
 mysqlslap  -uroot -p -a -i 1 --csv

On my machine this produces:

 $ mysqlslap  -uroot -p -a -i 1 --csv 
Enter password: 
Benchmark
	Average number of seconds to run all queries: 0.004 seconds
	Minimum number of seconds to run all queries: 0.004 seconds
	Maximum number of seconds to run all queries: 0.004 seconds
	Number of clients running queries: 1
	Average number of queries per client: 0

However with --csv=mytest.csv, the file mytest.csv looks like this:
philip@sonny ~ $ mysqlslap  -uroot -p -a -i 1 --csv=mytest.csv
Enter password: 
philip@sonny ~ $ cat mytest.csv 
,mixed,0.004,0.004,0.004,1,0

Suggested fix:
Make the option write csv to standard out when no file name provided, per documentation. Helpful for scripting.
[22 Apr 2009 23:59] MySQL Verification Team
Thank you for the bug report. Verified as described.
[19 May 2009 1:24] 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/74439

2900 Jim Winstead	2009-05-18
      mysqlslap didn't correctly handle --csv with no argument. (Bug #44412)
      modified:
        client/mysqlslap.c
[14 Jul 2009 17:22] Jim Winstead
Pushed to 5.1-bugteam and mysql-pe.
[4 Aug 2009 19:49] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090804194615-h40sa098mx4z49qg) (version source revid:jimw@mysql.com-20090714171651-ziq080rkon3u244l) (merge vers: 5.4.4-alpha) (pib:11)
[4 Aug 2009 20:45] Bugs System
Pushed into 5.1.38 (revid:davi.arnaut@sun.com-20090804204317-ggodqkik7de6nfpz) (version source revid:davi.arnaut@sun.com-20090804204317-ggodqkik7de6nfpz) (merge vers: 5.1.38) (pib:11)
[8 Aug 2009 0:03] Paul DuBois
Noted in 5.1.38, 5.4.4 changelogs.

mysqlslap ignored the --csv option if it was given without an
argument.
[12 Aug 2009 22:35] Paul DuBois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 1:52] Paul DuBois
Ignore previous comment about 5.4.2.
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[7 Oct 2009 20:25] Paul DuBois
The 5.4 fix has been pushed to 5.4.2.