summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Allen <robert.allen1@ibm.com>2019-03-07 14:00:13 +0000
committerRob Allen <robert.allen1@ibm.com>2019-03-07 14:17:33 +0000
commit7df74029fef269c97b84abb1653ead8dc9bab99a (patch)
tree937a35badd3e6ce24aa61ef00174750f03026086
parent03d83317f57ebc92f144e70be02e25047b35af98 (diff)
downloadcouchdb-7df74029fef269c97b84abb1653ead8dc9bab99a.tar.gz
Avoid dreyfus_index_manager for _search_disk_size.
Previously, all use of the _search_disk_size endpoint was serialised through gen_server calls in dreyfus_index_manager. However, the code executed in response to the public interface function used no state from the server, relying only on the passed arguments. Under load, this resulted in dreyfus_index_manager accumulating a long message queue, with the usual negative side effects.
-rw-r--r--src/dreyfus_index_manager.erl10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/dreyfus_index_manager.erl b/src/dreyfus_index_manager.erl
index d59f4ea7f..47f254243 100644
--- a/src/dreyfus_index_manager.erl
+++ b/src/dreyfus_index_manager.erl
@@ -38,8 +38,9 @@ start_link() ->
get_index(DbName, Index) ->
gen_server:call(?MODULE, {get_index, DbName, Index}, infinity).
-get_disk_size(DbName, Index) ->
- gen_server:call(?MODULE, {get_disk_size, DbName, Index}, infinity).
+get_disk_size(DbName, #index{sig=Sig}) ->
+ Path = <<DbName/binary, "/", Sig/binary>>,
+ clouseau_rpc:disk_size(Path).
% gen_server functions.
@@ -64,11 +65,6 @@ handle_call({get_index, DbName, #index{sig=Sig}=Index}, From, State) ->
{reply, {ok, ExistingPid}, State}
end;
-handle_call({get_disk_size, DbName, #index{sig=Sig}=Index}, From, State) ->
- Path = <<DbName/binary,"/",Sig/binary>>,
- Reply = clouseau_rpc:disk_size(Path),
- {reply, Reply, State};
-
handle_call({open_ok, DbName, Sig, NewPid}, {OpenerPid, _}, State) ->
link(NewPid),
[{_, WaitList}] = ets:lookup(?BY_SIG, {DbName, Sig}),