diff options
Diffstat (limited to 'src/mongo/s/balance.cpp')
-rw-r--r-- | src/mongo/s/balance.cpp | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/src/mongo/s/balance.cpp b/src/mongo/s/balance.cpp index d4fbc5cdb79..b2be36d2113 100644 --- a/src/mongo/s/balance.cpp +++ b/src/mongo/s/balance.cpp @@ -33,7 +33,6 @@ #include "mongo/client/dbclientcursor.h" #include "mongo/db/jsobj.h" #include "mongo/db/write_concern.h" -#include "mongo/db/write_concern_options.h" #include "mongo/s/chunk.h" #include "mongo/s/cluster_write.h" #include "mongo/s/config.h" @@ -62,7 +61,7 @@ namespace mongo { } int Balancer::_moveChunks(const vector<CandidateChunkPtr>* candidateChunks, - const WriteConcernOptions* writeConcern, + bool secondaryThrottle, bool waitForDelete) { int movedCount = 0; @@ -99,7 +98,7 @@ namespace mongo { BSONObj res; if (c->moveAndCommit(Shard::make(chunkInfo.to), Chunk::MaxChunkSize, - writeConcern, + secondaryThrottle, waitForDelete, 0, /* maxTimeMS */ res)) { @@ -457,16 +456,9 @@ namespace mongo { // refresh chunk size (even though another balancer might be active) Chunk::refreshChunkSize(); - SettingsType balancerConfig; - string errMsg; - - if (!grid.getBalancerSettings(&balancerConfig, &errMsg)) { - warning() << errMsg; - return ; - } - + BSONObj balancerConfig; // now make sure we should even be running - if (!grid.shouldBalance(balancerConfig)) { + if ( ! grid.shouldBalance( "", &balancerConfig ) ) { LOG(1) << "skipping balancing round because balancing is disabled" << endl; // Ping again so scripts can determine if we're active without waiting @@ -502,22 +494,20 @@ namespace mongo { continue; } - const bool waitForDelete = (balancerConfig.isWaitForDeleteSet() ? - balancerConfig.getWaitForDelete() : false); + LOG(1) << "*** start balancing round" << endl; - StatusWith<WriteConcernOptions*> extractStatus = - balancerConfig.extractWriteConcern(); - if (!extractStatus.isOK()) { - warning() << extractStatus.toString(); + bool waitForDelete = false; + if (balancerConfig["_waitForDelete"].trueValue()) { + waitForDelete = balancerConfig["_waitForDelete"].trueValue(); } - scoped_ptr<WriteConcernOptions> writeConcern(extractStatus.getValue()); + bool secondaryThrottle = true; // default to on + if ( balancerConfig[SettingsType::secondaryThrottle()].type() ) { + secondaryThrottle = balancerConfig[SettingsType::secondaryThrottle()].trueValue(); + } - LOG(1) << "*** start balancing round. " - << "waitForDelete: " << waitForDelete - << ", secondaryThrottle: " - << (writeConcern.get() ? writeConcern->toBSON().toString() : "default") - << endl; + LOG(1) << "waitForDelete: " << waitForDelete << endl; + LOG(1) << "secondaryThrottle: " << secondaryThrottle << endl; vector<CandidateChunkPtr> candidateChunks; _doBalanceRound( conn.conn() , &candidateChunks ); @@ -527,7 +517,7 @@ namespace mongo { } else { _balancedLastTime = _moveChunks(&candidateChunks, - writeConcern.get(), + secondaryThrottle, waitForDelete ); } |