Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5524

Speed up clean-up after StatementJdbc30Test.xtestMaxOpenStatementsWithQueryTimeout

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 10.9.1.0
    • 10.9.1.0
    • Test
    • None

    Description

      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.

      Attachments

        1. d5524.diff
          0.9 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              knutanders Knut Anders Hatlen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: