diff options
author | Ian Kuehne <ian.kuehne@mongodb.com> | 2017-07-03 13:10:24 -0400 |
---|---|---|
committer | Ian Kuehne <ian.kuehne@mongodb.com> | 2017-07-03 15:58:06 -0400 |
commit | acd196d77043d007b07b48b6e2c4fb13cfa5b938 (patch) | |
tree | ffd83f977e02211f7867bed6dc67d4efed71b0fe /src/mongo/db/catalog/drop_indexes.cpp | |
parent | d362678ea9a9e4e948bfda0bc60e2fefdd1eb045 (diff) | |
download | mongo-acd196d77043d007b07b48b6e2c4fb13cfa5b938.tar.gz |
SERVER-29544 Remove deprecated macro calls.
Diffstat (limited to 'src/mongo/db/catalog/drop_indexes.cpp')
-rw-r--r-- | src/mongo/db/catalog/drop_indexes.cpp | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/src/mongo/db/catalog/drop_indexes.cpp b/src/mongo/db/catalog/drop_indexes.cpp index 2081f58d6ae..650a2acf32f 100644 --- a/src/mongo/db/catalog/drop_indexes.cpp +++ b/src/mongo/db/catalog/drop_indexes.cpp @@ -138,46 +138,47 @@ Status dropIndexes(OperationContext* opCtx, const NamespaceString& nss, const BSONObj& idxDescriptor, BSONObjBuilder* result) { - MONGO_WRITE_CONFLICT_RETRY_LOOP_BEGIN { - AutoGetDb autoDb(opCtx, nss.db(), MODE_X); + return writeConflictRetry( + opCtx, "dropIndexes", nss.db(), [opCtx, &nss, &idxDescriptor, result] { + AutoGetDb autoDb(opCtx, nss.db(), MODE_X); - bool userInitiatedWritesAndNotPrimary = opCtx->writesAreReplicated() && - !repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(opCtx, nss); + bool userInitiatedWritesAndNotPrimary = opCtx->writesAreReplicated() && + !repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(opCtx, nss); - if (userInitiatedWritesAndNotPrimary) { - return {ErrorCodes::NotMaster, - str::stream() << "Not primary while dropping indexes in " << nss.ns()}; - } - - if (!serverGlobalParams.quiet.load()) { - LOG(0) << "CMD: dropIndexes " << nss; - } + if (userInitiatedWritesAndNotPrimary) { + return Status(ErrorCodes::NotMaster, + str::stream() << "Not primary while dropping indexes in " + << nss.ns()); + } - // If db/collection does not exist, short circuit and return. - Database* db = autoDb.getDb(); - Collection* collection = db ? db->getCollection(opCtx, nss) : nullptr; - if (!db || !collection) { - if (db && db->getViewCatalog()->lookup(opCtx, nss.ns())) { - return {ErrorCodes::CommandNotSupportedOnView, - str::stream() << "Cannot drop indexes on view " << nss.ns()}; + if (!serverGlobalParams.quiet.load()) { + LOG(0) << "CMD: dropIndexes " << nss; } - return Status(ErrorCodes::NamespaceNotFound, "ns not found"); - } + // If db/collection does not exist, short circuit and return. + Database* db = autoDb.getDb(); + Collection* collection = db ? db->getCollection(opCtx, nss) : nullptr; + if (!db || !collection) { + if (db && db->getViewCatalog()->lookup(opCtx, nss.ns())) { + return Status(ErrorCodes::CommandNotSupportedOnView, + str::stream() << "Cannot drop indexes on view " << nss.ns()); + } - WriteUnitOfWork wunit(opCtx); - OldClientContext ctx(opCtx, nss.ns()); - BackgroundOperation::assertNoBgOpInProgForNs(nss); + return Status(ErrorCodes::NamespaceNotFound, "ns not found"); + } - Status status = wrappedRun(opCtx, collection, idxDescriptor, result); - if (!status.isOK()) { - return status; - } + WriteUnitOfWork wunit(opCtx); + OldClientContext ctx(opCtx, nss.ns()); + BackgroundOperation::assertNoBgOpInProgForNs(nss); - wunit.commit(); - } - MONGO_WRITE_CONFLICT_RETRY_LOOP_END(opCtx, "dropIndexes", nss.db()); - return Status::OK(); + Status status = wrappedRun(opCtx, collection, idxDescriptor, result); + if (!status.isOK()) { + return status; + } + + wunit.commit(); + return Status::OK(); + }); } } // namespace mongo |