summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2012-02-02 13:16:53 -0500
committerEliot Horowitz <eliot@10gen.com>2012-02-02 13:16:53 -0500
commit64f361b5522c03fec43e24d12f23b075f2a31b3b (patch)
tree6af1a2ef0359624fbce06904d5f469495c9a1b6c
parent263e3cc95f2282a860c7abe407031bb8ce59b405 (diff)
downloadmongo-64f361b5522c03fec43e24d12f23b075f2a31b3b.tar.gz
handle rare case in write back listener where a chunk manager may not exist yet
-rw-r--r--src/mongo/s/writeback_listener.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mongo/s/writeback_listener.cpp b/src/mongo/s/writeback_listener.cpp
index 32d941dce4d..a93d943bcdf 100644
--- a/src/mongo/s/writeback_listener.cpp
+++ b/src/mongo/s/writeback_listener.cpp
@@ -167,6 +167,21 @@ namespace mongo {
// TODO: The logic here could be refactored, but keeping to the original codepath for safety for now
ChunkManagerPtr manager = db->getChunkManagerIfExists( ns );
+
+ if ( ! manager ) {
+ // I don't trust the above code
+ // for this to be valid, we would have to have gotten a writeback because
+ // a collection was sharded
+ // and then for the collection to be dropped between the time the write hit mongod
+ // and the time it gets here
+ // possible - but I think there are more likely cases
+ // and in that case a little slowness isn't a horrible issue
+ manager = db->getChunkManagerIfExists( ns , true , true );
+ if ( manager ) {
+ warning() << "after reload, getChunkManagerIfExists works, this is inefficient, but should be" << endl;
+ }
+
+ }
LOG(1) << "connectionId: " << cid << " writebackId: " << wid << " needVersion : " << needVersion.toString()
<< " mine : " << ( manager ? manager->getVersion().toString() : "(unknown)" )