diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-07-26 19:02:27 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-08-01 15:39:24 -0400 |
commit | 7a183a3e5274cf6eadbb6146f468aa89dfb1c2b7 (patch) | |
tree | 6e0242a10dc6305a7ce7b870abf60155dd4a73a5 /src/mongo/s/catalog/dist_lock_catalog_impl.cpp | |
parent | e30faa0f9bf498680b981bbbd36c6307134bf49e (diff) | |
download | mongo-7a183a3e5274cf6eadbb6146f468aa89dfb1c2b7.tar.gz |
SERVER-28752 Use IDL write_ops everywhere instead of Batched Insert/Update/Delete
This change gets rid of the legacy manual parsers for batched
insert/update/delete commands and replaces them with the IDL-generated.
With this, the write commands parsing for mongos and mongod uses the same
code.
Diffstat (limited to 'src/mongo/s/catalog/dist_lock_catalog_impl.cpp')
-rw-r--r-- | src/mongo/s/catalog/dist_lock_catalog_impl.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mongo/s/catalog/dist_lock_catalog_impl.cpp b/src/mongo/s/catalog/dist_lock_catalog_impl.cpp index 4acb81f2497..e95a04a2ed0 100644 --- a/src/mongo/s/catalog/dist_lock_catalog_impl.cpp +++ b/src/mongo/s/catalog/dist_lock_catalog_impl.cpp @@ -361,17 +361,18 @@ Status DistLockCatalogImpl::_unlock(OperationContext* opCtx, const FindAndModify } Status DistLockCatalogImpl::unlockAll(OperationContext* opCtx, const std::string& processID) { - std::unique_ptr<BatchedUpdateDocument> updateDoc(new BatchedUpdateDocument()); - updateDoc->setQuery(BSON(LocksType::process(processID))); - updateDoc->setUpdateExpr(BSON("$set" << BSON(LocksType::state(LocksType::UNLOCKED)))); - updateDoc->setUpsert(false); - updateDoc->setMulti(true); - - std::unique_ptr<BatchedUpdateRequest> updateRequest(new BatchedUpdateRequest()); - updateRequest->addToUpdates(updateDoc.release()); - - BatchedCommandRequest request(updateRequest.release()); - request.setNS(_locksNS); + BatchedCommandRequest request([&] { + write_ops::Update updateOp(_locksNS); + updateOp.setUpdates({[&] { + write_ops::UpdateOpEntry entry; + entry.setQ(BSON(LocksType::process(processID))); + entry.setU(BSON("$set" << BSON(LocksType::state(LocksType::UNLOCKED)))); + entry.setUpsert(false); + entry.setMulti(true); + return entry; + }()}); + return updateOp; + }()); request.setWriteConcern(kLocalWriteConcern.toBSON()); BSONObj cmdObj = request.toBSON(); |