Derby
  1. Derby
  2. DERBY-5524

Speed up clean-up after StatementJdbc30Test.xtestMaxOpenStatementsWithQueryTimeout

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.9.1.0
    • Component/s: Test
    • Labels:
      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.

      1. d5524.diff
        0.9 kB
        Knut Anders Hatlen

        Issue Links

          Activity

          Knut Anders Hatlen created issue -
          Knut Anders Hatlen made changes -
          Field Original Value New Value
          Link This issue relates to DERBY-3198 [ DERBY-3198 ]
          Knut Anders Hatlen made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          Knut Anders Hatlen made changes -
          Attachment d5524.diff [ 12506439 ]
          Knut Anders Hatlen made changes -
          Issue & fix info Patch Available [ 10102 ]
          Knut Anders Hatlen made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Issue & fix info Patch Available [ 10102 ]
          Fix Version/s 10.9.0.0 [ 12316344 ]
          Resolution Fixed [ 1 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12644897 ] Default workflow, editable Closed status [ 12797025 ]

            People

            • Assignee:
              Knut Anders Hatlen
              Reporter:
              Knut Anders Hatlen
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development