summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/client/dbclientcursor.cpp2
-rw-r--r--src/mongo/db/commands/dbcommands.cpp10
-rw-r--r--src/mongo/db/commands/distinct.cpp5
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp12
-rw-r--r--src/mongo/db/commands/find_cmd.cpp5
-rw-r--r--src/mongo/db/commands/geo_near_cmd.cpp5
-rw-r--r--src/mongo/db/commands/group_cmd.cpp10
-rw-r--r--src/mongo/db/exec/stagedebug_cmd.cpp6
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp16
-rw-r--r--src/mongo/db/query/find.cpp4
-rw-r--r--src/mongo/db/query/plan_executor.cpp2
-rw-r--r--src/mongo/db/s/check_sharding_index_command.cpp5
-rw-r--r--src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp5
-rw-r--r--src/mongo/db/s/split_vector.cpp5
-rw-r--r--src/mongo/dbtests/documentsourcetests.cpp6
15 files changed, 36 insertions, 62 deletions
diff --git a/src/mongo/client/dbclientcursor.cpp b/src/mongo/client/dbclientcursor.cpp
index a275f984ae5..399d6cb9143 100644
--- a/src/mongo/client/dbclientcursor.cpp
+++ b/src/mongo/client/dbclientcursor.cpp
@@ -305,7 +305,7 @@ void DBClientCursor::dataReceived(const Message& reply, bool& retry, string& hos
invariant(qr.getCursorId() == 0);
if (!(opts & QueryOption_CursorTailable)) {
- uasserted(13127,
+ uasserted(ErrorCodes::CursorNotFound,
str::stream() << "cursor id " << cursorId << " didn't exist on server.");
}
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index f4950c06d5b..10954efc526 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -709,9 +709,8 @@ public:
if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) {
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error during filemd5 command: "
- << WorkingSetCommon::toStatusString(obj)));
+ WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error during filemd5 command"));
}
if (partialOk)
@@ -877,9 +876,8 @@ public:
warning() << "Internal error while reading " << ns;
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error while reading during dataSize command: "
- << WorkingSetCommon::toStatusString(obj)));
+ WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error while reading during dataSize command"));
}
ostringstream os;
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp
index ae99b5a2332..e97d9ee1933 100644
--- a/src/mongo/db/commands/distinct.cpp
+++ b/src/mongo/db/commands/distinct.cpp
@@ -245,9 +245,8 @@ public:
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error during distinct command: "
- << WorkingSetCommon::toStatusString(obj)));
+ WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error during distinct command"));
}
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index 9757e8e450d..da0f6bfc9a8 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -120,15 +120,9 @@ boost::optional<BSONObj> advanceExecutor(OperationContext* opCtx,
error() << "Plan executor error during findAndModify: " << PlanExecutor::statestr(state)
<< ", stats: " << redact(Explain::getWinningPlanStats(exec));
- if (WorkingSetCommon::isValidStatusMemberObject(value)) {
- uassertStatusOK(WorkingSetCommon::getMemberObjectStatus(value));
- MONGO_UNREACHABLE;
- }
-
- uasserted(ErrorCodes::OperationFailed,
- str::stream() << "executor returned " << PlanExecutor::statestr(state)
- << " while executing "
- << (isRemove ? "delete" : "update"));
+ uassertStatusOKWithContext(WorkingSetCommon::getMemberObjectStatus(value),
+ "Plan executor error during findAndModify");
+ MONGO_UNREACHABLE;
}
invariant(state == PlanExecutor::IS_EOF);
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 5a7bf9c0cec..6de36e438e8 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -359,9 +359,8 @@ public:
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error during find command: "
- << WorkingSetCommon::toStatusString(obj)));
+ WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error during find command"));
}
// Before saving the cursor, ensure that whatever plan we established happened with the
diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp
index 6fff31aabd5..d605fbb86b8 100644
--- a/src/mongo/db/commands/geo_near_cmd.cpp
+++ b/src/mongo/db/commands/geo_near_cmd.cpp
@@ -303,9 +303,8 @@ public:
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error during geoNear command: "
- << WorkingSetCommon::toStatusString(currObj)));
+ WorkingSetCommon::getMemberObjectStatus(currObj).withContext(
+ "Executor error during geoNear command"));
}
PlanSummaryStats summary;
diff --git a/src/mongo/db/commands/group_cmd.cpp b/src/mongo/db/commands/group_cmd.cpp
index c4c67983ed8..3441e23a1ea 100644
--- a/src/mongo/db/commands/group_cmd.cpp
+++ b/src/mongo/db/commands/group_cmd.cpp
@@ -184,16 +184,10 @@ private:
if (PlanExecutor::ADVANCED != state) {
invariant(PlanExecutor::FAILURE == state || PlanExecutor::DEAD == state);
- if (WorkingSetCommon::isValidStatusMemberObject(retval)) {
- return CommandHelpers::appendCommandStatus(
- result, WorkingSetCommon::getMemberObjectStatus(retval));
- }
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::BadValue,
- str::stream() << "error encountered during group "
- << "operation, executor returned "
- << PlanExecutor::statestr(state)));
+ WorkingSetCommon::getMemberObjectStatus(retval).withContext(
+ "Plan executor error during group command"));
}
invariant(planExecutor->isEOF());
diff --git a/src/mongo/db/exec/stagedebug_cmd.cpp b/src/mongo/db/exec/stagedebug_cmd.cpp
index 92b9908f2a3..6d6bfc1a896 100644
--- a/src/mongo/db/exec/stagedebug_cmd.cpp
+++ b/src/mongo/db/exec/stagedebug_cmd.cpp
@@ -211,10 +211,8 @@ public:
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error during "
- << "StageDebug command: "
- << WorkingSetCommon::toStatusString(obj)));
+ WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error during StageDebug command"));
}
return true;
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index 10d049cef28..10fe39a1484 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -133,23 +133,15 @@ void DocumentSourceCursor::loadBatch() {
case PlanExecutor::ADVANCED:
case PlanExecutor::IS_EOF:
return; // We've reached our limit or exhausted the cursor.
- case PlanExecutor::DEAD: {
- _execStatus =
- Status(ErrorCodes::QueryPlanKilled,
- str::stream() << "collection or index disappeared when cursor yielded: "
- << WorkingSetCommon::toStatusString(resultObj));
- break;
- }
+ case PlanExecutor::DEAD:
case PlanExecutor::FAILURE: {
- _execStatus = Status(ErrorCodes::Error(17285),
- str::stream() << "cursor encountered an error: "
- << WorkingSetCommon::toStatusString(resultObj));
- break;
+ _execStatus = WorkingSetCommon::getMemberObjectStatus(resultObj).withContext(
+ "Error in $cursor stage");
+ uassertStatusOK(_execStatus);
}
default:
MONGO_UNREACHABLE;
}
- uassertStatusOK(_execStatus);
}
Pipeline::SourceContainer::iterator DocumentSourceCursor::doOptimizeAt(
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 8b01d239967..8d754771d8a 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -677,7 +677,9 @@ std::string runQuery(OperationContext* opCtx,
if (PlanExecutor::FAILURE == state || PlanExecutor::DEAD == state) {
error() << "Plan executor error during find: " << PlanExecutor::statestr(state)
<< ", stats: " << redact(Explain::getWinningPlanStats(exec.get()));
- uasserted(17144, "Executor error: " + WorkingSetCommon::toStatusString(obj));
+ uassertStatusOKWithContext(WorkingSetCommon::getMemberObjectStatus(obj),
+ "Executor error during OP_QUERY find");
+ MONGO_UNREACHABLE;
}
// Before saving the cursor, ensure that whatever plan we established happened with the expected
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index a85210d0751..54d56cfb313 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -488,7 +488,7 @@ PlanExecutor::ExecState PlanExecutor::waitForInserts(CappedInsertNotifierData* n
PlanExecutor::ExecState PlanExecutor::getNextImpl(Snapshotted<BSONObj>* objOut, RecordId* dlOut) {
if (MONGO_FAIL_POINT(planExecutorAlwaysFails)) {
- Status status(ErrorCodes::OperationFailed,
+ Status status(ErrorCodes::InternalError,
str::stream() << "PlanExecutor hit planExecutorAlwaysFails fail point");
*objOut =
Snapshotted<BSONObj>(SnapshotId(), WorkingSetCommon::buildMemberStatusObject(status));
diff --git a/src/mongo/db/s/check_sharding_index_command.cpp b/src/mongo/db/s/check_sharding_index_command.cpp
index 2d0d499fb1b..b638c9a0e7d 100644
--- a/src/mongo/db/s/check_sharding_index_command.cpp
+++ b/src/mongo/db/s/check_sharding_index_command.cpp
@@ -202,9 +202,8 @@ public:
if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) {
return CommandHelpers::appendCommandStatus(
result,
- Status(ErrorCodes::OperationFailed,
- str::stream() << "Executor error while checking sharding index: "
- << WorkingSetCommon::toStatusString(currKey)));
+ WorkingSetCommon::getMemberObjectStatus(currKey).withContext(
+ "Executor error while checking sharding index"));
}
return true;
diff --git a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
index 977c736458e..220e2658a35 100644
--- a/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
+++ b/src/mongo/db/s/migration_chunk_cloner_source_legacy.cpp
@@ -670,9 +670,8 @@ Status MigrationChunkClonerSourceLegacy::_storeCurrentLocs(OperationContext* opC
}
if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) {
- return {ErrorCodes::InternalError,
- str::stream() << "Executor error while scanning for documents belonging to chunk: "
- << WorkingSetCommon::toStatusString(obj)};
+ return WorkingSetCommon::getMemberObjectStatus(obj).withContext(
+ "Executor error while scanning for documents belonging to chunk");
}
const uint64_t collectionAverageObjectSize = collection->averageObjectSize(opCtx);
diff --git a/src/mongo/db/s/split_vector.cpp b/src/mongo/db/s/split_vector.cpp
index 3fd68070786..9b7bcdaa2eb 100644
--- a/src/mongo/db/s/split_vector.cpp
+++ b/src/mongo/db/s/split_vector.cpp
@@ -215,9 +215,8 @@ StatusWith<std::vector<BSONObj>> splitVector(OperationContext* opCtx,
}
if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) {
- return {ErrorCodes::OperationFailed,
- "Executor error during splitVector command: " +
- WorkingSetCommon::toStatusString(currKey)};
+ return WorkingSetCommon::getMemberObjectStatus(currKey).withContext(
+ "Executor error during splitVector command");
}
if (!force)
diff --git a/src/mongo/dbtests/documentsourcetests.cpp b/src/mongo/dbtests/documentsourcetests.cpp
index 98ab5fc9e68..ebfaccbde5c 100644
--- a/src/mongo/dbtests/documentsourcetests.cpp
+++ b/src/mongo/dbtests/documentsourcetests.cpp
@@ -388,7 +388,8 @@ TEST_F(DocumentSourceCursorTest, TailableAwaitDataCursorShouldErrorAfterTimeout)
DocumentSourceCursor::create(readLock.getCollection(), std::move(planExecutor), ctx());
ON_BLOCK_EXIT([cursor]() { cursor->dispose(); });
- ASSERT_THROWS_CODE(cursor->getNext().isEOF(), AssertionException, ErrorCodes::QueryPlanKilled);
+ ASSERT_THROWS_CODE(
+ cursor->getNext().isEOF(), AssertionException, ErrorCodes::ExceededTimeLimit);
}
TEST_F(DocumentSourceCursorTest, NonAwaitDataCursorShouldErrorAfterTimeout) {
@@ -425,7 +426,8 @@ TEST_F(DocumentSourceCursorTest, NonAwaitDataCursorShouldErrorAfterTimeout) {
DocumentSourceCursor::create(readLock.getCollection(), std::move(planExecutor), ctx());
ON_BLOCK_EXIT([cursor]() { cursor->dispose(); });
- ASSERT_THROWS_CODE(cursor->getNext().isEOF(), AssertionException, ErrorCodes::QueryPlanKilled);
+ ASSERT_THROWS_CODE(
+ cursor->getNext().isEOF(), AssertionException, ErrorCodes::ExceededTimeLimit);
}
TEST_F(DocumentSourceCursorTest, TailableAwaitDataCursorShouldErrorAfterBeingKilled) {