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

Able to specify negative numbers for maxFilesPerDB

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Gone away
    • Affects Version/s: 3.0.2
    • Fix Version/s: None
    • Component/s: Admin, MMAPv1
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Startup mongod with the following configuration file:

      storage:
          mmapv1:
              quota:
                  maxFilesPerDB: -1
      

      Attempt to insert enough data so that it allocates multiple (> 1) database files.

      Show
      Startup mongod with the following configuration file: storage: mmapv1: quota: maxFilesPerDB: -1 Attempt to insert enough data so that it allocates multiple (> 1) database files.

      Description

      This was tested on MongoDB 3.0.2 with the MMAPv1 storage engine.

      It appears that it is possible to specify negative numbers for the maxFilesPerDB configuration option.

      For example:

      storage:
          mmapv1:
              quota:
                  maxFilesPerDB: -1
      

      The mongod server appears to successfully parse and accept this value:

      2015-05-01T14:20:22.422+1000 I CONTROL  [initandlisten] allocator: system
      2015-05-01T14:20:22.422+1000 I CONTROL  [initandlisten] options: { config: "mongod.conf", net: { port: 27017 }, processManagement: { fork: true }, storage: { dbPath: "/private/tmp/delete_me/data/db", mmapv1: { quota: { maxFilesPerDB: -1 } } }, systemLog: { destination: "file", logAppend: true, path: "/private/tmp/delete_me/data/mongod.log" } }
      2015-05-01T14:20:22.423+1000 I INDEX    [initandlisten] allocating new ns file /private/tmp/delete_me/data/db/local.ns, filling with zeroes...
      2015-05-01T14:20:22.470+1000 I STORAGE  [FileAllocator] allocating new datafile /private/tmp/delete_me/data/db/local.0, filling with zeroes...
      

      Furthermore, we are still able to allocate files:

      2015-05-01T14:20:43.847+1000 I INDEX    [conn3] allocating new ns file /private/tmp/delete_me/data/db/cats.ns, filling with zeroes...
      2015-05-01T14:20:43.893+1000 I STORAGE  [FileAllocator] allocating new datafile /private/tmp/delete_me/data/db/cats.0, filling with zeroes...
      2015-05-01T14:20:44.046+1000 I STORAGE  [FileAllocator] done allocating datafile /private/tmp/delete_me/data/db/cats.0, size: 64MB,  took 0.152 secs
      2015-05-01T14:20:44.098+1000 I WRITE    [conn3] insert cats.mycats query: { _id: ObjectId('5542ff1bfd2f77fdc55eed2b'), name: "ernie" } ninserted:1 keyUpdates:0 writeConflicts:0 numYields:0 locks:{ Global: { acquireCount: { w: 2 } }, MMAPV1Journal: { acquireCount: { w: 8 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 64 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 4 } } } 250ms
      2015-05-01T14:20:44.098+1000 I COMMAND  [conn3] command cats.$cmd command: insert { insert: "mycats", documents: [ { _id: ObjectId('5542ff1bfd2f77fdc55eed2b'), name: "ernie" } ], ordered: true } keyUpdates:0 writeConflicts:0 numYields:0 reslen:40 locks:{ Global: { acquireCount: { w: 2 } }, MMAPV1Journal: { acquireCount: { w: 8 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 64 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 4 } } } 253ms
      

      However, after the first file, it appears we hit the quota. On the shell where we are trying to insert documents, we see:

      WriteResult({
              "nInserted" : 0,
              "writeError" : {
                      "code" : 12501,
                      "errmsg" : "quota exceeded"
              }
      })
      

      However, the mongod.log logfile itself does not appear to log anything about this (Default logLevel: 0):

      2015-05-01T14:20:44.098+1000 I WRITE    [conn3] insert cats.mycats query: { _id: ObjectId('5542ff1bfd2f77fdc55eed2b'), name: "ernie" } ninserted:1 keyUpdates:0 writeConflicts:0 numYields:0 locks:{ Global: { acquireCount: { w: 2 } }, MMAPV1Journal: { acquireCount: { w: 8 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 64 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 4 } } } 250ms
      2015-05-01T14:20:44.098+1000 I COMMAND  [conn3] command cats.$cmd command: insert { insert: "mycats", documents: [ { _id: ObjectId('5542ff1bfd2f77fdc55eed2b'), name: "ernie" } ], ordered: true } keyUpdates:0 writeConflicts:0 numYields:0 reslen:40 locks:{ Global: { acquireCount: { w: 2 } }, MMAPV1Journal: { acquireCount: { w: 8 }, acquireWaitCount: { w: 1 }, timeAcquiringMicros: { w: 64 } }, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1 } }, Metadata: { acquireCount: { W: 4 } } } 253ms
      2015-05-01T14:49:21.599+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51853 #4 (2 connections now open)
      2015-05-01T14:49:21.601+1000 I NETWORK  [conn4] end connection 127.0.0.1:51853 (1 connection now open)
      2015-05-01T14:49:21.608+1000 I NETWORK  [conn3] end connection 127.0.0.1:51360 (0 connections now open)
      2015-05-01T14:49:23.337+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51854 #5 (1 connection now open)
      2015-05-01T14:52:51.797+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51944 #6 (2 connections now open)
      2015-05-01T14:54:42.248+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51975 #7 (3 connections now open)
      2015-05-01T14:54:51.165+1000 I NETWORK  [conn7] end connection 127.0.0.1:51975 (2 connections now open)
      2015-05-01T14:54:53.186+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51981 #8 (3 connections now open)
      2015-05-01T14:55:07.577+1000 I NETWORK  [conn8] end connection 127.0.0.1:51981 (2 connections now open)
      2015-05-01T14:55:10.555+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51987 #9 (3 connections now open)
      2015-05-01T14:55:10.556+1000 I NETWORK  [conn9] end connection 127.0.0.1:51987 (2 connections now open)
      2015-05-01T14:55:10.563+1000 I NETWORK  [conn5] end connection 127.0.0.1:51854 (1 connection now open)
      2015-05-01T14:55:13.345+1000 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51989 #10 (2 connections now open)
      

        Attachments

          Activity

            People

            Assignee:
            backlog-server-execution Backlog - Storage Execution Team
            Reporter:
            victor.hooi Victor Hooi
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: