You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2026/10/21 17:59:41 UTC
(couchdb) branch main updated: Always stem interactive updates
This is an automated email from the ASF dual-hosted git repository.
nickva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git
The following commit(s) were added to refs/heads/main by this push:
new 059f47db2 Always stem interactive updates
059f47db2 is described below
commit 059f47db2740f0caafbd35a5cce8f45c352a5022
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed Oct 21 10:12:28 2026 -0400
Always stem interactive updates
Remove `stem_interactive_updates = false` as an option. In #958 (2018) stemming
is an O(n) operation and not a O(n^2). We left the config value around "just in
case". However, since then we had never had to turn it to false.
Also, after a recent fix in rev tree merging #6168, `stem_interactive_updates =
false` allowed rev tree corruption to happen (see #6170 for details). So it
becomes an unsafe option and it's better to remove it.
Fix #6170
---
rel/overlay/etc/default.ini | 1 -
src/couch/src/couch_db_updater.erl | 12 +++---------
src/couch/test/eunit/couch_db_doc_tests.erl | 1 -
3 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 4d3602582..fb7ce89b1 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -60,7 +60,6 @@ view_index_dir = {{view_index_dir}}
; their execution as well.
;upgrade_in_progress = false
-;stem_interactive_updates = true
;uri_file =
; The speed of processing the _changes feed with doc_ids filter can be
diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 709f857b5..d2e044bf9 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -496,7 +496,7 @@ merge_rev_trees([NewDocs | RestDocsList], [OldDocInfo | RestOldInfo], Acc) ->
OldDocInfo,
NewDocs
),
- NewDocInfo1 = maybe_stem_full_doc_info(NewDocInfo0, Limit),
+ NewDocInfo1 = stem_full_doc_info(NewDocInfo0, Limit),
% When ReplicatedChanges is false, we updated #full_doc_info.deleted on every
% iteration of merge_rev_tree. However, merge_rev_tree does not update
% #full_doc_info.deleted when ReplicatedChanges is true, since we don't need
@@ -696,14 +696,8 @@ is_overflowed(New, Old, FullPartitions) ->
end
end.
-maybe_stem_full_doc_info(#full_doc_info{rev_tree = Tree} = Info, Limit) ->
- case config:get_boolean("couchdb", "stem_interactive_updates", true) of
- true ->
- Stemmed = couch_key_tree:stem(Tree, Limit),
- Info#full_doc_info{rev_tree = Stemmed};
- false ->
- Info
- end.
+stem_full_doc_info(#full_doc_info{rev_tree = Tree} = Info, Limit) ->
+ Info#full_doc_info{rev_tree = couch_key_tree:stem(Tree, Limit)}.
update_docs_int(Db, DocsList, LocalDocs, ReplicatedChanges) ->
UpdateSeq = couch_db_engine:get_update_seq(Db),
diff --git a/src/couch/test/eunit/couch_db_doc_tests.erl b/src/couch/test/eunit/couch_db_doc_tests.erl
index 46a42fe2d..75005df76 100644
--- a/src/couch/test/eunit/couch_db_doc_tests.erl
+++ b/src/couch/test/eunit/couch_db_doc_tests.erl
@@ -20,7 +20,6 @@ start() ->
setup() ->
DbName = ?tempdb(),
- config:set("couchdb", "stem_interactive_updates", "false", false),
{ok, Db} = couch_db:create(DbName, [?ADMIN_CTX]),
couch_db:close(Db),
DbName.