[SERVER-28357] MMAPv1 compact operation may trigger "quota exceeded" error (12501) Created: 16/Mar/17  Updated: 06/Dec/17  Resolved: 17/Mar/17

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.0.15, 3.2.13, 3.4.5, 3.5.5

Type: Bug Priority: Major - P3
Reporter: Geert Bosch Assignee: Geert Bosch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2, v3.0
Steps To Reproduce:

This is very hard to reproduce, as it depends on the extent manager having no free extents, so it needs to create a new data file. Yet, we drop indexes at the beginning of the compact.

Sprint: Storage 2017-03-27
Participants:

 Description   

In SimpleRecordStoreV1::compact we call increaseStorageSize with enforceQuote set to true. This unconditionally calls _checkQuota, which raises the "quota exceeded" error (12501):

void _checkQuota(bool enforceQuota, int fileNo) {
    if (!enforceQuota)
        return;
 
    if (fileNo < mmapv1GlobalOptions.quotaFiles)
        return;
 
    uasserted(12501, "quota exceeded");
}

In all other places, such as _insertDocuments, we filter the enforceQuote flag:

    Status status = _recordStore->insertRecords(opCtx, &records, _enforceQuota(enforceQuota));

where _enforceQuota is defined as:

bool Collection::_enforceQuota(bool userEnforeQuota) const {
    if (!userEnforeQuota)
        return false;
 
    if (!mmapv1GlobalOptions.quota)
        return false;
 
    if (_ns.db() == "local")
        return false;
 
    if (_ns.isSpecial())
        return false;
 
    return true;
}

In my opinion this should be the other way around: compact should never check for quota, as it will (eventually) free up space.



 Comments   
Comment by Githook User [ 29/Apr/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-28357 Do not enforce quota on starting MMAPv1 compact

(cherry picked from commit 914bbbd26a686e032fdddec964b109ea78c6e6f6)

Conflicts:
src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp
Branch: v3.4
https://github.com/mongodb/mongo/commit/e624205252429cc6b629dd3f03b90db957454bd6

Comment by Githook User [ 25/Apr/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-28357 Do not enforce quota on starting MMAPv1 compact

(cherry picked from commit d3e35fc16a7654a83db9f3daa5f4c356c5105246)
Branch: v3.0
https://github.com/mongodb/mongo/commit/832a7d29e80806f71afc1cd6116386cd43cf463e

Comment by Githook User [ 12/Apr/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-28357 Do not enforce quota on starting MMAPv1 compact

(cherry picked from commit 914bbbd26a686e032fdddec964b109ea78c6e6f6)

Conflicts:
src/mongo/db/storage/mmap_v1/record_store_v1_simple.cpp
Branch: v3.2
https://github.com/mongodb/mongo/commit/d3e35fc16a7654a83db9f3daa5f4c356c5105246

Comment by Githook User [ 17/Mar/17 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-28357 Do not enforce quota on starting MMAPv1 compact
Branch: master
https://github.com/mongodb/mongo/commit/914bbbd26a686e032fdddec964b109ea78c6e6f6

Generated at Thu Feb 08 04:17:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.