Derby
  1. Derby
  2. DERBY-4653

Avoid unnecessary round-trip for commit in the client driver

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.7.1.1
    • Fix Version/s: 10.7.1.1
    • Component/s: JDBC, Network Client
    • Labels:
      None
    • Issue & fix info:
      Patch Available
    • Bug behavior facts:
      Performance

      Description

      The methods Connection.commit() and Connection.rollback() in the client driver cause a round-trip to the server even if the commit/rollback is unnecessary (i.e. there is nothing to commit or roll back).
      Comments suggest (see below) that this can be optimized, such that the commands are flowed to the server only when required. It can be seen that this optimization has been used other places in the client driver. Never the less, it must be checked that this optimization doesn't have side-effects.

      This issue came up in connection with connection pooling, where a pool implementation always issued a rollback to make sure there was no active transaction on the connection handed out.

      From Connection.flowCommit:
      // Per JDBC specification (see javadoc for Connection.commit()):
      // "This method should be used only when auto-commit mode has been disabled."
      // However, some applications do this anyway, it is harmless, so
      // if they ask to commit, we could go ahead and flow a commit.
      // But note that rollback() is less harmless, rollback() shouldn't be used in auto-commit mode.
      // This behavior is subject to further review.

      // if (!this.inUnitOfWork)
      // return;
      // We won't try to be "too smart", if the user requests a commit, we'll flow a commit,
      // regardless of whether or not we're in a unit of work or in auto-commit mode.
      //

      1. SaveRoundClientDS.java
        4 kB
        Lily Wei
      2. SaveRoundClientDS.java
        4 kB
        Lily Wei
      3. ReproTransInProgressAttempt.java
        3 kB
        Lily Wei
      4. DERBY-4653-7_withflowcommittest.diff
        6 kB
        Lily Wei
      5. DERBY-4653-7_withflowcommittest_comment_update_diff.txt
        6 kB
        Kathey Marsden
      6. DERBY-4653-7_withflowcommittest_comment_update_diff.txt
        6 kB
        Kristian Waagan
      7. DERBY-4653-7_withflowcommittest_comment_update_diff_followup.txt
        2 kB
        Lily Wei
      8. DERBY-4653-6_withflowcommitrollback.diff
        9 kB
        Lily Wei
      9. DERBY-4653-5_withflowcommitrollback.diff
        8 kB
        Lily Wei
      10. DERBY-4653-4_withcommitrollbacktest.diff
        7 kB
        Lily Wei
      11. DERBY-4653-3_withrollback.diff
        3 kB
        Lily Wei
      12. DERBY-4653-2.diff
        2 kB
        Lily Wei
      13. DERBY-4653-1.diff
        0.9 kB
        Lily Wei
      14. _sds_0
        95 kB
        Lily Wei

        Issue Links

          Activity

          Kristian Waagan created issue -
          Lily Wei made changes -
          Field Original Value New Value
          Assignee Lily Wei [ lilywei ]
          Lily Wei made changes -
          Attachment DERBY-4653-1.diff [ 12445231 ]
          Lily Wei made changes -
          Issue & fix info [Patch Available]
          Lily Wei made changes -
          Attachment DERBY-4653-2.diff [ 12445555 ]
          Lily Wei made changes -
          Attachment SaveRoundClientDS.java [ 12445667 ]
          Attachment _sds_0 [ 12445668 ]
          Lily Wei made changes -
          Attachment DERBY-4653-3_withrollback.diff [ 12446183 ]
          Attachment SaveRoundClientDS.java [ 12446184 ]
          Lily Wei made changes -
          Lily Wei made changes -
          Lily Wei made changes -
          Lily Wei made changes -
          Attachment ReproTransInProgressAttempt.java [ 12447204 ]
          Lily Wei made changes -
          Attachment DERBY-4653-7_withflowcommittest.diff [ 12447432 ]
          Kathey Marsden made changes -
          Summary Avoid unnecessary round-trip for commit/rollback in the client driver Avoid unnecessary round-trip for commit in the client driver
          Kathey Marsden made changes -
          Kathey Marsden made changes -
          Link This issue is related to DERBY-4687 [ DERBY-4687 ]
          Kristian Waagan made changes -
          Lily Wei made changes -
          Lily Wei made changes -
          Link This issue incorporates DERBY-4709 [ DERBY-4709 ]
          Kristian Waagan made changes -
          Attachment derby-4653-8a-alternative_test.diff [ 12447823 ]
          Kristian Waagan made changes -
          Attachment derby-4653-8a-alternative_test.diff [ 12447823 ]
          Lily Wei made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.7.0.0 [ 12314971 ]
          Resolution Fixed [ 1 ]
          Rick Hillegas made changes -
          Affects Version/s 10.7.1.1 [ 12315564 ]
          Affects Version/s 10.7.1.0 [ 12314971 ]
          Fix Version/s 10.7.1.1 [ 12315564 ]
          Fix Version/s 10.7.1.0 [ 12314971 ]
          Lily Wei made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Gavin made changes -
          Workflow jira [ 12510692 ] Default workflow, editable Closed status [ 12800454 ]

            People

            • Assignee:
              Lily Wei
              Reporter:
              Kristian Waagan
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development