0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

splits are now done by the mongod side

This commit is contained in:
Alberto Lerner 2010-10-27 17:13:47 -04:00
parent 8a50d05676
commit 910044f28a
3 changed files with 12 additions and 10 deletions

View File

@ -283,17 +283,17 @@ namespace mongo {
return ChunkPtr();
}
//return multiSplit_DEPRECATED( splitPoint );
return multiSplit( splitPoint );
//return multiSplit_ForDevOnly( splitPoint );
}
ChunkPtr Chunk::multiSplit_ForDevOnly( const vector<BSONObj>& m ) {
ChunkPtr Chunk::multiSplit( const vector<BSONObj>& m ) {
// TODO use current multiSplit asserts here
ScopedDbConnection conn( getShard().getConnString() );
BSONObj result;
BSONObjBuilder cmd;
cmd.append( "splitChunk_ForDevOnly" , _manager->getns() );
cmd.append( "splitChunk" , _manager->getns() );
cmd.append( "keyPattern" , _manager->getShardKey().key() );
cmd.append( "min" , getMin() );
cmd.append( "max" , getMax() );
@ -329,8 +329,7 @@ namespace mongo {
return _manager->findChunk( m[0] );
}
/* to be deprecated */
ChunkPtr Chunk::multiSplit( const vector<BSONObj>& m ){
ChunkPtr Chunk::multiSplit_DEPRECATED( const vector<BSONObj>& m ){
dist_lock_try dlk( &_manager->_nsLock , string("split-") + toString() );
uassert( 10166 , "locking namespace failed" , dlk.got() );
@ -1030,7 +1029,10 @@ namespace mongo {
}
void ChunkManager::save_inlock( bool major ){
// we do not update update the chunk manager on the mongos side any more
// the only exception case should be first chunk creation
assert( _chunkMap.size() == 1 );
ShardChunkVersion version = getVersion_inlock();
assert( version > 0 || _chunkMap.size() <= 1 );
ShardChunkVersion nextChunkVersion = version;

View File

@ -124,8 +124,8 @@ namespace mongo {
* @param splitPoints the vector of keys that should be used to divide this chunk
* @return shared pointer to the first new Chunk
*/
/* to be deprecated */ ChunkPtr multiSplit( const vector<BSONObj>& splitPoints );
ChunkPtr multiSplit_ForDevOnly( const vector<BSONObj>& splitPoints );
ChunkPtr multiSplit_DEPRECATED( const vector<BSONObj>& splitPoints );
ChunkPtr multiSplit( const vector<BSONObj>& splitPoints );
/**
* Asks the mongod holding this chunk to find a key that approximately divides this chunk in two

View File

@ -372,10 +372,10 @@ namespace mongo {
class SplitChunkCommand : public Command {
public:
SplitChunkCommand() : Command( "splitChunk_ForDevOnly" ){}
SplitChunkCommand() : Command( "splitChunk" ){}
virtual void help( stringstream& help ) const {
help <<
"internal command ** under development ** \n"
"internal command usage only\n"
"example:\n"
" { splitChunk:\"db.foo\" , keyPattern: {a:1} , min : {a:100} , max: {a:200} { splitKeys : [ {a:150} , ... ]}";
}