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

MMAPv1 compact operation may trigger "quota exceeded" error (12501)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0.15, 3.2.13, 3.4.5, 3.5.5
    • Component/s: Storage
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v3.4, v3.2, v3.0
    • Steps To Reproduce:
      Hide

      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.

      Show
      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

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: