diff options
author | Kristina <kristina@10gen.com> | 2012-02-15 10:19:38 -0500 |
---|---|---|
committer | Kristina <kristina@10gen.com> | 2012-02-15 10:19:38 -0500 |
commit | 8849484b70ed0bbaf820e6fc49168fc399129bbc (patch) | |
tree | 72ff4128ecfd6ca05360f09cea2a8be749fea259 | |
parent | 8c259b9984bb4a791c879438cd1def3b40455041 (diff) | |
download | mongo-8849484b70ed0bbaf820e6fc49168fc399129bbc.tar.gz |
Replication should not create _id index for capped collections SERVER-4626
-rw-r--r-- | db/oplog.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/db/oplog.cpp b/db/oplog.cpp index 2781508d04a..6e62607949c 100644 --- a/db/oplog.cpp +++ b/db/oplog.cpp @@ -687,6 +687,7 @@ namespace mongo { o = fields[0].embeddedObject(); const char *ns = fields[1].valuestrsafe(); + NamespaceDetails *nsd = nsdetails(ns); // operation type -- see logOp() comments for types const char *opType = fields[2].valuestrsafe(); @@ -714,7 +715,7 @@ namespace mongo { } else { /* erh 10/16/2009 - this is probably not relevant any more since its auto-created, but not worth removing */ - RARELY ensureHaveIdIndex(ns); // otherwise updates will be slow + RARELY if (nsd && !nsd->capped) { ensureHaveIdIndex(ns); } // otherwise updates will be slow /* todo : it may be better to do an insert here, and then catch the dup key exception and do update then. very few upserts will not be inserts... @@ -731,9 +732,9 @@ namespace mongo { // - if not, updates would be slow // - but if were by id would be slow on primary too so maybe ok // - if on primary was by another key and there are other indexes, this could be very bad w/out an index - // - if do create, odd to have on secondary but not primary. also can cause secondary to block for - // quite a while on creation. - RARELY ensureHaveIdIndex(ns); // otherwise updates will be super slow + // - if do create, odd to have on secondary but not primary. also can cause secondary to block for + // quite a while on creation. + RARELY if (nsd && !nsd->capped) { ensureHaveIdIndex(ns); } // otherwise updates will be super slow OpDebug debug; BSONObj updateCriteria = op.getObjectField("o2"); bool upsert = fields[3].booleanSafe(); @@ -751,7 +752,6 @@ namespace mongo { // { _id:..., { x : {$size:...} } // thus this is not ideal. else { - NamespaceDetails *nsd = nsdetails(ns); if (nsd == NULL || (nsd->findIdIndex() >= 0 && Helpers::findById(nsd, updateCriteria).isNull()) || |