diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-06-24 16:38:40 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2015-06-24 18:54:31 +0200 |
| commit | 47cde19cf0a4d3b771c0c168f44591dae18e50eb (patch) | |
| tree | d9a839c67e48ac9c8e57a443910d7a8f3ffe29c3 | |
| parent | 8a485193c7a00fd6685a2ebe9175fba11fd8aa34 (diff) | |
| download | rabbitmq-server-git-47cde19cf0a4d3b771c0c168f44591dae18e50eb.tar.gz | |
Limit clear_read_cache/0 action to the node it is running on
References #196.
| -rw-r--r-- | src/file_handle_cache.erl | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl index dfbfa41fa0..d8203af877 100644 --- a/src/file_handle_cache.erl +++ b/src/file_handle_cache.erl @@ -596,13 +596,17 @@ clear_vhost_read_cache([VHost | Rest]) -> clear_queue_read_cache([]) -> ok; clear_queue_read_cache([#amqqueue{pid = MPid, slave_pids = SPids} | Rest]) -> + %% Limit the action to the current node. + Pids = [P || P <- [MPid | SPids], node(P) =:= node()], + %% This function is executed in the context of the backing queue + %% process because the read buffer is stored in the process + %% dictionary. Fun = fun(_, State) -> clear_process_read_cache(), State end, - rabbit_amqqueue:run_backing_queue(MPid, rabbit_variable_queue, Fun), - [rabbit_amqqueue:run_backing_queue(SPid, rabbit_variable_queue, Fun) - || SPid <- SPids], + [rabbit_amqqueue:run_backing_queue(Pid, rabbit_variable_queue, Fun) + || Pid <- Pids], clear_queue_read_cache(Rest). clear_process_read_cache() -> |
