summaryrefslogtreecommitdiff
path: root/src/mongo/s/d_merge.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2014-05-06 11:29:26 -0400
committerRandolph Tan <randolph@10gen.com>2014-05-15 14:13:29 -0400
commitbc9db9c8183917ffbc743424fb97297e9fa75643 (patch)
tree66cc0f8b01bbdd2bb840df7191892807837e7b20 /src/mongo/s/d_merge.cpp
parentf2386b7f2941645d4d2a8538823961630bc8f15d (diff)
downloadmongo-bc9db9c8183917ffbc743424fb97297e9fa75643.tar.gz
SERVER-13385 relax merge chunk constraints
Diffstat (limited to 'src/mongo/s/d_merge.cpp')
-rw-r--r--src/mongo/s/d_merge.cpp65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/mongo/s/d_merge.cpp b/src/mongo/s/d_merge.cpp
index 713d1cafb5e..748327e7d57 100644
--- a/src/mongo/s/d_merge.cpp
+++ b/src/mongo/s/d_merge.cpp
@@ -28,7 +28,6 @@
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/db/d_concurrency.h"
-#include "mongo/db/instance.h" // needed for DBDirectClient
#include "mongo/db/namespace_string.h"
#include "mongo/s/d_logic.h"
#include "mongo/s/distlock.h"
@@ -41,8 +40,6 @@ namespace mongo {
using std::string;
using mongoutils::str::stream;
- static const int kMaxChunksToMerge = 2;
-
static BSONObj buildApplyOpsCmd( const OwnedPointerVector<ChunkType>&,
const ChunkVersion&,
const ChunkVersion& );
@@ -57,7 +54,6 @@ namespace mongo {
const BSONObj& minKey,
const BSONObj& maxKey,
const OID& epoch,
- bool onlyMergeEmpty,
string* errMsg ) {
//
@@ -231,16 +227,6 @@ namespace mongo {
return false;
}
- if ( chunksToMerge.size() > static_cast<unsigned int>( kMaxChunksToMerge ) ) {
-
- *errMsg = stream() << "could not merge chunks, collection " << nss.ns()
- << " has more than " << kMaxChunksToMerge
- << " chunks between " << rangeToString( minKey, maxKey );
-
- warning() << *errMsg << endl;
- return false;
- }
-
bool holeInRange = false;
// Look for hole in range
@@ -271,42 +257,6 @@ namespace mongo {
}
//
- // If required, verify that the chunks are empty
- //
-
- if ( onlyMergeEmpty ) {
-
- int numFullChunks = 0;
- try {
-
- for ( OwnedPointerVector<ChunkType>::const_iterator it = chunksToMerge.begin();
- it != chunksToMerge.end(); ++it ) {
-
- if ( !isEmptyChunk( **it ) ) numFullChunks++;
- if ( numFullChunks > 1 ) break;
- }
- }
- catch ( const DBException& ex ) {
-
- *errMsg = stream() << "could not merge chunks, could not count docs in "
- << nss.ns() << causedBy( ex );
-
- warning() << *errMsg << endl;
- return false;
- }
-
- if ( numFullChunks > 1 ) {
-
- *errMsg = stream() << "could not merge chunks, collection " << nss.ns()
- << " has more than one non-empty chunk between "
- << rangeToString( minKey, maxKey );
-
- warning() << *errMsg << endl;
- return false;
- }
- }
-
- //
// Run apply ops command
//
@@ -357,21 +307,6 @@ namespace mongo {
return true;
}
- // Determines if chunk is actually empty
- // THROWS EXCEPTIONS
- // Currently need to use min(), max() query operators, since $gte/$lt don't easily work for
- // compound shard key patterns and min()/max() don't work for count.
- // TODO: Cleaner mechanism coming here
- bool isEmptyChunk( const ChunkType& chunk ) {
- DBDirectClient direct;
- Query query;
- query.minKey( chunk.getMin() );
- query.maxKey( chunk.getMax() );
- vector<BSONObj> found;
- direct.findN( found, chunk.getNS(), query, 1 /* limit */ );
- return found.size() == 0;
- }
-
//
// Utilities for building BSONObjs for applyOps and change logging
//