Skip to content

Commit

Permalink
SERVER-485 fix validate on capped collection
Browse files Browse the repository at this point in the history
  • Loading branch information
dwight committed Dec 30, 2009
1 parent b88f54e commit 9f20ce7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions db/dbcommands_admin.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ namespace mongo {
ndel++; ndel++;


if ( loc.questionable() ) { if ( loc.questionable() ) {
if( d->capped && !loc.isValid() && i == 1 ) {
/* [dm] the constructor for NamespaceDetails intentionally sets deletedList[1] to invalid -- presumably as
a defensive measure? (can't remember). So we allow it here.
*/
break;
}

if ( loc.a() <= 0 || strstr(ns, "hudsonSmall") == 0 ) { if ( loc.a() <= 0 || strstr(ns, "hudsonSmall") == 0 ) {
ss << " ?bad deleted loc: " << loc.toString() << " bucket:" << i << " k:" << k << endl; ss << " ?bad deleted loc: " << loc.toString() << " bucket:" << i << " k:" << k << endl;
valid = false; valid = false;
Expand Down
2 changes: 1 addition & 1 deletion jstests/capped1.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ t.drop();


db.createCollection("capped1" , {capped:true, size:1024 }); db.createCollection("capped1" , {capped:true, size:1024 });
v = t.validate(); v = t.validate();
//assert( v.valid , "A : " + tojson( v ) ); // SERVER-485 assert( v.valid , "A : " + tojson( v ) ); // SERVER-485


t.save( { x : 1 } ) t.save( { x : 1 } )
assert( t.validate().valid , "B" ) assert( t.validate().valid , "B" )
Expand Down

0 comments on commit 9f20ce7

Please sign in to comment.