diff options
author | Paul Joseph Davis <davisp@apache.org> | 2009-10-31 01:17:04 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2009-10-31 01:17:04 +0000 |
commit | 72675d73f8e571b1a5555451f5c588225a157035 (patch) | |
tree | dce632c34971e337b0f7235159e12d28d4747189 | |
parent | 78088d9faa123bcae39ed16dd0e15f8d41b34bd3 (diff) |
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.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@831502 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/couchdb/couch_httpd_show.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl index fe8e2002..4ed11c2a 100644 --- a/src/couchdb/couch_httpd_show.erl +++ b/src/couchdb/couch_httpd_show.erl @@ -286,14 +286,14 @@ output_reduce_list(#httpd{mochi_req=MReq, user_ctx=UserCtx}=Req, Lang, ListSrc, 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 @@ output_reduce_list(#httpd{mochi_req=MReq, user_ctx=UserCtx}=Req, Lang, ListSrc, 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 @@ finish_list(Req, QueryServer, Etag, FoldResult, StartFun, TotalRows) -> [<<"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). |