Derby
  1. Derby
  2. DERBY-4083

BTreeScan.delete() throws AM_RECORD_NOT_FOUND if record is found

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4.2.0
    • Fix Version/s: 10.7.1.1
    • Component/s: Store
    • Labels:
      None
    • Urgency:
      Normal
    • Issue & fix info:
      Repro attached

      Description

      The code below is from BTreeScan.delete(). If the call to reposition() manages to position on the row, an exception is raised indicating that the row could not be found. If the row is not found, no exception is raised, but code later in the method will probably throw a NullPointerException because scan_position.current_leaf is set to null by reposition(). I believe that "if (reposition(...))" should be changed to "if (!reposition(...))". According to the test coverage reports, this code is not exercised by any of the existing tests.

      if (latch_released)
      {
      // lost latch on page in order to wait for row lock.
      // Because we have scan lock on page, we need only
      // call reposition() which will use the saved record
      // handle to reposition to the same spot on the page.
      // We don't have to search the
      // tree again, as we have the a scan lock on the page
      // which means the current_rh is valid to reposition on.
      if (reposition(scan_position, false))

      { throw StandardException.newException( SQLState.AM_RECORD_NOT_FOUND, new Long(err_containerid), new Long(scan_position.current_rh.getId())); }

      }
      }

      1. test.diff
        7 kB
        Knut Anders Hatlen
      2. derby-4083-1a.diff
        8 kB
        Knut Anders Hatlen

        Activity

        Hide
        Rick Hillegas added a comment -

        Triaged July 2, 2009: Assigned normal urgency.

        Show
        Rick Hillegas added a comment - Triaged July 2, 2009: Assigned normal urgency.
        Hide
        Knut Anders Hatlen added a comment -

        Attached is a patch that adds a test case to the T_b2i test and some debug code to release the latch in BTreeScan. When running the test with sane jars, it fails with the following error:

        ERROR XSAM6: Record

        {2}

        on page 7 in container 625 not found.

        Show
        Knut Anders Hatlen added a comment - Attached is a patch that adds a test case to the T_b2i test and some debug code to release the latch in BTreeScan. When running the test with sane jars, it fails with the following error: ERROR XSAM6: Record {2} on page 7 in container 625 not found.
        Hide
        Knut Anders Hatlen added a comment -

        The attached patch (derby-4083-1a.diff) contains the test and debug changes, and also adds the missing negation that's required for the code to work. All the regression tests ran cleanly with this patch.

        Show
        Knut Anders Hatlen added a comment - The attached patch (derby-4083-1a.diff) contains the test and debug changes, and also adds the missing negation that's required for the code to work. All the regression tests ran cleanly with this patch.
        Hide
        Knut Anders Hatlen added a comment -

        Committed revision 952131.

        I don't think this code path can be reached without using the store API directly, so I'm not planning to back-port the fix for now. Closing the issue.

        Show
        Knut Anders Hatlen added a comment - Committed revision 952131. I don't think this code path can be reached without using the store API directly, so I'm not planning to back-port the fix for now. Closing the issue.

          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