diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2019-09-10 19:03:36 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-10 19:03:36 +0000 |
commit | 5a0f718e1309a4484580d8038016d043ef3b887f (patch) | |
tree | 7a331d57ba6e33e61f96ed69b2aa387003a039ab /src/mongo/db/op_observer_impl.cpp | |
parent | b9e29cd56ebc9aca06f68eeeda7c523d3dfd6d41 (diff) | |
download | mongo-5a0f718e1309a4484580d8038016d043ef3b887f.tar.gz |
SERVER-43119 FailPoint cleanup
- Don't use MONGO_INITIALIZER to declare each fail point.
We only need one init task in total: freeze and iterate the registry.
- remove MONGO_FAIL_POINT_DECLARE macro (extern)
- remove MONGO_FAIL_POINT_SHOULD_FAIL macro (FailPoint::shouldFail)
- remove MONGO_FAIL_POINT_BLOCK_IF (FailPoint::executeIf)
- remove MONGO_FAIL_POINT_BLOCK (FailPoint::execute)
- clean up FailPointRegistry and fail_point_service implementation.
Diffstat (limited to 'src/mongo/db/op_observer_impl.cpp')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index 4ba8d17eea1..2ccfa6fa5dc 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -413,16 +413,18 @@ void OpObserverImpl::onInserts(OperationContext* opCtx, } void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArgs& args) { - MONGO_FAIL_POINT_BLOCK(failCollectionUpdates, extraData) { - auto collElem = extraData.getData()["collectionNS"]; - // If the failpoint specifies no collection or matches the existing one, fail. - if (!collElem || args.nss.ns() == collElem.String()) { + failCollectionUpdates.executeIf( + [&](const BSONObj&) { uasserted(40654, str::stream() << "failCollectionUpdates failpoint enabled, namespace: " << args.nss.ns() << ", update: " << args.updateArgs.update << " on document with " << args.updateArgs.criteria); - } - } + }, + [&](const BSONObj& data) { + // If the failpoint specifies no collection or matches the existing one, fail. + auto collElem = data["collectionNS"]; + return !collElem || args.nss.ns() == collElem.String(); + }); // Do not log a no-op operation; see SERVER-21738 if (args.updateArgs.update.isEmpty()) { |