summaryrefslogtreecommitdiff
path: root/src/mongo/client/parallel.cpp
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@10gen.com>2012-10-15 16:42:39 -0700
committerShaun Verch <shaun.verch@10gen.com>2012-10-24 12:41:34 -0700
commitb5c8d777741147f5b9b7cfa89b5e69374d5c9d2d (patch)
tree94303430a3fbe264bb1316d3e0bc1613d36c9104 /src/mongo/client/parallel.cpp
parent4db60cf23b58a7a5e177e69c142ab9e1503a3b1b (diff)
downloadmongo-b5c8d777741147f5b9b7cfa89b5e69374d5c9d2d.tar.gz
SERVER-7231 Construct log helper variables only when they will be logged
Diffstat (limited to 'src/mongo/client/parallel.cpp')
-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 e6adb49ede1..32210cc127c 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() );