From ff623f039a9ab209768a33f03475e5ae54f09e21 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Thu, 26 Nov 2009 02:10:06 +0000 Subject: Refactored the fix for active_dbs timeouts. I was getting a bit of weirdness with the old test version so I updated to be more straight forward in its testing. I've also updated the patch to couch_db_updater.erl to only to the db_updated call when a delayed commit changes the db because it was interacting badly with compaction. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@884369 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/stats.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'share') diff --git a/share/www/script/test/stats.js b/share/www/script/test/stats.js index 7c32fdff..793b390d 100644 --- a/share/www/script/test/stats.js +++ b/share/www/script/test/stats.js @@ -85,28 +85,21 @@ couchTests.stats = function(debug) { // that we've waited for more than 1 second since opening // the first database so that any delayed commits will be // flushed. - var times = []; + var triggered = false; + var db = null; for(var i = 0; i < max*2; i++) { - if(i >= max) { - if(i == max) { - try { - newDb("test_suite_db_" + i, true); - T(0 === 1, "Should have failed to create max+1 db's quickly."); - } catch(e) { - T(e.reason == "all_dbs_active", "All db's should be active."); - } - } - var msecs = (new Date()).getTime() - times[i-max]; - if(msecs < 1000) { - CouchDB.request("GET", "/_sleep?time=" + (msecs+250)); - } + try { + db = newDb("test_suite_db_" + i, true); + } catch(e) { + triggered = true; + CouchDB.request("GET", "/_sleep?time=1500"); + db = newDb("test_suite_db_" + i, true); } - db = newDb("test_suite_db_" + i, true); - times.push((new Date()).getTime()); - + // Trigger a delayed commit db.save({_id: "" + i, "lang": "Awesome!"}); } + T(triggered, "We managed to force a all_dbs_active error."); var open_dbs = getStat("couchdb", "open_databases").current; TEquals(open_dbs > 0, true, "We actually opened some dbs."); -- cgit v1.2.3