You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2021/02/15 09:19:25 UTC

[couchdb] 01/01: Preserve max_dbs_open division during config change

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

rnewson pushed a commit to branch couch_server_config_change
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b040699537862cadd9173438e88a1edc60754004
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Feb 15 09:17:34 2021 +0000

    Preserve max_dbs_open division during config change
---
 src/couch/src/couch_server.erl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 480ed58..2090312 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -322,11 +322,13 @@ handle_config_change("couchdb", "update_lru_on_read", "true", _, N) ->
 handle_config_change("couchdb", "update_lru_on_read", _, _, N) ->
     gen_server:call(couch_server(N),{set_update_lru_on_read,false}),
     {ok, N};
-handle_config_change("couchdb", "max_dbs_open", Max, _, N) when is_list(Max) ->
-    gen_server:call(couch_server(N),{set_max_dbs_open,list_to_integer(Max)}),
+handle_config_change("couchdb", "max_dbs_open", Max0, _, N) when is_list(Max0) ->
+    Max1 = list_to_integer(Max0) div couch_server:num_servers(),
+    gen_server:call(couch_server(N),{set_max_dbs_open,Max1}),
     {ok, N};
 handle_config_change("couchdb", "max_dbs_open", _, _, N) ->
-    gen_server:call(couch_server(N),{set_max_dbs_open,?MAX_DBS_OPEN}),
+    Max = ?MAX_DBS_OPEN div couch_server:num_servers(),
+    gen_server:call(couch_server(N),{set_max_dbs_open,Max}),
     {ok, N};
 handle_config_change("couchdb_engines", _, _, _, N) ->
     gen_server:call(couch_server(N), reload_engines),