Speed up clean-up after 
StatementJdbc30Test.xtestMaxOpenStatementsWithQueryTimeout
----------------------------------------------------------------------------------

                 Key: DERBY-5524
                 URL: https://issues.apache.org/jira/browse/DERBY-5524
             Project: Derby
          Issue Type: Improvement
          Components: Test
    Affects Versions: 10.9.0.0
            Reporter: Knut Anders Hatlen
            Assignee: Knut Anders Hatlen
            Priority: Minor


StatementJdbc30Test.xtestMaxOpenStatementsWithQueryTimeout takes close to four 
minutes in my environment. It turns out it spends most of the time in 
tearDown() closing statements.

The test case opens a lot of statements (more than 16000) on the same 
connection and keeps them open until the test has completed, to verify that it 
is possible to have that many open statements on a single connection when a 
query timeout has been specified. The test case runs with auto-commit enabled, 
and every call to Statement.close() in tearDown() therefore results in an 
implicit commit. When committing a transaction, the engine needs to go through 
the list of activations in that transaction. Since there's one activation per 
open statement, that list is pretty long. Although it gets shorter for each 
statement that is closed, it takes a while to get through all the statements 
(~16000^2/2 activations need to be checked before all statements are closed...).

This can easily be fixed by disabling auto-commit for the test case. Since no 
(implicit) commit happens during the test case itself, this doesn't change the 
semantics of the test case. It will speed up the closing of the statements in 
tearDown() because it will no longer run 16000 implicit commits and traverse 
the long list of activations 16000 times.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to