Derby
  1. Derby
  2. DERBY-4409

Make some tests run faster by using CleanDatabaseSetup + decorateSQL + rollback idiom

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.6.1.0
    • Component/s: Test
    • Labels:
      None
    • Urgency:
      Normal

      Description

      For example, for OrderByAndSortAvoidance, this reduces running time on my box from ca 5 minutes to ca 1 minute, cf
      patch OrderByAndSortAvoidance-faster.

      1. OrderByAndSortAvoidance-faster-2.stat
        0.1 kB
        Dag H. Wanvik
      2. OrderByAndSortAvoidance-faster-2.diff
        823 kB
        Dag H. Wanvik
      3. OrderByAndSortAvoidance-faster.stat
        0.1 kB
        Dag H. Wanvik
      4. OrderByAndSortAvoidance-faster.diff
        824 kB
        Dag H. Wanvik
      5. DERBY-4409_min_stat.txt
        0.1 kB
        Ole Solberg
      6. DERBY-4409_min_diff.txt
        0.6 kB
        Ole Solberg

        Issue Links

          Activity

          Dag H. Wanvik created issue -
          Dag H. Wanvik made changes -
          Field Original Value New Value
          Attachment OrderByAndSortAvoidance-faster.diff [ 12422159 ]
          Attachment OrderByAndSortAvoidance-faster.stat [ 12422160 ]
          Hide
          Dag H. Wanvik added a comment -

          Uploaded patch to make OrderByAndSortAvoidance run faster.

          Show
          Dag H. Wanvik added a comment - Uploaded patch to make OrderByAndSortAvoidance run faster.
          Hide
          Knut Anders Hatlen added a comment -

          +1. Looks like an improvement to me.

          The calls to rollback() in the test cases are not actually needed, because (a) auto-commit is enabled, (b) BaseJDBCTestCase.tearDown() already calls rollback(), and (c) all the tests are read-only.

          (The test originally had auto-commit disabled because setUp() called setAutoCommit(false). Calling setAutoCommit(false) from the decorator does not have the same effect because it uses a different Connection instance. This is just an observation, and I'm not suggesting that we should disable auto-commit again.)

          Show
          Knut Anders Hatlen added a comment - +1. Looks like an improvement to me. The calls to rollback() in the test cases are not actually needed, because (a) auto-commit is enabled, (b) BaseJDBCTestCase.tearDown() already calls rollback(), and (c) all the tests are read-only. (The test originally had auto-commit disabled because setUp() called setAutoCommit(false). Calling setAutoCommit(false) from the decorator does not have the same effect because it uses a different Connection instance. This is just an observation, and I'm not suggesting that we should disable auto-commit again.)
          Hide
          Dag H. Wanvik added a comment -

          I agree, thanks! Upload rev 2 removing the vacuous rollback calls.

          Show
          Dag H. Wanvik added a comment - I agree, thanks! Upload rev 2 removing the vacuous rollback calls.
          Dag H. Wanvik made changes -
          Attachment OrderByAndSortAvoidance-faster-2.diff [ 12422288 ]
          Attachment OrderByAndSortAvoidance-faster-2.stat [ 12422289 ]
          Hide
          Dag H. Wanvik added a comment -

          Committed OrderByAndSortAvoidance-faster-2 as svn 825682.

          Show
          Dag H. Wanvik added a comment - Committed OrderByAndSortAvoidance-faster-2 as svn 825682.
          Dag H. Wanvik made changes -
          Fix Version/s 10.6.0.0 [ 12313727 ]
          Issue & fix info [Patch Available]
          Hide
          Dag H. Wanvik added a comment -

          Resolving this; can be reopened if we find more re-write candidates of the same kind.

          Show
          Dag H. Wanvik added a comment - Resolving this; can be reopened if we find more re-write candidates of the same kind.
          Dag H. Wanvik made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Ole Solberg added a comment -

          TinderBox test / suites.All failed with just exitting.
          Looking at the diff, via JIRA, I found a 'System.exit(1);':

          • commit();
          • super.tearDown();
            + getConnection().commit();
            + System.exit(1);
            + }
            + };
            }

          /**
          @@ -10295,7 +10298,7 @@
          "ORDER BY CS.ID DESC";

          Running suites.All now with a minimal patch that replaces 'System.exit(1);' with the original 'st.close();'

          Show
          Ole Solberg added a comment - TinderBox test / suites.All failed with just exitting. Looking at the diff, via JIRA, I found a 'System.exit(1);': commit(); super.tearDown(); + getConnection().commit(); + System.exit(1); + } + }; } /** @@ -10295,7 +10298,7 @@ "ORDER BY CS.ID DESC"; Running suites.All now with a minimal patch that replaces 'System.exit(1);' with the original 'st.close();'
          Hide
          Ole Solberg added a comment -

          DERBY-4409_min_diff.txt:
          minor patch that replaces 'System.exit(1);' with the original 'st.close();'

          Show
          Ole Solberg added a comment - DERBY-4409 _min_diff.txt: minor patch that replaces 'System.exit(1);' with the original 'st.close();'
          Ole Solberg made changes -
          Attachment DERBY-4409_min_diff.txt [ 12422343 ]
          Attachment DERBY-4409_min_stat.txt [ 12422344 ]
          Hide
          Ole Solberg added a comment -

          DERBY-4409_min_diff.txt committed to trunk as revision 825847.

          Show
          Ole Solberg added a comment - DERBY-4409 _min_diff.txt committed to trunk as revision 825847.
          Hide
          Dag H. Wanvik added a comment -

          Thanks for fixing that howler, Ole!

          Show
          Dag H. Wanvik added a comment - Thanks for fixing that howler, Ole!
          Dag H. Wanvik made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Dag H. Wanvik made changes -
          Assignee Dag H. Wanvik [ dagw ]
          Knut Anders Hatlen made changes -
          Link This issue is related to DERBY-5695 [ DERBY-5695 ]
          Gavin made changes -
          Workflow jira [ 12479493 ] Default workflow, editable Closed status [ 12799993 ]

            People

            • Assignee:
              Dag H. Wanvik
              Reporter:
              Dag H. Wanvik
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development