1

I have a capped collection and I have allocated 1GB of space for it, the collection is dropping documents at approx 100MB.

db.support.stats()
{
"ns" : "logs.support",
"count" : 111351,
"size" : 98221360,
"avgObjSize" : 882.0878124130003,
"storageSize" : 100003840,
"numExtents" : 1,
"nindexes" : 1,
"lastExtentSize" : 100003840,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 3638320,
"indexSizes" : {
    "_id_" : 3638320
},
"capped" : true,
"max" : NumberLong("9223372036854775807"),
"ok" : 1
}

As far as I can tell from looking at the docs: http://docs.mongodb.org/manual/reference/command/collStats/ Mongo is filling up one extent and is never allocating a second. Is there a reason why mongo is not allocating enough extents to keep growing to the capped collection size?

This is running on a macbook pro with mavericks and the /data/db directory is writable.

ianc
  • 213
  • 2
  • 7
  • 1
    Are you sure you allocated 1GB and not 100MB by accident? That storage size, despite being pre-allocated is 100MB not 1GB – Sammaye Mar 12 '14 at 22:02
  • I think so, the "max" property of the collection is greater than the storage size. Should the storage size grow to meet the max collection size? – ianc Mar 13 '14 at 08:59
  • Hmm that max size is like 8388608TB so I don't think so, in fact I have never seen max before and it isn't in the documentation: http://docs.mongodb.org/manual/reference/command/collStats/ what version of MongoDB is this? – Sammaye Mar 13 '14 at 09:07
  • Mongo 2.4.9. Sammaye you are correct, I must have pasted in the wrong number when creating the collection, the "max" property threw me off. Since this is a dev box I just created a new collection with the correct size. Thanks for your help. – ianc Mar 13 '14 at 10:33
  • The `max` property is an (optional) maximum number of documents to allow in the capped collection (see [`db.createCollection()`](http://docs.mongodb.org/manual/reference/method/db.createCollection/)). If you don't specify a `max` value, it will be set to MAXINT (in your example, the maximum positive value for a signed Int64). Since space for capped collections is always preallocated, the `size` limit takes precedence over the `max` number of documents. – Stennie Mar 13 '14 at 11:27

0 Answers0