I’m trying to implement functionality of changing the size of capped collection and was running out of available virtual space on 32bit systems which is 2GB. Mongo db was constantly creating new files if I tried to drop old collection and create a new collection with the same name but with different size.
In order to fix it I decided to do a repairDatabase each time I’m changing the size of collection, so that Mongo Db can reduce the file size before doing that operation. It works fine on Windows 2008 32bit but on Windows 2003 32bit I’m getting the following error when trying to do a sequence of operations ‘repairDatabase’, ‘dropCollection’, ‘createCollection’ after a certain number of attempts (near 10 attempts).
Tue Aug 28 06:24:28 [conn7] MapViewOfFileEx for C:/Program Files/.../MongoDb/data/$tmp_repairDatabase_0/sbm.1 failed with errno:8 ?????????????????????????? (file size is 536870912) in MemoryMappedFile::map, terminating.
I beleive the message replaced by question characters is 'Not enough storage is available to process this command.'. I’ve seen it here SERVER-6044 and here SERVER-5244. But none of this issues seems to be the same as my case. Is there any way I can prevent Mongo Db from termination? Or is there any better way to reduce the file size if I’m changing the capped collection size?
I’m also trying to create only collections the size of which doesn’t exceed 500MB (see this question to find out why). The version of Mongo Db I’m using is 2.0.7
When ‘repairDatabase’ is running, it needs twice as much space as a normal running state, so I was running out of 2GB limit on 32-bit systems even though I had a database only a bit larger than 1GB.
The solution is to use capped collections with even lower size than 500MB and take into account space that can be used by ‘repairDatabase’