summaryrefslogtreecommitdiff
path: root/share/server/views.js
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 /share/server/views.js
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 'share/server/views.js')
-rw-r--r--share/server/views.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/share/server/views.js b/share/server/views.js
index c6d71579..de728ac2 100644
--- a/share/server/views.js
+++ b/share/server/views.js
@@ -46,7 +46,17 @@ var Views = (function() {
reductions[i] = null;
}
}
- print("[true," + toJSON(reductions) + "]");
+ var reduce_line = toJSON(reductions);
+ var reduce_length = reduce_line.length;
+ if (query_config && query_config.reduce_limit &&
+ reduce_length > 200 && ((reduce_length * 2) > line.length)) {
+ throw {
+ error:"reduce_overflow_error",
+ reason: "Reduce output must shrink more rapidly. Current output: '"+reduce_line+"'"
+ };
+ } else {
+ print("[true," + reduce_line + "]");
+ }
};
return {