diff options
author | Bernard Gorman <bernard.gorman@gmail.com> | 2020-02-12 02:20:57 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-02-20 01:06:01 +0000 |
commit | 82fa959d2b9686a8cd553babd0381b0e0d11574d (patch) | |
tree | c42577b190fb45119ce23247b064304dd0919f66 /src/mongo/db/query/find.cpp | |
parent | 03792669b22c6d0e2785a823e5081a6125c2d37c (diff) | |
download | mongo-82fa959d2b9686a8cd553babd0381b0e0d11574d.tar.gz |
SERVER-46091 Add new failpoint to support driver testing of ResumableChangeStreamError label
Diffstat (limited to 'src/mongo/db/query/find.cpp')
-rw-r--r-- | src/mongo/db/query/find.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp index 197475a9173..ffbae30a9ee 100644 --- a/src/mongo/db/query/find.cpp +++ b/src/mongo/db/query/find.cpp @@ -458,6 +458,22 @@ Message getMore(OperationContext* opCtx, curOp.setGenericCursor_inlock(cursorPin->toGenericCursor()); } + // If the 'failGetMoreAfterCursorCheckout' failpoint is enabled, throw an exception with the + // specified 'errorCode' value, or ErrorCodes::InternalError if 'errorCode' is omitted. + failGetMoreAfterCursorCheckout.executeIf( + [](const BSONObj& data) { + auto errorCode = (data["errorCode"] ? data["errorCode"].safeNumberLong() + : ErrorCodes::InternalError); + uasserted(errorCode, "Hit the 'failGetMoreAfterCursorCheckout' failpoint"); + }, + [&opCtx, &nss](const BSONObj& data) { + auto dataForFailCommand = + data.addField(BSON("failCommands" << BSON_ARRAY("getMore")).firstElement()); + auto* getMoreCommand = CommandHelpers::findCommand("getMore"); + return CommandHelpers::shouldActivateFailCommandFailPoint( + dataForFailCommand, nss, getMoreCommand, opCtx->getClient()); + }); + PlanExecutor::ExecState state; // We report keysExamined and docsExamined to OpDebug for a given getMore operation. To obtain |