summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--s/chunk.cpp20
-rw-r--r--s/chunk.h5
2 files changed, 10 insertions, 15 deletions
diff --git a/s/chunk.cpp b/s/chunk.cpp
index b13ae69404f..a5c7f4adc57 100644
--- a/s/chunk.cpp
+++ b/s/chunk.cpp
@@ -59,7 +59,7 @@ namespace mongo {
void Chunk::setShard( const Shard& s ){
_shard = s;
_manager->_migrationNotification(this);
- _markModified();
+ _modified = true;
}
bool Chunk::contains( const BSONObj& obj ) const{
@@ -237,7 +237,7 @@ namespace mongo {
vector<ChunkPtr> newChunks;
vector<BSONObj>::const_iterator i = m.begin();
BSONObj nextPoint = i->getOwned();
- _markModified();
+ _modified = true;
do {
BSONObj splitPoint = nextPoint;
log(4) << "splitPoint: " << splitPoint << endl;
@@ -251,9 +251,9 @@ namespace mongo {
uasserted( 13395, ss.str() );
}
- ChunkPtr s( new Chunk( _manager, splitPoint , nextPoint , _shard) );
- s->_markModified();
- newChunks.push_back(s);
+ ChunkPtr c( new Chunk( _manager, splitPoint , nextPoint , _shard) );
+ c->_modified = true;
+ newChunks.push_back( c );
} while ( i != m.end() );
// Have the chunk manager reflect the key change for the first chunk and create an entry for every
@@ -569,10 +569,6 @@ namespace mongo {
return o["lastmod"];
}
- void Chunk::_markModified(){
- _modified = true;
- }
-
string Chunk::toString() const {
stringstream ss;
ss << "ns:" << _manager->getns() << " at: " << _shard.toString() << " lastmod: " << _lastmod.toString() << " min: " << _min << " max: " << _max;
@@ -598,7 +594,7 @@ namespace mongo {
if ( _chunkMap.empty() ){
ChunkPtr c( new Chunk(this, _key.globalMin(), _key.globalMax(), config->getPrimary()) );
- c->_markModified();
+ c->setModified( true );
_chunkMap[c->getMax()] = c;
_chunkRanges.reloadAll(_chunkMap);
@@ -927,7 +923,7 @@ namespace mongo {
int numOps = 0;
for ( ChunkMap::const_iterator i=_chunkMap.begin(); i!=_chunkMap.end(); ++i ){
ChunkPtr c = i->second;
- if ( ! c->_modified )
+ if ( ! c->getModified() )
continue;
numOps++;
@@ -997,6 +993,7 @@ namespace mongo {
// instead of reloading, adjust ShardChunkVersion for the chunks that were updated in the configdb
for ( unsigned i=0; i<toFix.size(); i++ ){
toFix[i]->_lastmod = newVersions[i];
+ toFix[i]->setModified( false );
}
massert( 10417 , "how did version get smalled" , getVersion_inlock() >= version );
@@ -1271,5 +1268,4 @@ namespace mongo {
return conn.runCommand( "admin" , cmd , result );
}
-
} // namespace mongo
diff --git a/s/chunk.h b/s/chunk.h
index 174e2c7e1b5..f936aacb01f 100644
--- a/s/chunk.h
+++ b/s/chunk.h
@@ -128,8 +128,6 @@ namespace mongo {
void appendShortVersion( const char * name , BSONObjBuilder& b );
- void _markModified();
-
static int MaxChunkSize;
string genID() const;
@@ -137,7 +135,8 @@ namespace mongo {
const ChunkManager* getManager() const { return _manager; }
- bool modified();
+ bool getModified() { return _modified; }
+ void setModified( bool modified ) { _modified = modified; }
ShardChunkVersion getVersionOnConfigServer() const;
private: