[SERVER-355] Capped collections go over the configured limits Created: 13/Oct/09  Updated: 17/Oct/09  Resolved: 13/Oct/09

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 1.1.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Mike Perham Assignee: Eliot Horowitz (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

OSX 64-bit with Ruby 0.15.1 driver


Participants:

 Description   

I'm creating a collection limited to 100MB of data:

      col = @db.create_collection(host, { :capped => true, :size => 100_000_000 })
      col.create_index 'invoked_at'
      col.create_index 'code'

Then I inserted 1,000,000 documents to see what would happen.

-rw-------  1 mike    wheel   67108864 Oct 13 14:06 web-analytics.0
-rw-------  1 mike    wheel  134217728 Oct 13 14:10 web-analytics.1
-rw-------  1 mike    wheel  268435456 Oct 13 14:06 web-analytics.2
-rw-------  1 mike    wheel  536870912 Oct 13 14:06 web-analytics.3
-rw-------  1 mike    wheel   16777216 Oct 13 14:01 web-analytics.ns

Here's a listing of the collections and their document count within the web-analytics database:

system.indexes: 2
www.mikeperham.com: 735293

I was under the impression the million limit should mean bytes, not documents, so why is the entire database taking 800+MB on disk?



 Comments   
Comment by Eliot Horowitz (Inactive) [ 13/Oct/09 ]

if you run with --smallfiles (new in 1.1.2) and --notablescan it will use less disk space

Comment by Mike Perham [ 13/Oct/09 ]

Ok, I tested with a smaller cap and was able to verify that it doesn't go over a preset size. The problem is that I've limited it to 1MB and it is taking 80MB on disk. That seems extreme but at least it works as designed.

Comment by Eliot Horowitz (Inactive) [ 13/Oct/09 ]

that's the allocated disk size.
MongoDB allocates extra space for various things.
the capping is on the collection, not the database

Comment by Mike Perham [ 13/Oct/09 ]

Sorry, I haven't used JIRA in years and don't remember the formatting tags.

Generated at Thu Feb 08 02:53:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.