0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +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;
Chunk::Chunk( ChunkManager * manager )
: _manager(manager),
_lastmod(0), _dataWritten(0)
{}
Chunk::Chunk( ChunkManager * manager ) : _manager(manager), _lastmod(0) {
_setDataWritten();
}
Chunk::Chunk(ChunkManager * info , const BSONObj& min, const BSONObj& max, const Shard& shard)
: _manager(info), _min(min), _max(max), _shard(shard),
_lastmod(0), _dataWritten(0)
{}
: _manager(info), _min(min), _max(max), _shard(shard), _lastmod(0) {
_setDataWritten();
}
void Chunk::_setDataWritten(){
_dataWritten = rand() % ( MaxChunkSize / 5 );
}
string Chunk::getns() const {
assert( _manager );

View File

@ -210,6 +210,9 @@ namespace mongo {
*/
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;
};