Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14082

Excessive freelist scanning for MaxBucket

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.2, 2.7.2
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
    • Fully Compatible
    • ALL

      Issue Status as of June 10, 2014

      ISSUE SUMMARY
      MongoDB's freelist algorithm separates deleted records by their size and adds them to corresponding linked lists. When searching for an appropriately sized free record, the algorithm scans a linked list for up to 30 elements, then skips to the next list with bigger elements.

      Due to a logical bug in the freelist handling code, the linked list containing the largest blocks of space (>8MB) did not stop scanning after 30 elements and would continue scanning until the end of the list, which can have a negative impact on performance.

      USER IMPACT
      For users with very large documents (>8MB) and heavy insert/update/delete workloads, the excessive freelist scanning for the largest blocks of free space can impact performance.

      WORKAROUNDS
      None.

      AFFECTED VERSIONS
      All versions of MongoDB up to 2.6.1 are affected.

      FIX VERSION
      The fix is included in the 2.6.2 production release.

      RESOLUTION DETAILS
      The MaxBucket is now included in the shortcut condition that moves to the next linked list.

      Original description

      The freelist search doesn't stop after 30 entries when searching the MaxBucket.

      https://github.com/mongodb/mongo/blob/9cfae91efb4c62051d2d460f4cf7c4cb6d10950c/src/mongo/db/structure/record_store_v1_simple.cpp#L142

      "b < MaxBucket" should be "b <= MaxBucket" (credit eliot)

            Assignee:
            dan@mongodb.com Daniel Pasette (Inactive)
            Reporter:
            steve.briskin Steve Briskin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: