summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2009-05-04 22:06:12 +0000
committerJohn Christopher Anderson <jchris@apache.org>2009-05-04 22:06:12 +0000
commit2d0503e3bb0c50c99670c01272ee8c1fe7710f8d (patch)
treeabde95fef91189736e89c4ea5c3ae277e6ff46e7 /src/couchdb
parent7c05a60479bacc7acbf6f704285a4ab2981ba02b (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')
-rw-r--r--src/couchdb/couch_query_servers.erl26
-rw-r--r--src/couchdb/couch_view_group.erl10
2 files changed, 25 insertions, 11 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
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl
index 57ee97da..af4ea814 100644
--- a/src/couchdb/couch_view_group.erl
+++ b/src/couchdb/couch_view_group.erl
@@ -42,9 +42,9 @@ request_group(Pid, Seq) ->
{ok, Group, RefCounter} ->
couch_ref_counter:add(RefCounter),
{ok, Group};
- Else ->
- ?LOG_DEBUG("get_updated_group replied with _Else ~p", [Else]),
- Else
+ Error ->
+ ?LOG_DEBUG("request_group Error ~p", [Error]),
+ throw(Error)
end.
@@ -261,6 +261,10 @@ handle_info({'EXIT', FromPid, reset},
handle_info({'EXIT', _FromPid, normal}, State) ->
{noreply, State};
+handle_info({'EXIT', FromPid, {{nocatch, Reason}, Trace}}, State) ->
+ ?LOG_DEBUG("Uncaught throw() in linked pid: ~p", [{FromPid, Reason}]),
+ {stop, Reason, State};
+
handle_info({'EXIT', FromPid, Reason}, State) ->
?LOG_DEBUG("Exit from linked pid: ~p", [{FromPid, Reason}]),
{stop, Reason, State};