You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2016/08/25 03:27:22 UTC
couch-mrview commit: updated refs/heads/3060-handle-multi-query to
0cc75c1 [Forced Update!]
Repository: couchdb-couch-mrview
Updated Branches:
refs/heads/3060-handle-multi-query c5d9c1a54 -> 0cc75c1db (forced update)
Properly handle multi-query streaming of results
After commit:
https://github.com/apache/couchdb-couch-mrview/commit/3ce28641c85af0d5054df47e9ac7de917a9d33cd
In view_cb if rows came before meta, set the row_sent=true flag did not send
meta after that. That made sense for a single query. However, in case of multiple
queries, which could produce this sequence of callbacks:
meta , row, ... , complete, meta, row, ..., complete
Second meta won't be sent because row_sent flag remains true.
So to fix, make sure to reset row_sent=false in after each complete.
Jira: COUCHDB-3060
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/0cc75c1d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/0cc75c1d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/0cc75c1d
Branch: refs/heads/3060-handle-multi-query
Commit: 0cc75c1dba5946ad7b405069e0bbb3734d225081
Parents: 157132c
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Wed Aug 24 23:17:00 2016 -0400
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Wed Aug 24 23:26:52 2016 -0400
----------------------------------------------------------------------
src/couch_mrview_http.erl | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/0cc75c1d/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 3a9aa33..07c5f74 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -373,16 +373,16 @@ view_cb({row, Row}, Acc) ->
view_cb(complete, #vacc{resp=undefined}=Acc) ->
% Nothing in view
{ok, Resp} = chttpd:send_json(Acc#vacc.req, 200, {[{rows, []}]}),
- {ok, Acc#vacc{resp=Resp}};
+ {ok, Acc#vacc{resp=Resp, row_sent=false}};
view_cb(complete, #vacc{resp=Resp, buffer=Buf, threshold=Max}=Acc) ->
% Finish view output and possibly end the response
{ok, Resp1} = chttpd:close_delayed_json_object(Resp, Buf, "\r\n]}", Max),
case Acc#vacc.should_close of
true ->
{ok, Resp2} = chttpd:end_delayed_json_response(Resp1),
- {ok, Acc#vacc{resp=Resp2}};
+ {ok, Acc#vacc{resp=Resp2, row_sent=false}};
_ ->
- {ok, Acc#vacc{resp=Resp1, prepend=",\r\n", buffer=[], bufsize=0}}
+ {ok, Acc#vacc{resp=Resp1, row_sent=false, prepend=",\r\n", buffer=[], bufsize=0}}
end;
view_cb({error, Reason}, #vacc{resp=undefined}=Acc) ->
{ok, Resp} = chttpd:send_error(Acc#vacc.req, Reason),