[SERVER-14082] Excessive freelist scanning for MaxBucket Created: 29/May/14  Updated: 11/Mar/15  Resolved: 02/Jun/14

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 2.6.2, 2.7.2

Type: Bug Priority: Major - P3
Reporter: Steve Briskin (Inactive) Assignee: Daniel Pasette (Inactive)
Resolution: Done Votes: 0
Labels: brs
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-14081 Freelist improvements Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Participants:

 Description   
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)



 Comments   
Comment by Githook User [ 01/Jun/14 ]

Author:

{u'username': u'monkey101', u'name': u'Dan Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-14082: freelist scan does not short circuit in MaxBucket
Branch: v2.6
https://github.com/mongodb/mongo/commit/778c80e45507eedd7ed8a0320dab971880697467

Comment by Githook User [ 01/Jun/14 ]

Author:

{u'username': u'monkey101', u'name': u'Dan Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-14082: freelist scan doesn't short circuit in MaxBucket
Branch: master
https://github.com/mongodb/mongo/commit/f33e210cab1bde3deb5c62102e292fdf30a436ca

Generated at Thu Feb 08 03:33:48 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.