You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2009/04/27 23:56:40 UTC
svn commit: r769180 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb
share/www/script/test/delayed_commits.js src/couchdb/couch_db.erl
Author: damien
Date: Mon Apr 27 21:56:39 2009
New Revision: 769180
URL: http://svn.apache.org/viewvc?rev=769180&view=rev
Log:
Merge back fix for COUCHDB-334
Modified:
couchdb/branches/0.9.x/ (props changed)
couchdb/branches/0.9.x/etc/default/couchdb (props changed)
couchdb/branches/0.9.x/share/www/script/test/delayed_commits.js
couchdb/branches/0.9.x/src/couchdb/couch_db.erl
Propchange: couchdb/branches/0.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 27 21:56:39 2009
@@ -1,3 +1,3 @@
/couchdb/branches/design_resources:751716-751803
/couchdb/branches/form:729440-730015
-/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767543,768573
+/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767543,768573,769109
Propchange: couchdb/branches/0.9.x/etc/default/couchdb
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Apr 27 21:56:39 2009
@@ -1,4 +1,4 @@
/couchdb/branches/design_resources/etc/default/couchdb:751716-751803
/couchdb/branches/form/etc/default/couchdb:729440-730015
-/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767543,768573
+/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373,766505,767543,768573,769109
/incubator/couchdb/trunk/etc/default/couchdb:642419-694440
Modified: couchdb/branches/0.9.x/share/www/script/test/delayed_commits.js
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/delayed_commits.js?rev=769180&r1=769179&r2=769180&view=diff
==============================================================================
--- couchdb/branches/0.9.x/share/www/script/test/delayed_commits.js (original)
+++ couchdb/branches/0.9.x/share/www/script/test/delayed_commits.js Mon Apr 27 21:56:39 2009
@@ -90,4 +90,26 @@
T(db.open("4") != null);
+ // Now test that when we exceed the max_dbs_open, pending commits are safely
+ // written.
+ T(db.save({_id:"5",foo:"bar"}).ok);
+ var max = 2;
+ run_on_modified_server(
+ [{section: "couchdb",
+ key: "max_dbs_open",
+ value: max.toString()}],
+
+ function () {
+ for(var i=0; i<max; i++) {
+ var dbi = new CouchDB("test_suite_db" + i);
+ dbi.deleteDb();
+ dbi.createDb();
+ }
+ T(db.open("5").foo=="bar");
+ for(var i=0; i<max+1; i++) {
+ var dbi = new CouchDB("test_suite_db" + i);
+ dbi.deleteDb();
+ }
+ });
+
};
Modified: couchdb/branches/0.9.x/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_db.erl?rev=769180&r1=769179&r2=769180&view=diff
==============================================================================
--- couchdb/branches/0.9.x/src/couchdb/couch_db.erl (original)
+++ couchdb/branches/0.9.x/src/couchdb/couch_db.erl Mon Apr 27 21:56:39 2009
@@ -701,11 +701,11 @@
handle_call({open_ref_count, OpenerPid}, _, #db{fd_ref_counter=RefCntr}=Db) ->
ok = couch_ref_counter:add(RefCntr, OpenerPid),
{reply, {ok, Db}, Db};
-handle_call(is_idle, _From,
- #db{fd_ref_counter=RefCntr, compactor_pid=Compact}=Db) ->
+handle_call(is_idle, _From, #db{fd_ref_counter=RefCntr, compactor_pid=Compact,
+ waiting_delayed_commit=Delay}=Db) ->
% Idle means no referrers. Unless in the middle of a compaction file switch,
% there are always at least 2 referrers, couch_db_updater and us.
- {reply, (Compact == nil) and (couch_ref_counter:count(RefCntr) == 2), Db};
+ {reply, (Delay == nil) and (Compact == nil) and (couch_ref_counter:count(RefCntr) == 2), Db};
handle_call({db_updated, #db{fd_ref_counter=NewRefCntr}=NewDb}, _From,
#db{fd_ref_counter=OldRefCntr}) ->
case NewRefCntr == OldRefCntr of