[SERVER-4560] We must not be able to create capped collection with negative size Created: 26/Dec/11  Updated: 11/Jul/16  Resolved: 04/Jan/12

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: 2.0.2
Fix Version/s: 2.1.0

Type: Bug Priority: Major - P3
Reporter: Uladzimir Mihura Assignee: Eric Milkie
Resolution: Done Votes: 1
Labels: capped_collection, size
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 11.04 x64
Windows Server 2008 R2 x64


Operating System: ALL
Participants:

 Description   

We can create capped collection with negative size. And we can create such collection multiple times. After that we can't drop it.

MongoDB shell version: 2.0.2
connecting to: test
> use testdb
switched to db testdb
> db.dropDatabase()
{ "dropped" : "testdb", "ok" : 1 }
> db.getCollectionNames()
[ ]
> db.createCollection("tmp1", {capped: true, size: -1})
{
	"errmsg" : "exception: create collection invalid size spec",
	"code" : 10083,
	"ok" : 0
}
> db.getCollectionNames()
[ "tmp1" ]
> db.createCollection("tmp1", {capped: true, size: -1})
{
	"errmsg" : "exception: create collection invalid size spec",
	"code" : 10083,
	"ok" : 0
}
> db.getCollectionNames()
[ "tmp1", "tmp1" ]
> db.createCollection("tmp1", {capped: true, size: -1})
{
	"errmsg" : "exception: create collection invalid size spec",
	"code" : 10083,
	"ok" : 0
}
> db.getCollectionNames()
[ "tmp1", "tmp1", "tmp1" ]
> db.tmp1.drop()
false
> db.getCollectionNames()
[ "tmp1", "tmp1", "tmp1" ]



 Comments   
Comment by auto [ 29/Dec/11 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: unit test for SERVER-4560
Branch: master
https://github.com/mongodb/mongo/commit/eca9d75d11c79f0c9233ec77b261661c078d1a0e

Comment by auto [ 29/Dec/11 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-4560 avoid adding collections to the system catalog before they have been successfully created

code review 7234261
reorganized some of the code such that we only add namespaces to the catalog after we've successfully
allocated space and checked for problems
Branch: master
https://github.com/mongodb/mongo/commit/ae1ea7fcab5079531df5f2b452068b588c538c77

Generated at Thu Feb 08 03:06:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.