Skip to content

Commit d2d30af

Browse files
author
Hari Khalsa
committed
SERVER-10026 fix qlog to be faster
1 parent a1162d8 commit d2d30af

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

src/mongo/db/query/qlog.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ namespace mongo {
3434

3535
MONGO_EXPORT_SERVER_PARAMETER(verboseQueryLogging, bool, false);
3636

37-
class nullstream : public std::ostream {
38-
public:
39-
nullstream() : std::ios(0), std::ostream(0) { }
40-
};
41-
42-
static nullstream theNullStream;
43-
4437
bool qlogOff() {
4538
bool old = verboseQueryLogging;
4639
verboseQueryLogging = false;
@@ -53,14 +46,4 @@ namespace mongo {
5346
return old;
5447
}
5548

56-
std::ostream& QLOG() {
57-
if (verboseQueryLogging) {
58-
return std::cout;
59-
}
60-
else {
61-
return theNullStream;
62-
}
63-
}
64-
6549
} // namespace mongo
66-

src/mongo/db/query/qlog.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232

3333
namespace mongo {
3434

35-
std::ostream& QLOG();
35+
extern bool verboseQueryLogging;
36+
37+
// With a #define like this, we don't evaluate the costly toString()s that are QLOG'd
38+
#define QLOG() if (verboseQueryLogging) log()
3639

3740
bool qlogOff();
3841
bool qlogOn();

src/mongo/db/query/query_planner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace mongo {
5555
INCLUDE_SHARD_FILTER = 4,
5656

5757
// Set this if you don't want any plans with a blocking sort stage. All sorts must be
58-
// provided by the index.
58+
// provided by an index.
5959
NO_BLOCKING_SORT = 8,
6060
};
6161

0 commit comments

Comments
 (0)