couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject git commit: COUCHDB-1444 Fix missing_named_view
Date Wed, 15 Aug 2012 20:14:15 GMT
Updated Branches:
  refs/heads/master a28110fec -> b59ac98b4


COUCHDB-1444 Fix missing_named_view

Instead of replacing 'EXIT' signals we can just stuff the process that
exited into the exit reason and match on that.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b59ac98b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b59ac98b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b59ac98b

Branch: refs/heads/master
Commit: b59ac98b4be8d8c9e3f1114dd0a785f0f4dd30d1
Parents: a28110f
Author: Paul Joseph Davis <davisp@apache.org>
Authored: Wed Aug 15 14:50:18 2012 -0500
Committer: Paul Joseph Davis <davisp@apache.org>
Committed: Wed Aug 15 15:07:28 2012 -0500

----------------------------------------------------------------------
 src/couch_index/src/couch_index_updater.erl     |    9 +++++----
 src/couch_mrview/src/couch_mrview_compactor.erl |    4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b59ac98b/src/couch_index/src/couch_index_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_index/src/couch_index_updater.erl b/src/couch_index/src/couch_index_updater.erl
index 853f3d1..c6d3059 100644
--- a/src/couch_index/src/couch_index_updater.erl
+++ b/src/couch_index/src/couch_index_updater.erl
@@ -86,12 +86,13 @@ handle_cast(_Mesg, State) ->
     {stop, unknown_cast, State}.
 
 
-handle_info({'EXIT', Pid, {updated, IdxState}}, #st{mod=Mod, pid=Pid}=State) ->
+handle_info({'EXIT', _, {updated, Pid, IdxState}}, #st{pid=Pid}=State) ->
+    Mod = State#st.mod,
     Args = [Mod:get(db_name, IdxState), Mod:get(idx_name, IdxState)],
     ?LOG_INFO("Index update finished for db: ~s idx: ~s", Args),
     ok = gen_server:cast(State#st.idx, {updated, IdxState}),
     {noreply, State#st{pid=undefined}};
-handle_info({'EXIT', Pid, reset}, #st{idx=Idx, pid=Pid}=State) ->
+handle_info({'EXIT', _, {reset, Pid}}, #st{idx=Idx, pid=Pid}=State) ->
     {ok, NewIdxState} = gen_server:call(State#st.idx, reset),
     Pid2 = spawn_link(fun() -> update(Idx, State#st.mod, NewIdxState) end),
     {noreply, State#st{pid=Pid2}};
@@ -131,7 +132,7 @@ update(Idx, Mod, IdxState) ->
 
         PurgedIdxState = case purge_index(Db, Mod, IdxState) of
             {ok, IdxState0} -> IdxState0;
-            reset -> exit(reset)
+            reset -> exit({reset, self()})
         end,
 
         NumChanges = couch_db:count_changes_since(Db, CurrSeq),
@@ -181,7 +182,7 @@ update(Idx, Mod, IdxState) ->
         end,
 
         {ok, FinalIdxState} = Mod:finish_update(LastIdxSt),
-        exit({updated, FinalIdxState})
+        exit({updated, self(), FinalIdxState})
     end).
 
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b59ac98b/src/couch_mrview/src/couch_mrview_compactor.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview/src/couch_mrview_compactor.erl b/src/couch_mrview/src/couch_mrview_compactor.erl
index cf3cf22..b500ce3 100644
--- a/src/couch_mrview/src/couch_mrview_compactor.erl
+++ b/src/couch_mrview/src/couch_mrview_compactor.erl
@@ -116,11 +116,11 @@ compact(State) ->
 
 recompact(State) ->
     link(State#mrst.fd),
-    {_Pid, Ref} = erlang:spawn_monitor(fun() ->
+    {Pid, Ref} = erlang:spawn_monitor(fun() ->
         couch_index_updater:update(couch_mrview_index, State)
     end),
     receive
-        {'DOWN', Ref, _, _, {updated, State2}} ->
+        {'DOWN', Ref, _, _, {updated, Pid, State2}} ->
             unlink(State#mrst.fd),
             {ok, State2}
     end.


Mime
View raw message