keke357 / netlogo-sql

Automatically exported from code.google.com/p/netlogo-sql
0 stars 0 forks source link

TransactionControlTest blocks on teardownData() #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The TransactionControlTest blocks on teardownData() (with MySQL 5.5.11) This 
specifically happens with test_TransactionVisibility_internal().

This is most likely caused by the transaction left open by the test. Temporary 
workaround is replacing teardownData() with 

@After
public void teardownData() {
    try {
        workspace.command("sql:rollback-transaction");
    } catch(Exception ex) {
        // ignore, just ensuring no transaction is running
    }
    try {
        DatabaseHelper.executeUpdate("TRUNCATE TABLE " + tableName);
    } catch (SQLException e) {
        throw new IllegalStateException("Unable to delete data", e);
    }
}

Investigate if 
* this is a change in MySQL (case of TRUNCATE TABLE being blocked by the 
transaction having read the table to be truncated?), or
* there is a better solution for this (eg changing the transaction isolation), 
or
* the teardown should be restructured to occur after the disposal of the 
workspace (in HeadlessTest) so the offending connection is already dead, or
* updating the Connector/J driver fixes this

Original issue reported on code.google.com by MHGRotte...@gmail.com on 4 May 2011 at 2:07

GoogleCodeExporter commented 9 years ago
* Upgrade of Connector/J version to 5.1.16 does not help
* My previous MySQL was 5.1.(something), too many changes to go through
* Changing transaction isolation is not a good solution as we want the default 
as much as possible

For the time being I will commit the work around, I will create new issue for 
structuring teardown of tests better.

Original comment by MHGRotte...@gmail.com on 4 May 2011 at 3:03

GoogleCodeExporter commented 9 years ago
Created issue 7 for follow up

Original comment by MHGRotte...@gmail.com on 4 May 2011 at 3:10

GoogleCodeExporter commented 9 years ago
Fixed in revision r8

Original comment by MHGRotte...@gmail.com on 4 May 2011 at 3:23

GoogleCodeExporter commented 9 years ago

Original comment by MHGRotte...@gmail.com on 9 Jul 2011 at 1:56