Hi Paul,

is this worth a backport to 0.10?

Cheers
Jan
--

On 31 Oct 2009, at 02:17, [email protected] wrote:

Author: davisp
Date: Sat Oct 31 01:17:04 2009
New Revision: 831502

URL: http://svn.apache.org/viewvc?rev=831502&view=rev
Log:
List functions weren't returning OS processes.

Needed to add a call to couch_query_server:stop_map_doc/1 to return
outstanding OS processes back to the query servers pools. This was
causing some awesome errors by keeping the query_servers PID linked to
the socket PID, which caused errors in apparently unrelated requests as
the query_servers daemon was restarted on config changes.

Also needed to move where the query servers were requested in list
functions involving reduces. Map only lists were fine though.


Modified:
   couchdb/trunk/src/couchdb/couch_httpd_show.erl

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: 
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=831502&r1=831501&r2=831502&view=diff
= = = = = = = = ======================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Sat Oct 31 01:17:04 2009
@@ -286,14 +286,14 @@
        skip = SkipCount,
        group_level = GroupLevel
    } = QueryArgs,
-    % get the os process here
-    % pass it into the view fold with closures
- {ok, QueryServer} = couch_query_servers:start_view_list(Lang, ListSrc),
    Headers = MReq:get(headers),
    Hlist = mochiweb_headers:to_list(Headers),
    Accept = proplists:get_value('Accept', Hlist),
CurrentEtag = couch_httpd_view:view_group_etag(Group, Db, {Lang, ListSrc, Accept, UserCtx}),
    couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
+        % get the os process here
+        % pass it into the view fold with closures
+ {ok, QueryServer} = couch_query_servers:start_view_list (Lang, ListSrc), StartListRespFun = make_reduce_start_resp_fun(QueryServer, Req, Db, CurrentEtag),
        SendListRowFun = make_reduce_send_row_fun(QueryServer, Db),

@@ -316,14 +316,14 @@
        skip = SkipCount,
        group_level = GroupLevel
    } = QueryArgs,
-    % get the os process here
-    % pass it into the view fold with closures
- {ok, QueryServer} = couch_query_servers:start_view_list(Lang, ListSrc),
    Headers = MReq:get(headers),
    Hlist = mochiweb_headers:to_list(Headers),
    Accept = proplists:get_value('Accept', Hlist),
CurrentEtag = couch_httpd_view:view_group_etag(Group, Db, {Lang, ListSrc, Accept, UserCtx, Keys}),
    couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
+        % get the os process here
+        % pass it into the view fold with closures
+ {ok, QueryServer} = couch_query_servers:start_view_list (Lang, ListSrc), StartListRespFun = make_reduce_start_resp_fun(QueryServer, Req, Db, CurrentEtag),
        SendListRowFun = make_reduce_send_row_fun(QueryServer, Db),

@@ -365,6 +365,7 @@
[<<"end">>, Chunks] = couch_query_servers:render_list_tail(QueryServer),
            send_non_empty_chunk(Resp, ?b2l(?l2b(Chunks)))
    end,
+    couch_query_servers:stop_doc_map(QueryServer),
    last_chunk(Resp).





Reply via email to