Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 18587 invoked from network); 18 Nov 2010 21:08:22 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Nov 2010 21:08:22 -0000 Received: (qmail 8786 invoked by uid 500); 18 Nov 2010 21:08:54 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 8659 invoked by uid 500); 18 Nov 2010 21:08:54 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 8652 invoked by uid 99); 18 Nov 2010 21:08:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Nov 2010 21:08:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Nov 2010 21:08:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3FB6D2388A3D; Thu, 18 Nov 2010 21:07:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1036629 - /couchdb/branches/1.0.x/src/couchdb/couch_db.erl Date: Thu, 18 Nov 2010 21:07:40 -0000 To: commits@couchdb.apache.org From: fdmanana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101118210740.3FB6D2388A3D@eris.apache.org> Author: fdmanana Date: Thu Nov 18 21:07:39 2010 New Revision: 1036629 URL: http://svn.apache.org/viewvc?rev=1036629&view=rev Log: Merged revision 1036627 from trunk: Preserve user context when reopening a database. Modified: couchdb/branches/1.0.x/src/couchdb/couch_db.erl Modified: couchdb/branches/1.0.x/src/couchdb/couch_db.erl URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_db.erl?rev=1036629&r1=1036628&r2=1036629&view=diff ============================================================================== --- couchdb/branches/1.0.x/src/couchdb/couch_db.erl (original) +++ couchdb/branches/1.0.x/src/couchdb/couch_db.erl Thu Nov 18 21:07:39 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),