Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

SERVER-4812 use say() not sayPiggyback() when closing cursors and laz…

…yKill is false (i.e. in mongos)
  • Loading branch information...
commit 5f4961309049c5bef3b8669e7972a19d52ec85d3 1 parent e1b56eb
Greg Studer authored February 06, 2012 andy10gen committed April 19, 2012
15  client/dbclientcursor.cpp
@@ -290,12 +290,23 @@ namespace mongo {
290 290
             m.setData( dbKillCursors , b.buf() , b.len() );
291 291
 
292 292
             if ( _client ) {
293  
-                _client->sayPiggyBack( m );
  293
+
  294
+                // Kill the cursor the same way the connection itself would.  Usually, non-lazily
  295
+                if( DBClientConnection::getLazyKillCursor() )
  296
+                    _client->sayPiggyBack( m );
  297
+                else
  298
+                    _client->say( m );
  299
+
294 300
             }
295 301
             else {
296 302
                 assert( _scopedHost.size() );
297 303
                 ScopedDbConnection conn( _scopedHost );
298  
-                conn->sayPiggyBack( m );
  304
+
  305
+                if( DBClientConnection::getLazyKillCursor() )
  306
+                    conn->sayPiggyBack( m );
  307
+                else
  308
+                    conn->say( m );
  309
+
299 310
                 conn.done();
300 311
             }
301 312
         }
2  s/server.cpp
@@ -290,7 +290,7 @@ int _main(int argc, char* argv[]) {
290 290
     shardConnectionPool.addHook( new ShardingConnectionHook( true ) );
291 291
     shardConnectionPool.setName( "mongos shardconnection connectionpool" );
292 292
 
293  
-    
  293
+    // Mongos shouldn't lazily kill cursors, otherwise we can end up with extras from migration
294 294
     DBClientConnection::setLazyKillCursor( false );
295 295
 
296 296
     ReplicaSetMonitor::setConfigChangeHook( boost::bind( &ConfigServer::replicaSetChange , &configServer , _1 ) );

0 notes on commit 5f49613

Please sign in to comment.
Something went wrong with that request. Please try again.