summaryrefslogtreecommitdiff
path: root/s/writeback_listener.cpp
diff options
context:
space:
mode:
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 );
}