Bug #29803 mysqlslap plays file from --query one extra time than specified with --iteration
Submitted: 14 Jul 2007 21:47 Modified: 29 Aug 2007 1:50
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Brian Aker CPU Architecture:Any

[14 Jul 2007 21:47] Tobias Asplund
Description:
mysqlslap when given a filename plays that file one more time than it should, which renders it unusable in scenarios where you have unique constraints and want to run any kind of multi-query test.

How to repeat:
Create a file with:
INSERT INTO bugtest VALUES (1);
in.

-- in the `test` database, create a table:
CREATE TABLE bugtest (
  col INT PRIMARY KEY
);

then run mysqlslap:
mysqlslap --create-schema=test --iterations=1 --concurrency=1
It will not error out with a duplicate key error.
[16 Jul 2007 8:59] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please read how to use mysqlslap at http://dev.mysql.com/doc/refman/5.1/en/mysqlslap.html
[16 Jul 2007 11:38] Tobias Asplund
Note:

If you put the query itself in --query="query..." it will run once.
If you put the file with only that one query in in --query="file" it will run twice.
[16 Jul 2007 11:50] Sveta Smirnova
Thank you for the report.

Verified as described in last comment.

First description should ends with: "It will error out with a duplicate key error." or "It should not error out with a duplicate key error."
[9 Aug 2007 20: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/32329

ChangeSet@1.2570, 2007-08-09 13:01:29-07:00, brian@piggy.tangent.org +2 -0
  Two bugs in one! The count call was duplicating internally the counts for loaded tests (not autosql tests, just loaded). This could manifest itself by executing by file, or by executing a pre statement.
  BUG#29803
[27 Aug 2007 22:03] Bugs System
Pushed into 5.1.23-beta
[29 Aug 2007 1:50] Paul DuBois
Noted in 5.1.23 changelog.

When mysqlslap was given a query to execute from a file via a
--query=file_name option, it executed the query one too many times.
[10 Oct 2007 20:13] Sveta Smirnova
Bug #31432 was marked as duplicate of this one.