summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2017-11-06 13:23:36 -0500
committerJustin Seyster <justin.seyster@mongodb.com>2017-11-06 13:34:35 -0500
commit95bfa3866791e007de917982f215d1d8f40bc0f4 (patch)
treea564bd78c16f49e78e45cdc0b9fb275a91a1a1da
parent87d4378a2d6749ac1977b0aff05cc9ae22e06d2f (diff)
downloadmongo-95bfa3866791e007de917982f215d1d8f40bc0f4.tar.gz
SERVER-31730 Preserve getNext status in PlanExecutor::executePlan().
It is possible for an update that gets interrupted because a primary node stepped down to result in an error return from PlanExecutor::getNext(), which ultimately propagates to the client. Clients should know to retry any operation that fails for this reason, but in PlanExecutor::executePlan(), the status code gets rewritten to be OperationFailed, which clients do not know to retry. This patch preserves the original error code, so that clients do the right thing. commit f6581038d95314794fcfc84f24253653a1ff861e Author: Justin Seyster <justin.seyster@mongodb.com> Date: Fri Oct 27 16:56:59 2017 -0400 SERVER-31730 Preserve getNext status in PlanExecutor::executePlan().
-rw-r--r--src/mongo/db/query/plan_executor.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index 5862d8bf813..e1ae5988b3a 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -671,10 +671,10 @@ Status PlanExecutor::executePlan() {
str::stream() << "Operation aborted because: " << *_killReason);
}
- return Status(ErrorCodes::OperationFailed,
- str::stream() << "Exec error: " << WorkingSetCommon::toStatusString(obj)
- << ", state: "
- << PlanExecutor::statestr(state));
+ auto errorStatus = WorkingSetCommon::getMemberObjectStatus(obj);
+ invariant(!errorStatus.isOK());
+ return errorStatus.withContext(str::stream() << "Exec error resulting in state "
+ << PlanExecutor::statestr(state));
}
invariant(!isMarkedAsKilled());