couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1036627 - /couchdb/trunk/src/couchdb/couch_db.erl
Date Thu, 18 Nov 2010 21:06:54 GMT
Author: fdmanana
Date: Thu Nov 18 21:06:54 2010
New Revision: 1036627

URL: http://svn.apache.org/viewvc?rev=1036627&view=rev
Log:
Preserve user context when reopening a database.

Modified:
    couchdb/trunk/src/couchdb/couch_db.erl

Modified: couchdb/trunk/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.erl?rev=1036627&r1=1036626&r2=1036627&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_db.erl Thu Nov 18 21:06:54 2010
@@ -87,17 +87,17 @@ open(DbName, Options) ->
         Else -> Else
     end.
 
-reopen(#db{main_pid = Pid, fd_ref_counter = OldRefCntr}) ->
+reopen(#db{main_pid = Pid, fd_ref_counter = OldRefCntr, user_ctx = UserCtx}) ->
     {ok, #db{fd_ref_counter = NewRefCntr} = NewDb} =
         gen_server:call(Pid, get_db, infinity),
     case NewRefCntr =:= OldRefCntr of
     true ->
-        {ok, NewDb};
+        ok;
     false ->
         couch_ref_counter:add(NewRefCntr),
-        couch_ref_counter:drop(OldRefCntr),
-        {ok, NewDb}
-    end.
+        couch_ref_counter:drop(OldRefCntr)
+    end,
+    {ok, NewDb#db{user_ctx = UserCtx}}.
 
 ensure_full_commit(#db{update_pid=UpdatePid,instance_start_time=StartTime}) ->
     ok = gen_server:call(UpdatePid, full_commit, infinity),



Mime
View raw message