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

Does not reuse allocated disk

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.0.1
    • Fix Version/s: None
    • Component/s: Storage
    • Labels:
    • Environment:
      win 2008 r2, vm
    • Operating System:
      Windows

      Description

      re: https://groups.google.com/group/mongodb-user/browse_thread/thread/6df6a4aa7101c2b7?hl=en#

      New space always allocated even when currently allocated fileSize is large compared to storageSize.

      simple example:
      1.using mongoinsert inserting 1-2 GB data to one collection.
      2.remove all records from collection
      3.compact collection
      4.querying db.stats().
      5.repeat.

      I expected allocated disk to grow with initial insert, remove and compact. I do not expect to see filesize grow on subsequent iterations of the same. I assumed it would reuse the space it knew it had free. That seems not to be the case. Before the last insert, there is approx fileSize-storageSize = 12GB
      available.

      > //loading 2 mil thingies using mongoimport
      > db.stats()

      { "db" : "mango", "collections" : 3, "objects" : 2047904, "avgObjSize" : 1571.746865087426, "dataSize" : 3218786692, "storageSize" : 3577475072, "numExtents" : 32, "indexes" : 1, "indexSize" : 77688352, "fileSize" : 4226809856, "nsSizeMB" : 16, "ok" : 1 }

      > db.thingies.remove()
      > db.thingies.runCommand('compact')

      { "ok" : 1 }

      > db.stats()

      { "db" : "mango", "collections" : 3, "objects" : 4, "avgObjSize" : 45, "dataSize" : 180, "storageSize" : 721420288, "numExtents" : 3, "indexes" : 1, "indexSize" : 8176, "fileSize" : 6373244928, "nsSizeMB" : 16, "ok" : 1 } > //add the 2 mill again using mongoimport > db.stats() { "db" : "mango", "collections" : 3, "objects" : 2047904, "avgObjSize" : 1571.7465193680953, "dataSize" : 3218785984, "storageSize" : 3872567296, "numExtents" : 6, "indexes" : 1, "indexSize" : 79675120, "fileSize" : 10666115072, "nsSizeMB" : 16, "ok" : 1 } > db.thingies.remove() > db.thingies.runCommand('compact') { "ok" : 1 }

      > db.stats()
      {
      "db" : "mango",
      "collections" : 3,
      "objects" : 4,
      "avgObjSize" : 45,
      "dataSize" : 180,
      "storageSize" : 1495941120,
      "numExtents" : 3,
      "indexes" : 1,
      "indexSize" : 8176,
      "fileSize" : 12812550144,
      "nsSizeMB" : 16,
      "ok" : 1
      }
      > //load them one more time using mongoimport
      > db.stats()
      {
      "db" : "mango",
      "collections" : 3,
      "objects" : 2047904,
      "avgObjSize" : 1571.7464666312483,
      "dataSize" : 3218785876,
      "storageSize" : 3291062272,
      "numExtents" : 4,
      "indexes" : 1,
      "indexSize" : 79748704,
      "fileSize" : 14958985216,
      "nsSizeMB" : 16,
      "ok" : 1
      }

      //we now have 14+ GB allocated to Mongo but only 3 in use.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              milkie Eric Milkie
              Reporter:
              markacurran@gmail.com Mark Curran
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: