summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2013-12-13 13:30:01 -0500
committerHari Khalsa <hkhalsa@10gen.com>2013-12-13 13:34:53 -0500
commitd2c3a1d23dc49b38145748bbb0a1b3839f69a176 (patch)
tree01e1755ad7dd7a33e167f39591192472065c92ab /src/mongo/db
parent3769b3046df920d5e323a0c18475f5e0d4c891af (diff)
downloadmongo-d2c3a1d23dc49b38145748bbb0a1b3839f69a176.tar.gz
SERVER-10026 don't toString a query unless there's an error
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/query/get_runner.cpp14
-rw-r--r--src/mongo/db/query/new_find.cpp8
2 files changed, 12 insertions, 10 deletions
diff --git a/src/mongo/db/query/get_runner.cpp b/src/mongo/db/query/get_runner.cpp
index b214552bfe4..87e63113389 100644
--- a/src/mongo/db/query/get_runner.cpp
+++ b/src/mongo/db/query/get_runner.cpp
@@ -139,7 +139,8 @@ namespace mongo {
if (canonicalQuery->getParsed().hasOption(QueryOption_CursorTailable)) {
if (!collection->isCapped()) {
return Status(ErrorCodes::BadValue,
- "tailable cursor requested on non capped collection");
+ "error processing query: " + canonicalQuery->toString() +
+ " tailable cursor requested on non capped collection");
}
// If a sort is specified it must be equal to expectedSort.
@@ -147,7 +148,8 @@ namespace mongo {
const BSONObj& actualSort = canonicalQuery->getParsed().getSort();
if (!actualSort.isEmpty() && !(actualSort == expectedSort)) {
return Status(ErrorCodes::BadValue,
- "invalid sort specified for tailable cursor: "
+ "error processing query: " + canonicalQuery->toString() +
+ " invalid sort specified for tailable cursor: "
+ actualSort.toString());
}
}
@@ -185,7 +187,9 @@ namespace mongo {
vector<QuerySolution*> solutions;
Status status = QueryPlanner::plan(*canonicalQuery, plannerParams, &solutions);
if (!status.isOK()) {
- return status;
+ return Status(ErrorCodes::BadValue,
+ "error processing query: " + canonicalQuery->toString() +
+ " planner returned error: " + status.reason());
}
/*
@@ -196,7 +200,9 @@ namespace mongo {
// We cannot figure out how to answer the query. Should this ever happen?
if (0 == solutions.size()) {
- return Status(ErrorCodes::BadValue, "No query solutions");
+ return Status(ErrorCodes::BadValue,
+ "error processing query: " + canonicalQuery->toString() +
+ " No query solutions");
}
if (1 == solutions.size()) {
diff --git a/src/mongo/db/query/new_find.cpp b/src/mongo/db/query/new_find.cpp
index 817ad6ce47d..40184eaa451 100644
--- a/src/mongo/db/query/new_find.cpp
+++ b/src/mongo/db/query/new_find.cpp
@@ -395,10 +395,6 @@ namespace mongo {
// We use this a lot below.
const LiteParsedQuery& pq = cq->getParsed();
- // Need to call cq->toString() now, since upon error getRunner doesn't guarantee
- // cq is in a consistent state.
- string cqStr = cq->toString();
-
// We'll now try to get the query runner that will execute this query for us. There
// are a few cases in which we know upfront which runner we should get and, therefore,
// we shortcut the selection process here.
@@ -429,8 +425,8 @@ namespace mongo {
}
if (!status.isOK()) {
- uasserted(17007, "Unable to execute query. Reason: " + status.reason() +
- ". Query: " + cqStr);
+ // NOTE: Do not access cq as getRunner has deleted it.
+ uasserted(17007, "Unable to execute query: " + status.reason());
}
verify(NULL != rawRunner);