Permalink
Browse files

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

…yKill is false (i.e. in mongos)
  • Loading branch information...
Greg Studer authored and amschwerin committed Feb 6, 2012
1 parent e1b56eb commit 5f4961309049c5bef3b8669e7972a19d52ec85d3
Showing with 14 additions and 3 deletions.
  1. +13 −2 client/dbclientcursor.cpp
  2. +1 −1 s/server.cpp
View
@@ -290,12 +290,23 @@ namespace mongo {
m.setData( dbKillCursors , b.buf() , b.len() );
if ( _client ) {
- _client->sayPiggyBack( m );
+
+ // Kill the cursor the same way the connection itself would. Usually, non-lazily
+ if( DBClientConnection::getLazyKillCursor() )
+ _client->sayPiggyBack( m );
+ else
+ _client->say( m );
+
}
else {
assert( _scopedHost.size() );
ScopedDbConnection conn( _scopedHost );
- conn->sayPiggyBack( m );
+
+ if( DBClientConnection::getLazyKillCursor() )
+ conn->sayPiggyBack( m );
+ else
+ conn->say( m );
+
conn.done();
}
}
View
@@ -290,7 +290,7 @@ int _main(int argc, char* argv[]) {
shardConnectionPool.addHook( new ShardingConnectionHook( true ) );
shardConnectionPool.setName( "mongos shardconnection connectionpool" );
-
+ // Mongos shouldn't lazily kill cursors, otherwise we can end up with extras from migration
DBClientConnection::setLazyKillCursor( false );
ReplicaSetMonitor::setConfigChangeHook( boost::bind( &ConfigServer::replicaSetChange , &configServer , _1 ) );

0 comments on commit 5f49613

Please sign in to comment.