Bug #57701 StatementsTest.testBatchRewriteErrors causes false negative
Submitted: 25 Oct 2010 0:54 Modified: 28 Oct 2010 13:59
Reporter: Elena Stepanova Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.13 OS:Any
Assigned to: CPU Architecture:Any

[25 Oct 2010 0:54] Elena Stepanova
StatementsTest.testBatchRewriteErrors inserts several batches of values into a table with a primary key. First 4096 values are unique, but the last one in the last batch is not.

The test expects all unique values to be inserted, including those in the last batch preceding the duplicate key.

It does not work this way for InnoDB -- being a transactional engine, it rolls back the entire statement upon an error. It causes row count assertion failure.

expected:<4096> but was:<4059>
junit.framework.AssertionFailedError: expected:<4096> but was:<4059>
at testsuite.simple.StatementsTest.testBatchRewriteErrors(StatementsTest.java:1620)

The test fails with server 5.5 on all platforms because it has default storage engine InnoDB, and with 5.1 in release tests on Windows because the Windows installer sets InnoDB as a default engine if not asked otherwise. 

How to repeat:
Run simple.StatementsTest.testBatchRewriteErrors test with default engine InnoDB on the server, or inspect the code.

Suggested fix:
Provide explicit ENGINE value in the table definition, or check which engine is default and set up the assertion dynamically.
[28 Oct 2010 13:59] Tonci Grgin
Pushed up to revision 990.