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 dfeac1de2 Persist purge infos limit when set
dfeac1de2 is described below
commit dfeac1de2d07e4732b2fb952af1cfac60cdf827f
Author: readyprompt <[email protected]>
AuthorDate: Sat Oct 31 17:07:14 2026 -0500
Persist purge infos limit when set
The set_purge_infos_limit callback (in couch_bt_engine) updates
memory and marks that it needs persisted. The handler for
set_purge_infos_limit does not persist the change. All of the other
handlers for the header data persist the data.
The new limit is not explicitly written to storage. If another
write does not occur before the database closes or the node restarts
then the header will revert to the last committed value and the
configured limit is lost.
Commit the set_purge_infos_limit data in the handler instead of
depending on another unrelated write.
Add cpse_set_purge_infos_limit to the props suite of the storage
engine. Modeled after the set_revs_limit test it will set the limit,
shut the database down, reopen it and validate the value survived.
The current coverage set the limit on an open database and read it
back, which just tests whether the change is in memory.
---
src/couch/src/couch_db_updater.erl | 5 +++--
src/couch_pse_tests/src/cpse_test_get_set_props.erl | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/couch/src/couch_db_updater.erl
b/src/couch/src/couch_db_updater.erl
index d2e044bf9..58bbe6ece 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -92,8 +92,9 @@ handle_call({set_revs_limit, Limit}, _From, Db) ->
{reply, ok, Db3};
handle_call({set_purge_infos_limit, Limit}, _From, Db) ->
{ok, Db2} = couch_db_engine:set_purge_infos_limit(Db, Limit),
- ok = couch_server:db_updated(Db2),
- {reply, ok, Db2};
+ Db3 = commit_data(Db2),
+ ok = couch_server:db_updated(Db3),
+ {reply, ok, Db3};
handle_call({set_time_seq, TSeq}, _From, Db) ->
{ok, Db1} = couch_db_engine:set_time_seq(Db, TSeq),
{ok, Db2} = couch_db_engine:commit_data(Db1#db{time_seq = TSeq}),
diff --git a/src/couch_pse_tests/src/cpse_test_get_set_props.erl
b/src/couch_pse_tests/src/cpse_test_get_set_props.erl
index 773f1d0dc..02ca75f49 100644
--- a/src/couch_pse_tests/src/cpse_test_get_set_props.erl
+++ b/src/couch_pse_tests/src/cpse_test_get_set_props.erl
@@ -75,6 +75,9 @@ cpse_set_security(DbName) ->
cpse_set_revs_limit(DbName) ->
check_prop_set(DbName, get_revs_limit, set_revs_limit, 1000, 50).
+cpse_set_purge_infos_limit(DbName) ->
+ check_prop_set(DbName, get_purge_infos_limit, set_purge_infos_limit, 1000,
50).
+
check_prop_set(DbName, GetFun, SetFun, Default, Value) ->
{ok, Db0} = cpse_util:create_db(DbName),