diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-05-04 22:06:12 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-05-04 22:06:12 +0000 |
commit | 2d0503e3bb0c50c99670c01272ee8c1fe7710f8d (patch) | |
tree | abde95fef91189736e89c4ea5c3ae277e6ff46e7 /src/couchdb/couch_query_servers.erl | |
parent | 7c05a60479bacc7acbf6f704285a4ab2981ba02b (diff) |
reduce_limit error is thrown when the reduce function output is not small enough compared to the input. Errors can be switched off using the config API.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@771466 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_query_servers.erl')
-rw-r--r-- | src/couchdb/couch_query_servers.erl | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/couchdb/couch_query_servers.erl b/src/couchdb/couch_query_servers.erl index 4ff69a2d..a27943a1 100644 --- a/src/couchdb/couch_query_servers.erl +++ b/src/couchdb/couch_query_servers.erl @@ -85,23 +85,27 @@ rereduce(_Lang, [], _ReducedValues) -> rereduce(Lang, RedSrcs, ReducedValues) -> Pid = get_os_process(Lang), Grouped = group_reductions_results(ReducedValues), - Results = lists:zipwith( + Results = try lists:zipwith( fun(FunSrc, Values) -> [true, [Result]] = couch_os_process:prompt(Pid, [<<"rereduce">>, [FunSrc], Values]), Result - end, RedSrcs, Grouped), - - ok = ret_os_process(Lang, Pid), + end, RedSrcs, Grouped) + after + ok = ret_os_process(Lang, Pid) + end, {ok, Results}. reduce(_Lang, [], _KVs) -> {ok, []}; reduce(Lang, RedSrcs, KVs) -> Pid = get_os_process(Lang), - [true, Results] = couch_os_process:prompt(Pid, - [<<"reduce">>, RedSrcs, KVs]), - ok = ret_os_process(Lang, Pid), + Results = try couch_os_process:prompt(Pid, + [<<"reduce">>, RedSrcs, KVs]) of + [true, Reductions] -> Reductions + after + ok = ret_os_process(Lang, Pid) + end, {ok, Results}. validate_doc_update(Lang, FunSrc, EditDoc, DiskDoc, Ctx) -> @@ -209,7 +213,8 @@ handle_call({get_proc, Lang}, _From, {Langs, PidLangs, Pids, InUse}=Server) -> add_value(PidLangs, Pid, Lang), rem_from_list(Pids, Lang, Pid), add_to_list(InUse, Lang, Pid), - true = couch_os_process:prompt(Pid, [<<"reset">>]), + QueryConfig = get_query_server_config(), + true = couch_os_process:prompt(Pid, [<<"reset">>, QueryConfig]), {reply, Pid, Server}; _ -> {ok, Pid} = new_process(Langs, Lang), @@ -249,6 +254,11 @@ code_change(_OldVsn, State, _Extra) -> % Private API +get_query_server_config() -> + ReduceLimit = list_to_atom( + couch_config:get("query_server_config","reduce_limit","true")), + {[{<<"reduce_limit">>, ReduceLimit}]}. + new_process(Langs, Lang) -> Proc = case ets:lookup(Langs, Lang) of |