Skip to content

Commit

Permalink
Don't send update_lru messages when disabled
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chewbranca committed Sep 4, 2018
1 parent 0b2f068 commit 4afed4e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/couch/src/couch_server.erl
Expand Up @@ -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() ->
Expand Down

0 comments on commit 4afed4e

Please sign in to comment.