Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-3112

AllocPages have wrong minimumRecordSize

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 10.4.1.3
    • None
    • Store
    • None

    Description

      AllocPage.createPage() contains this code at its beginning:

      super.createPage(newIdentity, args);

      // args[0] is the format id
      // args[1] is whether to sync the page to disk or not
      // args[2] is the pagesize (used by StoredPage)
      // args[3] is the spareSize (used by StoredPage)
      // args[4] is the number of bytes to reserve for container header
      // args[5] is the minimumRecordSize
      // NOTE: the arg list here must match the one in FileContainer
      int pageSize = args[2];
      int minimumRecordSize = args[5];
      borrowedSpace = args[4];

      The variable minimumRecordSize is local and unused, so setting it has no effect. The local variable hides a field with the same name inherited from StoredPage. That field is initialized to args[4] when super.createPage() is called. According to the comment in AllocPage, args[4] is the number of bytes to reserve for the container header (aka borrowedSpace), not the minimum record size. (args[4] is however the minimum record size if the page is a plain StoredPage, that's why super.createPage() will use that value.) I therefore believe that this code intended to update StoredPage.minimumRecordSize, not a local, unused variable.

      I don't know if this can lead to incorrect behaviour, but it doesn't look right.

      Attachments

        1. d3112-1.diff
          0.7 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              Unassigned Unassigned
              knutanders Knut Anders Hatlen
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: