summaryrefslogtreecommitdiff
path: root/s/writeback_listener.cpp
diff options
context:
space:
mode:
authorAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:19 +0100
committerAntonin Kral <a.kral@bobek.cz>2011-12-15 10:02:46 +0100
commit0b48f8ada2acb0de830b23f8cefc8e3fea28d915 (patch)
treef7c2811269b6b53199412be2dd5ec02eea15d55d /s/writeback_listener.cpp
parent85f1cd56145b90a32b7ccdc750000deeed54fe22 (diff)
parentf0d9a01bccdaeb466c12c92057914bbfef59526c (diff)
downloadmongodb-0b48f8ada2acb0de830b23f8cefc8e3fea28d915.tar.gz
Merge branch 'upstream/2.0.2'
Diffstat (limited to 's/writeback_listener.cpp')
-rw-r--r--s/writeback_listener.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/s/writeback_listener.cpp b/s/writeback_listener.cpp
index 5f320d3..ebdefb0 100644
--- a/s/writeback_listener.cpp
+++ b/s/writeback_listener.cpp
@@ -165,13 +165,16 @@ namespace mongo {
DBConfigPtr db = grid.getDBConfig( ns );
ShardChunkVersion needVersion( data["version"] );
+ // TODO: The logic here could be refactored, but keeping to the original codepath for safety for now
+ ChunkManagerPtr manager = db->getChunkManagerIfExists( ns );
+
LOG(1) << "connectionId: " << cid << " writebackId: " << wid << " needVersion : " << needVersion.toString()
- << " mine : " << db->getChunkManager( ns )->getVersion().toString()
+ << " mine : " << ( manager ? manager->getVersion().toString() : "(unknown)" )
<< endl;
LOG(1) << m.toString() << endl;
- if ( needVersion.isSet() && needVersion <= db->getChunkManager( ns )->getVersion() ) {
+ if ( needVersion.isSet() && manager && needVersion <= manager->getVersion() ) {
// this means when the write went originally, the version was old
// if we're here, it means we've already updated the config, so don't need to do again
//db->getChunkManager( ns , true ); // SERVER-1349
@@ -180,7 +183,7 @@ namespace mongo {
// we received a writeback object that was sent to a previous version of a shard
// the actual shard may not have the object the writeback operation is for
// we need to reload the chunk manager and get the new shard versions
- db->getChunkManager( ns , true );
+ manager = db->getChunkManager( ns , true );
}
// do request and then call getLastError
@@ -216,7 +219,7 @@ namespace mongo {
if ( gle["code"].numberInt() == 9517 ) {
log() << "writeback failed because of stale config, retrying attempts: " << attempts << endl;
- if( ! db->getChunkManagerIfExists( ns , true ) ){
+ if( ! db->getChunkManagerIfExists( ns , true, attempts > 2 ) ){
uassert( 15884, str::stream() << "Could not reload chunk manager after " << attempts << " attempts.", attempts <= 4 );
sleepsecs( attempts - 1 );
}