mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
make chunk size configurable and default 200mb
This commit is contained in:
parent
4685677e23
commit
e310776ecf
@ -28,7 +28,7 @@ namespace mongo {
|
||||
|
||||
// ------- Shard --------
|
||||
|
||||
long Chunk::MaxChunkSize = 1024 * 1204 * 50;
|
||||
int Chunk::MaxChunkSize = 1024 * 1204 * 200;
|
||||
|
||||
Chunk::Chunk( ChunkManager * manager ) : _manager( manager ){
|
||||
_modified = false;
|
||||
|
@ -119,7 +119,7 @@ namespace mongo {
|
||||
|
||||
void _markModified();
|
||||
|
||||
static long MaxChunkSize;
|
||||
static int MaxChunkSize;
|
||||
|
||||
private:
|
||||
|
||||
|
26
s/config.cpp
26
s/config.cpp
@ -459,6 +459,32 @@ namespace mongo {
|
||||
return -8;
|
||||
}
|
||||
|
||||
void ConfigServer::reloadSettings(){
|
||||
set<string> got;
|
||||
|
||||
ScopedDbConnection conn( _primary );
|
||||
auto_ptr<DBClientCursor> c = conn->query( "config.settings" , BSONObj() );
|
||||
while ( c->more() ){
|
||||
BSONObj o = c->next();
|
||||
string name = o["_id"].valuestrsafe();
|
||||
got.insert( name );
|
||||
if ( name == "chunksize" ){
|
||||
log(1) << "MaxChunkSize: " << o["value"] << endl;
|
||||
Chunk::MaxChunkSize = o["value"].numberInt() * 1024 * 1024;
|
||||
}
|
||||
else {
|
||||
log() << "warning: unknown setting [" << name << "]" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! got.count( "chunksize" ) ){
|
||||
conn->insert( "config.settings" , BSON( "_id" << "chunksize" <<
|
||||
"value" << (Chunk::MaxChunkSize / ( 1024 * 1024 ) ) ) );
|
||||
}
|
||||
|
||||
conn.done();
|
||||
}
|
||||
|
||||
string ConfigServer::getHost( string name , bool withPort ){
|
||||
if ( name.find( ":" ) ){
|
||||
if ( withPort )
|
||||
|
@ -180,6 +180,8 @@ namespace mongo {
|
||||
|
||||
int dbConfigVersion();
|
||||
int dbConfigVersion( DBClientBase& conn );
|
||||
|
||||
void reloadSettings();
|
||||
|
||||
/**
|
||||
* @return 0 = ok, otherwise error #
|
||||
|
@ -193,7 +193,8 @@ int main(int argc, char* argv[], char *envp[] ) {
|
||||
cout << "config server error: " << configError << endl;
|
||||
return configError;
|
||||
}
|
||||
|
||||
configServer.reloadSettings();
|
||||
|
||||
init();
|
||||
start();
|
||||
dbexit( EXIT_CLEAN );
|
||||
|
@ -107,7 +107,9 @@ myPort = function() {
|
||||
return 27017;
|
||||
}
|
||||
|
||||
ShardingTest = function( testName , numServers , verboseLevel , numMongos ){
|
||||
ShardingTest = function( testName , numServers , verboseLevel , numMongos , otherParams ){
|
||||
if ( ! otherParams )
|
||||
otherParams = {}
|
||||
this._connections = [];
|
||||
this._serverNames = [];
|
||||
|
||||
@ -121,7 +123,8 @@ ShardingTest = function( testName , numServers , verboseLevel , numMongos ){
|
||||
}
|
||||
|
||||
this._configDB = "localhost:30000";
|
||||
|
||||
this._connections[0].getDB( "config" ).settings.insert( { _id : "chunksize" , value : otherParams.chunksize || 50 } );
|
||||
|
||||
|
||||
this._mongos = [];
|
||||
var startMongosPort = 31000;
|
||||
|
Loading…
Reference in New Issue
Block a user