summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@10gen.com>2012-10-15 16:42:39 -0700
committerMathias Stearn <redbeard0531@gmail.com>2013-03-06 17:33:41 -0500
commit69035fca654edfa038e17d1c4543206c48708f6b (patch)
tree6272af79a3f6d6d8577d982a9d64eb7f3ec6d938
parent61bde93234ed57ce716eabd1c6fbc32b616778b2 (diff)
downloadmongo-69035fca654edfa038e17d1c4543206c48708f6b.tar.gz
SERVER-7231 Construct log helper variables only when they will be logged
-rw-r--r--src/mongo/client/parallel.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/mongo/client/parallel.cpp b/src/mongo/client/parallel.cpp
index d8f9726a45a..8bd387c1574 100644
--- a/src/mongo/client/parallel.cpp
+++ b/src/mongo/client/parallel.cpp
@@ -774,8 +774,14 @@ namespace mongo {
ShardPtr primary;
string prefix;
- if( _totalTries > 0 ) prefix = str::stream() << "retrying (" << _totalTries << " tries)";
- else prefix = "creating";
+ if (MONGO_unlikely(logLevel >= pc)) {
+ if( _totalTries > 0 ) {
+ prefix = str::stream() << "retrying (" << _totalTries << " tries)";
+ }
+ else {
+ prefix = "creating";
+ }
+ }
LOG( pc ) << prefix << " pcursor over " << _qSpec << " and " << _cInfo << endl;
set<Shard> todoStorage;
@@ -790,8 +796,16 @@ namespace mongo {
// Try to get either the chunk manager or the primary shard
config->getChunkManagerOrPrimary( ns, manager, primary );
- if( manager ) vinfo = ( str::stream() << "[" << manager->getns() << " @ " << manager->getVersion().toString() << "]" );
- else vinfo = (str::stream() << "[unsharded @ " << primary->toString() << "]" );
+ if (MONGO_unlikely(logLevel >= pc)) {
+ if (manager) {
+ vinfo = str::stream() << "[" << manager->getns() << " @ "
+ << manager->getVersion().toString() << "]";
+ }
+ else {
+ vinfo = str::stream() << "[unsharded @ "
+ << primary->toString() << "]";
+ }
+ }
if( manager ) manager->getShardsForQuery( todo, specialFilter ? _cInfo.cmdFilter : _qSpec.filter() );
else if( primary ) todo.insert( *primary );
@@ -810,8 +824,9 @@ namespace mongo {
// Don't use version to get shards here
todo = _qShards;
- vinfo = str::stream() << "[" << _qShards.size() << " shards specified]";
-
+ if (MONGO_unlikely(logLevel >= pc)) {
+ vinfo = str::stream() << "[" << _qShards.size() << " shards specified]";
+ }
}
verify( todo.size() );