summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Branca <chewbranca@apache.org>2018-09-04 18:53:56 +0000
committerPaul J. Davis <paul.joseph.davis@gmail.com>2018-09-10 14:21:32 -0500
commit19a390c8ea41bf84d1a38096e622b10eb94daf7c (patch)
tree8f23cf51f1a6bbdaa262f57b860747226455d088
parent8c64ee74e051add907889b2c570a955134c3a7f6 (diff)
downloadcouchdb-19a390c8ea41bf84d1a38096e622b10eb94daf7c.tar.gz
Don't send update_lru messages when disabled
The couchdb.update_lru_on_read setting controls whether couch_server uses read requests as LRU update triggers. Unfortunately, the messages for update_lru on reads are sent regardless of whether this is enabled or disabled. While in principle this is harmless, and overloaded couch_server pid can accumulate a considerable volume of these messages, even when disabled. This patch prevents the caller from sending an update_lru message when the setting is disabled.
-rw-r--r--src/couch/src/couch_server.erl11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index ef895a414..c4b7bf199 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -101,9 +101,14 @@ open(DbName, Options0) ->
end.
update_lru(DbName, Options) ->
- case lists:member(sys_db, Options) of
- false -> gen_server:cast(couch_server, {update_lru, DbName});
- true -> ok
+ case config:get_boolean("couchdb", "update_lru_on_read", false) of
+ true ->
+ case lists:member(sys_db, Options) of
+ false -> gen_server:cast(couch_server, {update_lru, DbName});
+ true -> ok
+ end;
+ false ->
+ ok
end.
close_lru() ->