Skip to content

Commit 4def1f9

Browse files
committed
Remove file_handle_cache
The module is no longer used now that CQv1 has been removed. The only useful function remaining is `ulimit/1` which is used both in metrics and to provide a warning if too low on startup. It was moved to rabbit_runtime. The startup warning logic was moved out into rabbitmq_prelaunch. We still have some FHC related metrics that are set to 0 and are kept for compatibility reasons. Also remove unused rabbit env queue_index_max_journal_entries.
1 parent 59a9671 commit 4def1f9

File tree

14 files changed

+58
-1974
lines changed

14 files changed

+58
-1974
lines changed

deps/rabbit/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ define PROJECT_ENV
2828
{heartbeat, 60},
2929
{msg_store_file_size_limit, 16777216},
3030
{msg_store_shutdown_timeout, 600000},
31-
{fhc_write_buffering, true},
32-
{fhc_read_buffering, false},
33-
{queue_index_max_journal_entries, 32768},
3431
{queue_index_embed_msgs_below, 4096},
3532
{default_user, <<"guest">>},
3633
{default_pass, <<"guest">>},
@@ -269,7 +266,7 @@ PARALLEL_CT_SET_1_D = amqqueue_backward_compatibility channel_interceptor channe
269266

270267
PARALLEL_CT_SET_2_A = cluster confirms_rejects consumer_timeout rabbit_access_control rabbit_confirms rabbit_core_metrics_gc rabbit_cuttlefish rabbit_db_binding rabbit_db_exchange
271268
PARALLEL_CT_SET_2_B = crashing_queues deprecated_features direct_exchange_routing_v2 disconnect_detected_during_alarm exchanges unit_gen_server2
272-
PARALLEL_CT_SET_2_C = disk_monitor dynamic_qq unit_disk_monitor unit_file_handle_cache unit_log_management unit_operator_policy prevent_startup_if_node_was_reset
269+
PARALLEL_CT_SET_2_C = disk_monitor dynamic_qq unit_disk_monitor unit_log_management unit_operator_policy prevent_startup_if_node_was_reset
273270
PARALLEL_CT_SET_2_D = queue_length_limits queue_parallel quorum_queue_member_reconciliation rabbit_fifo rabbit_fifo_dlx rabbit_stream_coordinator
274271

275272
PARALLEL_CT_SET_3_A = definition_import per_user_connection_channel_limit_partitions per_vhost_connection_limit_partitions policy priority_queue_recovery rabbit_fifo_v0 rabbit_stream_sac_coordinator_v4 rabbit_stream_sac_coordinator unit_credit_flow unit_queue_consumers unit_queue_location unit_quorum_queue

deps/rabbit/src/file_handle_cache.erl

Lines changed: 0 additions & 1615 deletions
This file was deleted.

deps/rabbit/src/rabbit.erl

Lines changed: 3 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
stop_and_halt/0, await_startup/0, await_startup/1, await_startup/3,
1818
status/0, is_running/0, is_serving/0, alarms/0,
1919
is_running/1, is_serving/1, environment/0, rotate_logs/0,
20-
force_event_refresh/1,
21-
start_fhc/0]).
20+
force_event_refresh/1]).
2221

2322
-export([start/2, stop/1, prep_stop/1]).
2423
-export([start_apps/1, start_apps/2, stop_apps/1]).
@@ -82,7 +81,7 @@
8281

8382
-rabbit_boot_step({database,
8483
[{mfa, {rabbit_db, init, []}},
85-
{requires, file_handle_cache},
84+
{requires, code_server_cache},
8685
{enables, external_infrastructure}]}).
8786

8887
-rabbit_boot_step({networking_metadata_store,
@@ -101,13 +100,6 @@
101100
[{description, "code_server cache server"},
102101
{mfa, {rabbit_sup, start_child, [code_server_cache]}},
103102
{requires, rabbit_alarm},
104-
{enables, file_handle_cache}]}).
105-
106-
-rabbit_boot_step({file_handle_cache,
107-
[{description, "file handle cache server"},
108-
{mfa, {rabbit, start_fhc, []}},
109-
%% FHC needs memory monitor to be running
110-
{requires, code_server_cache},
111103
{enables, worker_pool}]}).
112104

113105
-rabbit_boot_step({worker_pool,
@@ -765,9 +757,6 @@ status() ->
765757
get_disk_free_limit, []}},
766758
{disk_free, {rabbit_disk_monitor,
767759
get_disk_free, []}}]),
768-
S3 = rabbit_misc:with_exit_handler(
769-
fun () -> [] end,
770-
fun () -> [{file_descriptors, file_handle_cache:info()}] end),
771760
S4 = [{processes, [{limit, erlang:system_info(process_limit)},
772761
{used, erlang:system_info(process_count)}]},
773762
{run_queue, erlang:statistics(run_queue)},
@@ -802,7 +791,7 @@ status() ->
802791
(_) -> false
803792
end,
804793
maps:to_list(product_info())),
805-
S1 ++ S2 ++ S3 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.
794+
S1 ++ S2 ++ S4 ++ S5 ++ S6 ++ S7 ++ S8.
806795

807796
alarms() ->
808797
Alarms = rabbit_misc:with_exit_handler(rabbit_misc:const([]),
@@ -1642,63 +1631,6 @@ home_dir() ->
16421631
config_files() ->
16431632
rabbit_config:config_files().
16441633

1645-
%% We don't want this in fhc since it references rabbit stuff. And we can't put
1646-
%% this in the bootstep directly.
1647-
start_fhc() ->
1648-
ok = rabbit_sup:start_restartable_child(
1649-
file_handle_cache,
1650-
[fun(_) -> ok end, fun(_) -> ok end]),
1651-
ensure_working_fhc(),
1652-
maybe_warn_low_fd_limit().
1653-
1654-
ensure_working_fhc() ->
1655-
%% To test the file handle cache, we simply read a file we know it
1656-
%% exists (Erlang kernel's .app file).
1657-
%%
1658-
%% To avoid any pollution of the application process' dictionary by
1659-
%% file_handle_cache, we spawn a separate process.
1660-
Parent = self(),
1661-
TestFun = fun() ->
1662-
ReadBuf = case application:get_env(rabbit, fhc_read_buffering) of
1663-
{ok, true} -> "ON";
1664-
{ok, false} -> "OFF"
1665-
end,
1666-
WriteBuf = case application:get_env(rabbit, fhc_write_buffering) of
1667-
{ok, true} -> "ON";
1668-
{ok, false} -> "OFF"
1669-
end,
1670-
?LOG_INFO("FHC read buffering: ~ts", [ReadBuf],
1671-
#{domain => ?RMQLOG_DOMAIN_GLOBAL}),
1672-
?LOG_INFO("FHC write buffering: ~ts", [WriteBuf],
1673-
#{domain => ?RMQLOG_DOMAIN_GLOBAL}),
1674-
Filename = filename:join(code:lib_dir(kernel), "ebin/kernel.app"),
1675-
{ok, Fd} = file_handle_cache:open(Filename, [raw, binary, read], []),
1676-
{ok, _} = file_handle_cache:read(Fd, 1),
1677-
ok = file_handle_cache:close(Fd),
1678-
Parent ! fhc_ok
1679-
end,
1680-
TestPid = spawn_link(TestFun),
1681-
%% Because we are waiting for the test fun, abuse the
1682-
%% 'mnesia_table_loading_retry_timeout' parameter to find a sane timeout
1683-
%% value.
1684-
Timeout = rabbit_table:retry_timeout(),
1685-
receive
1686-
fhc_ok -> ok;
1687-
{'EXIT', TestPid, Exception} -> throw({ensure_working_fhc, Exception})
1688-
after Timeout ->
1689-
throw({ensure_working_fhc, {timeout, TestPid}})
1690-
end.
1691-
1692-
maybe_warn_low_fd_limit() ->
1693-
case file_handle_cache:ulimit() of
1694-
%% unknown is included as atom() > integer().
1695-
L when L > 1024 ->
1696-
ok;
1697-
L ->
1698-
?LOG_WARNING("Available file handles: ~tp. "
1699-
"Please consider increasing system limits", [L])
1700-
end.
1701-
17021634
%% Any configuration that
17031635
%% 1. is not allowed to change while RabbitMQ is running, and
17041636
%% 2. is read often

deps/rabbit/src/rabbit_fhc_helpers.erl

Lines changed: 0 additions & 44 deletions
This file was deleted.

deps/rabbit/test/backing_queue_SUITE.erl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -769,20 +769,13 @@ gen_result([{msg, MsgId, Msg}|Tail], Offset, Acc) ->
769769
%% -------------------------------------------------------------------
770770

771771
setup_backing_queue_test_group(Config) ->
772-
{ok, MaxJournal} =
773-
application:get_env(rabbit, queue_index_max_journal_entries),
774-
application:set_env(rabbit, queue_index_max_journal_entries, 128),
775772
{ok, Bytes} =
776773
application:get_env(rabbit, queue_index_embed_msgs_below),
777774
rabbit_ct_helpers:set_config(Config, [
778-
{rmq_queue_index_max_journal_entries, MaxJournal},
779775
{rmq_queue_index_embed_msgs_below, Bytes}
780776
]).
781777

782778
teardown_backing_queue_test_group(Config) ->
783-
%% FIXME: Undo all the setup function did.
784-
application:set_env(rabbit, queue_index_max_journal_entries,
785-
?config(rmq_queue_index_max_journal_entries, Config)),
786779
%% We will have restarted the message store, and thus changed
787780
%% the order of the children of rabbit_sup. This will cause
788781
%% problems if there are subsequent failures - see bug 24262.

0 commit comments

Comments
 (0)