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

Compact command results in (much) larger database

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.0.1
    • Storage
    • None
    • CentOS 5.6
    • Linux

    Description

      After I've run an inline compaction, the DB actually grows in size. I've seen this happening on my production environment (where I actually ran out of RAM because of this) and I've just reproduced it on my development environment.

      After running db.repairDatabase() the size shrinks back.

      Below is the Mongo shell output:

      > show dbs
      admin (empty)
      local (empty)
      test (empty)
      mydb 1.953125GB
      > db.mycollection.runCommand('compact')

      { "ok" : 1 }

      > show dbs
      admin (empty)
      local (empty)
      test (empty)
      mydb 3.9521484375GB
      > db.stats()

      { "db" : "mydb", "collections" : 7, "objects" : 1017491, "avgObjSize" : 588.1718894810863, "dataSize" : 598459604, "storageSize" : 635535360, "numExtents" : 29, "indexes" : 5, "indexSize" : 77868224, "fileSize" : 4226809856, "nsSizeMB" : 16, "ok" : 1 } > db.repairDatabase() { "ok" : 1 }

      > db.stats()
      {
      "db" : "mydb",
      "collections" : 7,
      "objects" : 1017491,
      "avgObjSize" : 588.1718894810863,
      "dataSize" : 598459604,
      "storageSize" : 705445888,
      "numExtents" : 44,
      "indexes" : 5,
      "indexSize" : 75938688,
      "fileSize" : 2080374784,
      "nsSizeMB" : 16,
      "ok" : 1
      }
      > show dbs
      admin (empty)
      local (empty)
      test (empty)
      mydb 1.953125GB

      Attachments

        Activity

          People

            Unassigned Unassigned
            joostdevries Joost de Vries
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: