summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.cpp
diff options
context:
space:
mode:
authorJason Carey <jcarey@argv.me>2019-03-05 12:32:07 -0500
committerJason Carey <jcarey@argv.me>2019-03-06 11:54:28 -0500
commit39b7722f44e2124ad46c19f95d4059985e7d4132 (patch)
tree7ac6fa40c1a693cd302e4701c76584013d57c7ba /src/mongo/db/operation_context.cpp
parent5926b6e06fec4f37e13740dc2eef8b5c7a806138 (diff)
downloadmongo-39b7722f44e2124ad46c19f95d4059985e7d4132.tar.gz
SERVER-38175 invariant on markKill w extra info
The OperationContext class accepts an ErrorCodes::Error for markKilled() and deadline-setting methods. This error code may be converted to a Status object on checkForInterruptNoAssert() or waitForConditionOrInterruptNoAssertUntil() call. When the error code is one that is associated with an ErrorExtraInfo object, Status construction will fail as we expect Status construction to either include a subclass of ErrorExtraInfo or a BSONObj from which it can be serialized. Until a use case comes up, add an invariant to prevent passing an error code with extra info
Diffstat (limited to 'src/mongo/db/operation_context.cpp')
-rw-r--r--src/mongo/db/operation_context.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp
index 8e27a84b189..271ea547fa2 100644
--- a/src/mongo/db/operation_context.cpp
+++ b/src/mongo/db/operation_context.cpp
@@ -93,6 +93,7 @@ void OperationContext::setDeadlineAndMaxTime(Date_t when,
ErrorCodes::Error timeoutError) {
invariant(!getClient()->isInDirectClient() || _hasArtificialDeadline);
invariant(ErrorCodes::isExceededTimeLimitError(timeoutError));
+ invariant(!ErrorExtraInfo::parserFor(timeoutError));
uassert(40120,
"Illegal attempt to change operation deadline",
_hasArtificialDeadline || !hasDeadline());
@@ -345,6 +346,7 @@ StatusWith<stdx::cv_status> OperationContext::waitForConditionOrInterruptNoAsser
void OperationContext::markKilled(ErrorCodes::Error killCode) {
invariant(killCode != ErrorCodes::OK);
+ invariant(!ErrorExtraInfo::parserFor(killCode));
if (killCode == ErrorCodes::ClientDisconnect) {
log() << "operation was interrupted because a client disconnected";