Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not require _id index for capped collection update SERVER-4546

  • Loading branch information...
commit ad9f37fddbbbf4b4bbcdb2ae1870f0cc9d0f5eb9 1 parent dd04610
@kchodorow kchodorow authored
Showing with 12 additions and 5 deletions.
  1. +12 −5 db/oplog.cpp
View
17 db/oplog.cpp
@@ -741,11 +741,18 @@ namespace mongo {
// of the form
// { _id:..., { x : {$size:...} }
// thus this is not ideal.
- else if( nsdetails(ns) == NULL || Helpers::findById(nsdetails(ns), updateCriteria).isNull() ) {
- failedUpdate = true;
- }
- else {
- // it's present; zero objects were updated because of additional specifiers in the query for idempotence
+ else {
+ NamespaceDetails *nsd = nsdetails(ns);
+
+ if (nsd == NULL ||
+ (nsd->findIdIndex() >= 0 && Helpers::findById(nsd, updateCriteria).isNull()) ||
+ // capped collections won't have an _id index
+ (nsd->findIdIndex() < 0 && Helpers::findOne(ns, updateCriteria, false).isNull())) {
+ failedUpdate = true;
+ }
+
+ // Otherwise, it's present; zero objects were updated because of additional specifiers
+ // in the query for idempotence
}
}
else {
Please sign in to comment.
Something went wrong with that request. Please try again.