Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 5201 invoked from network); 18 Feb 2010 20:04:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 18 Feb 2010 20:04:26 -0000 Received: (qmail 48412 invoked by uid 500); 18 Feb 2010 20:04:26 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 48375 invoked by uid 500); 18 Feb 2010 20:04:25 -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 48366 invoked by uid 99); 18 Feb 2010 20:04:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Feb 2010 20:04:25 +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 Feb 2010 20:04:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 84E0823889BF; Thu, 18 Feb 2010 20:04:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r911545 - in /couchdb/branches/0.11.x: ./ etc/default/couchdb share/Makefile.am src/couchdb/couch_view.erl src/couchdb/couch_view_group.erl test/etap/150-invalid-view-seq.t test/etap/Makefile.am Date: Thu, 18 Feb 2010 20:04:01 -0000 To: commits@couchdb.apache.org From: davisp@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100218200401.84E0823889BF@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: davisp Date: Thu Feb 18 20:04:01 2010 New Revision: 911545 URL: http://svn.apache.org/viewvc?rev=911545&view=rev Log: Back porting fix for COUCHDB-640 - r911544 Added: couchdb/branches/0.11.x/test/etap/150-invalid-view-seq.t - copied unchanged from r911544, couchdb/trunk/test/etap/150-invalid-view-seq.t Modified: couchdb/branches/0.11.x/ (props changed) couchdb/branches/0.11.x/etc/default/couchdb (props changed) couchdb/branches/0.11.x/share/Makefile.am couchdb/branches/0.11.x/src/couchdb/couch_view.erl couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl couchdb/branches/0.11.x/test/etap/Makefile.am Propchange: couchdb/branches/0.11.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Feb 18 20:04:01 2010 @@ -6,4 +6,4 @@ /couchdb/branches/list-iterator:782292-784593 /couchdb/branches/tail_header:775760-778477 /couchdb/tags/0.10.0:825400 -/couchdb/trunk:909247,910054,910696 +/couchdb/trunk:909247,910054,910696,911544 Propchange: couchdb/branches/0.11.x/etc/default/couchdb ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Feb 18 20:04:01 2010 @@ -6,5 +6,5 @@ /couchdb/branches/list-iterator/etc/default/couchdb:782292-784593 /couchdb/branches/tail_header/etc/default/couchdb:775760-778477 /couchdb/tags/0.10.0/etc/default/couchdb:825400 -/couchdb/trunk/etc/default/couchdb:909247,910054,910696 +/couchdb/trunk/etc/default/couchdb:909247,910054,910696,911544 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.11.x/share/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/share/Makefile.am?rev=911545&r1=911544&r2=911545&view=diff ============================================================================== --- couchdb/branches/0.11.x/share/Makefile.am (original) +++ couchdb/branches/0.11.x/share/Makefile.am Thu Feb 18 20:04:01 2010 @@ -34,8 +34,10 @@ EXTRA_DIST = $(JS_FILE_COMPONENTS) $(JS_FILE_COMPONENTS_LAST) +nobase_localdata_SCRIPTS = \ + $(JS_FILE) + nobase_dist_localdata_DATA = \ - $(JS_FILE) \ www/config.html \ www/couch_tests.html \ www/custom_test.html \ Modified: couchdb/branches/0.11.x/src/couchdb/couch_view.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_view.erl?rev=911545&r1=911544&r2=911545&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_view.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_view.erl Thu Feb 18 20:04:01 2010 @@ -284,6 +284,15 @@ {ok, NewPid} -> add_to_ets(NewPid, DbName, Sig), {reply, {ok, NewPid}, Server}; + {error, invalid_view_seq} -> + do_reset_indexes(DbName, Root), + case (catch couch_view_group:start_link({Root, DbName, Group})) of + {ok, NewPid} -> + add_to_ets(NewPid, DbName, Sig), + {reply, {ok, NewPid}, Server}; + Error -> + {reply, Error, Server} + end; Error -> {reply, Error, Server} end; @@ -292,6 +301,10 @@ end. handle_cast({reset_indexes, DbName}, #server{root_dir=Root}=Server) -> + do_reset_indexes(DbName, Root), + {noreply, Server}. + +do_reset_indexes(DbName, Root) -> % shutdown all the updaters and clear the files, the db got changed Names = ets:lookup(couch_groups_by_db, DbName), lists:foreach( @@ -304,8 +317,7 @@ end end, Names), delete_index_dir(Root, DbName), - file:delete(Root ++ "/." ++ binary_to_list(DbName) ++ "_temp"), - {noreply, Server}. + file:delete(Root ++ "/." ++ ?b2l(DbName) ++ "_temp"). handle_info({'EXIT', FromPid, Reason}, Server) -> case ets:lookup(couch_groups_by_updater, FromPid) of Modified: couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl?rev=911545&r1=911544&r2=911545&view=diff ============================================================================== --- couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl (original) +++ couchdb/branches/0.11.x/src/couchdb/couch_view_group.erl Thu Feb 18 20:04:01 2010 @@ -78,17 +78,25 @@ init({InitArgs, ReturnPid, Ref}) -> process_flag(trap_exit, true), case prepare_group(InitArgs, false) of - {ok, #group{db=Db, fd=Fd}=Group} -> - couch_db:monitor(Db), - Owner = self(), - Pid = spawn_link(fun()-> couch_view_updater:update(Owner, Group) end), - {ok, RefCounter} = couch_ref_counter:start([Fd]), - {ok, #group_state{ - db_name=couch_db:name(Db), - init_args=InitArgs, - updater_pid = Pid, - group=Group, - ref_counter=RefCounter}}; + {ok, #group{db=Db, fd=Fd, current_seq=Seq}=Group} -> + case Seq > couch_db:get_update_seq(Db) of + true -> + ReturnPid ! {Ref, self(), {error, invalid_view_seq}}, + ignore; + _ -> + couch_db:monitor(Db), + Owner = self(), + Pid = spawn_link( + fun()-> couch_view_updater:update(Owner, Group) end + ), + {ok, RefCounter} = couch_ref_counter:start([Fd]), + {ok, #group_state{ + db_name=couch_db:name(Db), + init_args=InitArgs, + updater_pid = Pid, + group=Group, + ref_counter=RefCounter}} + end; Error -> ReturnPid ! {Ref, self(), Error}, ignore Modified: couchdb/branches/0.11.x/test/etap/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/test/etap/Makefile.am?rev=911545&r1=911544&r2=911545&view=diff ============================================================================== --- couchdb/branches/0.11.x/test/etap/Makefile.am (original) +++ couchdb/branches/0.11.x/test/etap/Makefile.am Thu Feb 18 20:04:01 2010 @@ -61,4 +61,8 @@ 120-stats-collect.t \ 121-stats-aggregates.cfg \ 121-stats-aggregates.ini \ - 121-stats-aggregates.t + 121-stats-aggregates.t \ + 130-attachments-md5.t \ + 140-attachment-comp.t \ + 150-invalid-view-seq.t +