Derby
  1. Derby
  2. DERBY-4685

Dead/unreachable code in OpenConglomerate.lockPositionForWrite()

    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: Store
    • Labels:
      None

      Description

      OpenConglomerate.lockPositionForWrite() contains this code twice:

      if (!waitForLock)

      { // throw lock timeout error. throw StandardException.newException(SQLState.LOCK_TIMEOUT); }

      The second occurrence of this code can never end up throwing an exception, since waitForLock is guaranteed to be true there because of the identical check a couple of lines above. (Judging by the similar method lockPositionForRead(), it is probably the first check that should be removed, so that the latch on the page is released before the exception is thrown.)

      Also, the method is always called with forInsert==false, so the forInsert parameter can be removed. (I also suspect that the method doesn't work correctly if ever used in an insert operation, since it calls latchPage(RowPosition) which will unlatch the page if the row isn't found on the page, and I assume that a row that is about to be inserted does not exist yet.)

      1. d4685-2.diff
        3 kB
        Knut Anders Hatlen
      2. d4685.diff
        0.8 kB
        Knut Anders Hatlen

        Activity

        Knut Anders Hatlen created issue -
        Knut Anders Hatlen made changes -
        Field Original Value New Value
        Attachment d4685.diff [ 12458059 ]
        Knut Anders Hatlen made changes -
        Assignee Knut Anders Hatlen [ knutanders ]
        Issue & fix info [Patch Available]
        Knut Anders Hatlen made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Knut Anders Hatlen made changes -
        Issue & fix info [Patch Available]
        Knut Anders Hatlen made changes -
        Attachment d4685-2.diff [ 12458317 ]
        Knut Anders Hatlen made changes -
        Issue & fix info [Patch Available]
        Knut Anders Hatlen made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Issue & fix info [Patch Available]
        Fix Version/s 10.7.1.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 ]
        Gavin made changes -
        Workflow jira [ 12512266 ] Default workflow, editable Closed status [ 12800449 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development