Skip to content

Move file_handle_cache and vm_memory_monitor back to rabbit (backport #13861) #13867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
page_size = undefined,
proc_file = undefined}).

-include("rabbit_memory.hrl").
-include("include/rabbit_memory.hrl").

%%----------------------------------------------------------------------------

Expand Down
48 changes: 47 additions & 1 deletion deps/rabbit/test/unit_vm_memory_monitor_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

-include_lib("eunit/include/eunit.hrl").

-include("include/rabbit_memory.hrl").

-compile(export_all).

all() ->
Expand All @@ -22,7 +24,11 @@ groups() ->
parse_line_linux,
set_vm_memory_high_watermark_relative1,
set_vm_memory_high_watermark_relative2,
set_vm_memory_high_watermark_absolute
set_vm_memory_high_watermark_absolute,
parse_mem_limit_relative_exactly_max,
parse_mem_relative_above_max,
parse_mem_relative_integer,
parse_mem_relative_invalid
]}
].

Expand Down Expand Up @@ -119,3 +125,43 @@ set_and_verify_vm_memory_high_watermark_absolute(MemLimit0) ->
ct:fail("Expected memory high watermark to be ~tp but it was ~tp", [Interpreted, MemLimit])
end,
vm_memory_monitor:set_vm_memory_high_watermark(0.6).

parse_mem_limit_relative_exactly_max(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1.0),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_above_max(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1.01),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_integer(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_invalid(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit([255]),
case MemLimit of
?DEFAULT_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?DEFAULT_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.
2 changes: 1 addition & 1 deletion deps/rabbit_common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ define HEX_TARBALL_EXTRA_METADATA
}
endef

LOCAL_DEPS = compiler crypto public_key sasl ssl syntax_tools tools xmerl os_mon runtime_tools
LOCAL_DEPS = compiler crypto public_key sasl ssl syntax_tools tools xmerl runtime_tools
DEPS = thoas ranch recon credentials_obfuscation

# Variables and recipes in development.*.mk are meant to be used from
Expand Down
48 changes: 0 additions & 48 deletions deps/rabbit_common/test/unit_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").

-include("rabbit_memory.hrl").
-include("rabbit.hrl").

-compile(export_all).
Expand All @@ -26,7 +25,6 @@
all() ->
[
{group, parallel_tests},
{group, parse_mem_limit},
{group, gen_server2},
{group, date_time}
].
Expand All @@ -53,12 +51,6 @@ groups() ->
get_erl_path,
hexify
]},
{parse_mem_limit, [parallel], [
parse_mem_limit_relative_exactly_max,
parse_mem_relative_above_max,
parse_mem_relative_integer,
parse_mem_relative_invalid
]},
{gen_server2, [parallel], [
stats_timer_is_working,
stats_timer_writes_gen_server2_metrics_if_core_metrics_ets_exists,
Expand Down Expand Up @@ -254,46 +246,6 @@ gen_server2_stop(_) ->
?assertEqual({'EXIT', noproc}, (catch gen_server:stop(TestServer))),
ok.

parse_mem_limit_relative_exactly_max(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1.0),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_above_max(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1.01),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_integer(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit(1),
case MemLimit of
?MAX_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?MAX_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

parse_mem_relative_invalid(_Config) ->
MemLimit = vm_memory_monitor:parse_mem_limit([255]),
case MemLimit of
?DEFAULT_VM_MEMORY_HIGH_WATERMARK -> ok;
_ -> ct:fail(
"Expected memory limit to be ~tp, but it was ~tp",
[?DEFAULT_VM_MEMORY_HIGH_WATERMARK, MemLimit]
)
end.

platform_and_version(_Config) ->
MajorVersion = erlang:system_info(otp_release),
Result = rabbit_misc:platform_and_version(),
Expand Down
Loading