Skip to content

Commit 554b31c

Browse files
author
Hari Khalsa
committed
SERVER-10026 use server parameter for triggering query system
1 parent 827b085 commit 554b31c

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

src/mongo/db/ops/query.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@
4343

4444
namespace mongo {
4545

46-
/**
47-
* Set in db/query/new_find.cpp. If true, use the new query system to handle queries.
48-
*/
49-
extern bool useNewQuerySystem;
50-
5146
/* We cut off further objects once we cross this threshold; thus, you might get
5247
a little bit more than this, it is a threshold rather than a limit.
5348
*/
@@ -115,7 +110,7 @@ namespace mongo {
115110
int pass,
116111
bool& exhaust,
117112
bool* isCursorAuthorized ) {
118-
if (useNewQuerySystem) {
113+
if (isNewQueryFrameworkEnabled()) {
119114
return newGetMore(ns, ntoreturn, cursorid, curop, pass, exhaust, isCursorAuthorized);
120115
}
121116

@@ -1065,7 +1060,7 @@ namespace mongo {
10651060
uassert( 10110 , "bad query object", false);
10661061
}
10671062

1068-
if (useNewQuerySystem) {
1063+
if (isNewQueryFrameworkEnabled()) {
10691064
// TODO: Copy prequel curop debugging into runNewQuery
10701065
return newRunQuery(m, q, curop, result);
10711066
}

src/mongo/db/query/new_find.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,21 @@
2828
#include "mongo/db/query/single_solution_runner.h"
2929
#include "mongo/db/query/stage_builder.h"
3030
#include "mongo/db/repl/repl_reads_ok.h"
31+
#include "mongo/db/server_parameters.h"
3132
#include "mongo/s/chunk_version.h"
3233
#include "mongo/s/d_logic.h"
3334
#include "mongo/s/stale_exception.h"
3435

3536
namespace mongo {
3637

38+
// Server parameter
39+
MONGO_EXPORT_SERVER_PARAMETER(newQueryFrameworkEnabled, bool, false);
40+
41+
bool isNewQueryFrameworkEnabled() { return newQueryFrameworkEnabled; }
42+
3743
// Copied from db/ops/query.cpp.
3844
static const int32_t MaxBytesToReturnToClientAtOnce = 4 * 1024 * 1024;
3945

40-
// Used in db/ops/query.cpp.
41-
bool useNewQuerySystem = false;
42-
4346
/**
4447
* For a given query, get a runner. The runner could be a SingleSolutionRunner, a
4548
* CachedQueryRunner, or a MultiPlanRunner, depending on the cache/query solver/etc.

src/mongo/db/query/new_find.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,20 @@
2424

2525
namespace mongo {
2626

27+
/**
28+
* A switch to choose between old Cursor-based code and new Runner-based code.
29+
*/
30+
bool isNewQueryFrameworkEnabled();
31+
32+
/**
33+
* Called from the getMore entry point in ops/query.cpp.
34+
*/
2735
QueryResult* newGetMore(const char* ns, int ntoreturn, long long cursorid, CurOp& curop,
2836
int pass, bool& exhaust, bool* isCursorAuthorized);
2937

38+
/**
39+
* Called from the runQuery entry point in ops/query.cpp.
40+
*/
3041
string newRunQuery(Message& m, QueryMessage& q, CurOp& curop, Message &result);
3142

3243
} // namespace mongo

0 commit comments

Comments
 (0)