diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-03-09 13:12:17 -0400 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2015-03-09 16:20:22 -0400 |
commit | a56f29e60d872bb6334a24dd732d500b3ae52b48 (patch) | |
tree | 9d0fae4c343cb9656a818bd196bd163ff14fbe50 /src | |
parent | 5e19cde316e4493dc2548d239cdf7763683e7897 (diff) | |
download | mongo-a56f29e60d872bb6334a24dd732d500b3ae52b48.tar.gz |
SERVER-17487 Use strict unindex operations for in-progress indexes
(cherry picked from commit 378f8dd985cb3c8d03b384d9671abff92693c7f5)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/index_catalog.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/cloner.cpp | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp index 3e00ed23121..24736eb590b 100644 --- a/src/mongo/db/catalog/index_catalog.cpp +++ b/src/mongo/db/catalog/index_catalog.cpp @@ -1088,6 +1088,11 @@ namespace { options.logIfError = logIfError; options.dupsAllowed = isDupsAllowed( index->descriptor() ); + // For unindex operations, dupsAllowed=false really means that it is safe to delete anything + // that matches the key, without checking the RecordID, since dups are impossible. We need + // to disable this behavior for in-progress indexes. See SERVER-17487 for more details. + options.dupsAllowed = options.dupsAllowed || !index->isReady(txn); + int64_t removed; Status status = index->accessMethod()->remove(txn, obj, loc, options, &removed); diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp index 5e691f3b4c9..f0682da2e44 100644 --- a/src/mongo/db/cloner.cpp +++ b/src/mongo/db/cloner.cpp @@ -639,6 +639,8 @@ namespace mongo { uassertStatusOK(indexer.init(c->getIndexCatalog()->getDefaultIdIndexSpec())); uassertStatusOK(indexer.insertAllDocumentsInCollection(&dups)); + // This must be done before we commit the indexer. See the comment about + // dupsAllowed in IndexCatalog::_unindexRecord and SERVER-17487. for (set<RecordId>::const_iterator it = dups.begin(); it != dups.end(); ++it) { WriteUnitOfWork wunit(txn); BSONObj id; |