0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 17:10:48 +01:00

SERVER-1986 simpler mechanism for picking up split checks if mongos bounces frequently

This commit is contained in:
Alberto Lerner 2010-12-18 20:33:09 -05:00
parent 34613b0bde
commit bfdf4ba06e
2 changed files with 13 additions and 7 deletions

View File

@ -45,15 +45,18 @@ namespace mongo {
int Chunk::MaxChunkSize = 1024 * 1024 * 64; int Chunk::MaxChunkSize = 1024 * 1024 * 64;
Chunk::Chunk( ChunkManager * manager ) Chunk::Chunk( ChunkManager * manager ) : _manager(manager), _lastmod(0) {
: _manager(manager), _setDataWritten();
_lastmod(0), _dataWritten(0) }
{}
Chunk::Chunk(ChunkManager * info , const BSONObj& min, const BSONObj& max, const Shard& shard) Chunk::Chunk(ChunkManager * info , const BSONObj& min, const BSONObj& max, const Shard& shard)
: _manager(info), _min(min), _max(max), _shard(shard), : _manager(info), _min(min), _max(max), _shard(shard), _lastmod(0) {
_lastmod(0), _dataWritten(0) _setDataWritten();
{} }
void Chunk::_setDataWritten(){
_dataWritten = rand() % ( MaxChunkSize / 5 );
}
string Chunk::getns() const { string Chunk::getns() const {
assert( _manager ); assert( _manager );

View File

@ -210,6 +210,9 @@ namespace mongo {
*/ */
BSONObj _getExtremeKey( int sort ) const; BSONObj _getExtremeKey( int sort ) const;
/** initializes _dataWritten with a random value so that a mongos restart wouldn't cause delay in splitting */
void _setDataWritten();
ShardKeyPattern skey() const; ShardKeyPattern skey() const;
}; };