Hi,
I'm making some test on mongoDB, among those tests I tried to create a
capped collection.
In docs ( here ->
http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-UsageandRestrictions.
) I read
"Maximum size for a capped collection is currently 1e9 bytes on a
thirty-two bit machine. [...] "
so I tried to create a collection like below, directly on mongo shell:
> db.createCollection("test",{capped:true, size:1000000000});
{ "errmsg" : "exception: bad new extent size", "code" : 10358, "ok" :
0 }
>
but, as you can see, I got an error.
In log-file I see:
[...]
Thu Jul 14 08:28:01 [initandlisten] connection accepted from
127.0.0.1:56123 #1
Thu Jul 14 08:28:16 [FileAllocator] allocating new datafile /data/db/
test.ns, filling with zeroes...
Thu Jul 14 08:28:16 [FileAllocator] done allocating datafile /data/db/
test.ns, size: 16MB, took 0.046 secs
Thu Jul 14 08:28:16 [FileAllocator] allocating new datafile /data/db/
test.0, filling with zeroes...
Thu Jul 14 08:28:16 [FileAllocator] done allocating datafile /data/db/
test.0, size: 16MB, took 0.075 secs
Thu Jul 14 08:28:16 [FileAllocator] allocating new datafile /data/db/
test.1, filling with zeroes...
Thu Jul 14 08:28:16 [FileAllocator] done allocating datafile /data/db/
test.1, size: 32MB, took 0.095 secs
Thu Jul 14 08:28:16 [FileAllocator] allocating new datafile /data/db/
test.2, filling with zeroes...
Thu Jul 14 08:28:31 [FileAllocator] done allocating datafile /data/db/
test.2, size: 512MB, took 14.945 secs
Thu Jul 14 08:28:32 [conn1] Assertion: 10358:bad new extent size
0x818f3fe 0x83ce266 0x83c68b0 0x83df634 0x83e1e50 0x8448d38 0x84449d2
0x8445db6 0x8287b7c 0x828c46e 0x83b0327 0x83b62a1 0x8523ff3 0x81f7468
0x85385ad 0xb249c9 0xa7a48e
/usr/local/bin/mongod(_ZN5mongo11msgassertedEiPKc+0x15e) [0x818f3fe]
/usr/local/bin/mongod(_ZN5mongo13MongoDataFile12createExtentEPKcibi
+0x156) [0x83ce266]
/usr/local/bin/mongod(_ZN5mongo8Database11allocExtentEPKcib+0x90)
[0x83c68b0]
/usr/local/bin/mongod(_ZN5mongo13_userCreateNSEPKcRKNS_7BSONObjERSsPb
+0x5d4) [0x83df634]
/usr/local/bin/mongod(_ZN5mongo12userCreateNSEPKcNS_7BSONObjERSsbPb
+0x130) [0x83e1e50]
/usr/local/bin/
mongod(_ZN5mongo9CmdCreate3runERKSsRNS_7BSONObjERSsRNS_14BSONObjBuilderEb
+0xd8) [0x8448d38]
/usr/local/bin/
mongod(_ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb
+0x6c2) [0x84449d2]
/usr/local/bin/
mongod(_ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_10BufBuilderERNS_14BSONObjBuilderEbi
+0x706) [0x8445db6]
/usr/local/bin/
mongod(_ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_10BufBuilderERNS_14BSONObjBuilderEbi
+0x4c) [0x8287b7c]
/usr/local/bin/
mongod(_ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_
+0x389e) [0x828c46e]
/usr/local/bin/mongod() [0x83b0327]
/usr/local/bin/
mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_8SockAddrE
+0x711) [0x83b62a1]
/usr/local/bin/mongod(_ZN5mongo10connThreadEPNS_13MessagingPortE
+0x273) [0x8523ff3]
/usr/local/bin/
mongod(_ZN5boost6detail11thread_dataINS_3_bi6bind_tIvPFvPN5mongo13MessagingPortEENS2_5list1INS2_5valueIS6_EEEEEEE3runEv
+0x18) [0x81f7468]
/usr/local/bin/mongod(thread_proxy+0x7d) [0x85385ad]
/lib/libpthread.so.0() [0xb249c9]
/lib/libc.so.6(clone+0x5e) [0xa7a48e]
Thu Jul 14 08:28:33 [conn1] query test.$cmd ntoreturn:1 command:
{ create: "test", capped: true, size: 1000000000.0, max: undefined }
reslen:106 16298ms
Thu Jul 14 08:28:40 [conn1] end connection
127.0.0.1:56123
[...]
It seems that mongo cannot create a new "data" file.
I have enough free space on the drive I'm using to handle a file of 1
GB.
Did I made a mistake on creating the collection or there's a problem?
A strange (at least, for me) thing: even if I had the error above the
collection exists and I can
insert and find data.
> db.test.insert({id:2});
> db.test.find()
{ "_id" : ObjectId("4e1eaa76a59c735g8efc620f"), "id" : 2 }
>
If I try to create collection smaller, for example with size
700000000, I have the same problem.
I create a capped collection succesfully by specifying size
500000000.
Mongodb version is 1.8.1
I started mongo like this: /usr/local/bin/mongod --fork --logpath /var/
log/mongodb.log --logappend
My test machine is a virtual machine, with 602 Mb RAM and 8 GB Disk
(5,5 GB free space).
Thanks in advance to people who will answer.