Fix reduce views with new rexi:stream

Nasty bug with the reduce views switching between rexi:sync_reply/1 and
rexi:stream/1 during the read initialization. This fix is already
deployed on all MT clusters and solves the issue.


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

Branch: refs/heads/import
Commit: 48600e5b6e4672c428127e450af64ba595b81fc0
Parents: b73311b
Author: Paul J. Davis <paul.joseph.da...@gmail.com>
Authored: Wed Nov 21 08:54:39 2012 -0600
Committer: Paul J. Davis <paul.joseph.da...@gmail.com>
Committed: Wed Nov 21 08:54:39 2012 -0600

----------------------------------------------------------------------
 src/fabric_view.erl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/48600e5b/src/fabric_view.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index 75a21d5..63ab3f4 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -202,7 +202,12 @@ get_next_row(#collector{reducer = RedSrc} = St) when 
RedSrc =/= undefined ->
     {ok, Records} ->
         NewRowDict = dict:erase(Key, RowDict),
         Counters = lists:foldl(fun(#view_row{worker={Worker,From}}, CntrsAcc) 
->
-            rexi:stream_ack(From),
+            case From of
+                {Pid, _} when is_pid(Pid) ->
+                    gen_server:reply(From, ok);
+                Pid when is_pid(Pid) ->
+                    rexi:stream_ack(From)
+            end,
             fabric_dict:update_counter(Worker, -1, CntrsAcc)
         end, Counters0, Records),
         Wrapped = [[V] || #view_row{value=V} <- Records],

Reply via email to