couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chewbra...@apache.org
Subject fabric commit: updated refs/heads/1993-bigcouch-couch-mrview to e1fdae4
Date Thu, 27 Feb 2014 22:36:45 GMT
Repository: couchdb-fabric
Updated Branches:
  refs/heads/1993-bigcouch-couch-mrview 017430dc3 -> e1fdae4ef


Use process dict instead of record for meta_sent boolean

Just use a process dict for the time being rather than modifying the
record. This should never make it into a release, but it's at least
cleaner than modifying the record for a temporary hack.


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

Branch: refs/heads/1993-bigcouch-couch-mrview
Commit: e1fdae4ef646086573e70d0117405622091e7098
Parents: 017430d
Author: Russell Branca <chewbranca@apache.org>
Authored: Thu Feb 27 14:36:55 2014 -0800
Committer: Russell Branca <chewbranca@apache.org>
Committed: Thu Feb 27 14:36:55 2014 -0800

----------------------------------------------------------------------
 include/fabric.hrl         |  3 +--
 src/fabric_view.erl        |  2 ++
 src/fabric_view_reduce.erl | 10 +++++-----
 3 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e1fdae4e/include/fabric.hrl
----------------------------------------------------------------------
diff --git a/include/fabric.hrl b/include/fabric.hrl
index 00765c5..94769bd 100644
--- a/include/fabric.hrl
+++ b/include/fabric.hrl
@@ -29,8 +29,7 @@
     reducer,
     lang,
     sorted,
-    user_acc,
-    meta_sent = false
+    user_acc
 }).
 
 -record(view_row, {key, id, value, doc, worker}).

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e1fdae4e/src/fabric_view.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view.erl b/src/fabric_view.erl
index 9fa6d5e..38c4bf9 100644
--- a/src/fabric_view.erl
+++ b/src/fabric_view.erl
@@ -98,6 +98,7 @@ maybe_send_row(#collector{limit=0} = State) ->
         % we still need to send the total/offset header
         {ok, State};
     false ->
+        erase(meta_sent),
         {_, Acc} = Callback(complete, AccIn),
         {stop, State#collector{user_acc=Acc}}
     end;
@@ -124,6 +125,7 @@ maybe_send_row(State) ->
                 maybe_send_row(NewState#collector{user_acc=Acc, limit=Limit-1})
             end
         catch complete ->
+            erase(meta_sent),
             {_, Acc} = Callback(complete, AccIn),
             {stop, State#collector{user_acc=Acc}}
         end

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/e1fdae4e/src/fabric_view_reduce.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_reduce.erl b/src/fabric_view_reduce.erl
index 6be5c13..17103a5 100644
--- a/src/fabric_view_reduce.erl
+++ b/src/fabric_view_reduce.erl
@@ -86,17 +86,17 @@ handle_message({total_and_offset, _, _}, {_Worker, From}, State) ->
     gen_server:reply(From, ok),
     #collector{
         callback = Callback,
-        user_acc = AccIn,
-        meta_sent = MetaSent
+        user_acc = AccIn
     } = State,
 
-    {Go, Acc} = case MetaSent of
-        false ->
+    {Go, Acc} = case get(meta_sent) of
+        undefined ->
+            put(meta_sent, true),
             Callback({meta, []}, AccIn);
         _ ->
             {ok, AccIn}
     end,
-    {Go, State#collector{meta_sent=true, user_acc = Acc}};
+    {Go, State#collector{user_acc = Acc}};
 
 handle_message(#view_row{key=Key} = Row, {Worker, From}, State) ->
     #collector{counters = Counters0, rows = Rows0} = State,


Mime
View raw message