From 0f533dd181c9807a47b1c6fe01206d7941c015f7 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sun, 27 Feb 2011 13:35:12 -0500 Subject: [PATCH] don't take balancer lock if balancing is disable SERVER-2632 --- s/balance.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/s/balance.cpp b/s/balance.cpp index be6f0ce1b09..05703800a3a 100644 --- a/s/balance.cpp +++ b/s/balance.cpp @@ -275,6 +275,15 @@ namespace mongo { while ( ! inShutdown() ) { try { + + // first make sure we should even be running + if ( ! grid.shouldBalance() ) { + log(1) << "skipping balancing round because balancing is disabled" << endl; + sleepsecs( 30 ); + continue; + } + + ScopedDbConnection conn( config ); _ping( conn.conn() ); @@ -294,14 +303,6 @@ namespace mongo { continue; } - if ( ! grid.shouldBalance() ) { - log(1) << "skipping balancing round because balancing is disabled" << endl;; - conn.done(); - - sleepsecs( 30 ); - continue; - } - log(1) << "*** start balancing round" << endl; vector candidateChunks;