From 3fc16f4e36aed091877448e9366b6b0949c686db Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Mon, 29 Aug 2011 13:16:58 -0400 Subject: [PATCH 1/3] Wait a bit before trying to accept() when out of FDs SERVER-3707 SERVER-3705 --- util/net/listen.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/net/listen.cpp b/util/net/listen.cpp index 16ddde880b166..6ee25b4583ffe 100644 --- a/util/net/listen.cpp +++ b/util/net/listen.cpp @@ -295,8 +295,14 @@ namespace mongo { if ( x == 0 && inShutdown() ) { return; // socket closed } - if( !inShutdown() ) + if( !inShutdown() ) { log() << "Listener: accept() returns " << s << " " << errnoWithDescription(x) << endl; + if (x == EMFILE || x == ENFILE) { + // Connection still in listen queue but we can't accept it yet + error() << "Out of file descriptors. Waiting one second before trying to accept more connections." << warnings; + sleepsecs(1); + } + } continue; } if (from.getType() != AF_UNIX) From 75eb7ca39ab4d5180078402bb3c4ed948705c83f Mon Sep 17 00:00:00 2001 From: Spencer T Brody Date: Mon, 29 Aug 2011 14:18:17 -0400 Subject: [PATCH 2/3] Add some more tests for $in and $all working together. QA-46 & SERVER-2165. --- jstests/indexl.js | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/jstests/indexl.js b/jstests/indexl.js index df706705b02b5..666586db7a72f 100644 --- a/jstests/indexl.js +++ b/jstests/indexl.js @@ -1,17 +1,27 @@ // Check nonoverlapping $in/$all with multikeys SERVER-2165 t = db.jstests_indexl; -t.drop(); -t.save( {a:[1,2]} ); -assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) ); -assert.eq( 1, t.count( {a:{$all:[2],$in:[1]}} ) ); -assert.eq( 1, t.count( {a:{$in:[2],$all:[1]}} ) ); -assert.eq( 1, t.count( {a:{$in:[1],$all:[2]}} ) ); +function test(t) { + t.save( {a:[1,2]} ); + assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) ); + assert.eq( 1, t.count( {a:{$all:[2],$in:[1]}} ) ); + assert.eq( 1, t.count( {a:{$in:[2],$all:[1]}} ) ); + assert.eq( 1, t.count( {a:{$in:[1],$all:[2]}} ) ); + assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) ); + t.save({a:[3,4]}) + t.save({a:[2,3]}) + t.save({a:[1,2,3,4]}) + assert.eq( 2, t.count( {a:{$in:[2],$all:[1]}} ) ); + assert.eq( 1, t.count( {a:{$in:[3],$all:[1,2]}} ) ); + assert.eq( 1, t.count( {a:{$in:[1],$all:[3]}} ) ); + assert.eq( 2, t.count( {a:{$in:[2,3],$all:[1]}} ) ); + assert.eq( 1, t.count( {a:{$in:[4],$all:[2,3]}} ) ); + assert.eq( 3, t.count( {a:{$in:[1,3],$all:[2]}} ) ); +} +t.drop(); +test(t); +t.drop(); t.ensureIndex( {a:1} ); -assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) ); -assert.eq( 1, t.count( {a:{$all:[2],$in:[1]}} ) ); -assert.eq( 1, t.count( {a:{$in:[2],$all:[1]}} ) ); -assert.eq( 1, t.count( {a:{$in:[1],$all:[2]}} ) ); -assert.eq( 1, t.count( {a:{$all:[1],$in:[2]}} ) ); +test(t); \ No newline at end of file From cba958b22301f26c9f29a37a533eb9a31d7c77b8 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 29 Aug 2011 14:38:31 -0400 Subject: [PATCH 3/3] fix yield with disk issue in update.cpp SERVER-3633 --- db/ops/update.cpp | 7 ++++++- db/record.cpp | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/db/ops/update.cpp b/db/ops/update.cpp index fb2b4d5695b2f..fd9798a8f264f 100644 --- a/db/ops/update.cpp +++ b/db/ops/update.cpp @@ -1002,7 +1002,12 @@ namespace mongo { { // we need to re-find in case something changed - + d = nsdetails( ns ); + if ( ! d ) { + // dropped + return UpdateResult(0, 0, 0); + } + nsdt = &NamespaceDetailsTransient::get_w(ns); IndexDetails& i = d->idx(idIdxNo); BSONObj key = i.getKeyFromQuery( patternOrig ); loc = i.idxInterface().findSingle(i, i.head, key); diff --git a/db/record.cpp b/db/record.cpp index 18be9c75fe23f..51dc52072ddec 100644 --- a/db/record.cpp +++ b/db/record.cpp @@ -190,6 +190,9 @@ namespace mongo { char * end = data + netLength(); for ( ; addr <= end ; addr += 2048 ) { __record_touch_dummy += addr[0]; + + break; // TODO: remove this, pending SERVER-3711 + if ( ! entireRecrd ) break; }