diff options
author | Eliot Horowitz <eliot@10gen.com> | 2011-11-16 15:36:13 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2011-11-16 16:11:39 -0500 |
commit | 7e3de32bcced4805b6b4a005f44714a88f504d4a (patch) | |
tree | ed1b93173b5fd2d2b44b4cf3feab666458cf5774 /s | |
parent | e82af25e9cf6a5dd2883506fae938e4b39560ae6 (diff) | |
download | mongo-7e3de32bcced4805b6b4a005f44714a88f504d4a.tar.gz |
limit number of concurrent splitVectors SERVER-4296
Diffstat (limited to 's')
-rw-r--r-- | s/chunk.cpp | 10 | ||||
-rw-r--r-- | s/chunk.h | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/s/chunk.cpp b/s/chunk.cpp index 33b401a03f2..066265e1104 100644 --- a/s/chunk.cpp +++ b/s/chunk.cpp @@ -342,6 +342,12 @@ namespace mongo { if ( _dataWritten < splitThreshold / 5 ) return false; + + if ( ! getManager()->_splitTickets.tryAcquire() ) { + LOG(1) << "won't auto split becaue not enough tickets: " << getManager()->getns() << endl; + return false; + } + TicketHolderReleaser releaser( &getManager()->_splitTickets ); // this is a bit ugly // we need it so that mongos blocks for the writes to actually be committed @@ -504,7 +510,9 @@ namespace mongo { // The shard versioning mechanism hinges on keeping track of the number of times we reloaded ChunkManager's. // Increasing this number here will prompt checkShardVersion() to refresh the connection-level versions to // the most up to date value. - _sequenceNumber(++NextSequenceNumber) + _sequenceNumber(++NextSequenceNumber), + + _splitTickets( 5 ) { int tries = 3; diff --git a/s/chunk.h b/s/chunk.h index 8126af3a06e..3e981e90103 100644 --- a/s/chunk.h +++ b/s/chunk.h @@ -353,6 +353,8 @@ namespace mongo { const unsigned long long _sequenceNumber; + mutable TicketHolder _splitTickets; // number of concurrent splitVector we can do from a splitIfShould per collection + friend class Chunk; friend class ChunkRangeManager; // only needed for CRM::assertValid() static AtomicUInt NextSequenceNumber; |