This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a commit to branch couch-stats-resource-tracker-rebase
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to 
refs/heads/couch-stats-resource-tracker-rebase by this push:
     new 395634b75 Make group_by fold configurable
395634b75 is described below

commit 395634b75598f1235f92876011abe02614c8b304
Author: Russell Branca <chewbra...@apache.org>
AuthorDate: Fri Mar 1 10:25:17 2024 -0800

    Make group_by fold configurable
---
 src/couch_stats/src/couch_stats_resource_tracker.erl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/couch_stats/src/couch_stats_resource_tracker.erl 
b/src/couch_stats/src/couch_stats_resource_tracker.erl
index 102ca0a8c..ee7e79ed8 100644
--- a/src/couch_stats/src/couch_stats_resource_tracker.erl
+++ b/src/couch_stats/src/couch_stats_resource_tracker.erl
@@ -420,7 +420,13 @@ group_by(KeyFun, ValFun) ->
 
 
 group_by(KeyFun, ValFun, AggFun) ->
-    group_by(KeyFun, ValFun, AggFun, fun ets:foldl/3).
+    Fold = case conf_get("fold_fun") of
+        "unsafe" ->
+            fun unsafe_foldl/3;
+        _ ->
+            fun ets:foldl/3
+    end,
+    group_by(KeyFun, ValFun, AggFun, Fold).
 
 
 %% eg: group_by(mfa, docs_read).

Reply via email to