diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-11-26 02:10:06 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-11-26 02:10:06 +0000 |
commit | ff623f039a9ab209768a33f03475e5ae54f09e21 (patch) | |
tree | 1557fc630ad3df928008c68b7ff7aa6bc9a62565 /share/www/script | |
parent | a320015ab1e34cefdeef9bd151197d80f87b932d (diff) |
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
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/test/stats.js | 27 |
1 files changed, 10 insertions, 17 deletions
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."); |