From 9b1ef6d155f6c8cf14f99ea0298d21455c558d6d Mon Sep 17 00:00:00 2001 From: Carlos Andres Bolanos Date: Sat, 25 May 2024 12:37:25 +0200 Subject: [PATCH] Fix compatibility with OTP 26 --- .gitignore | 1 + .tool-versions | 1 + src/shards.erl | 10 ++++++++++ test/shards_SUITE.erl | 15 --------------- 4 files changed, 12 insertions(+), 15 deletions(-) create mode 100644 .tool-versions diff --git a/.gitignore b/.gitignore index 755ad9f..c9ece70 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ doc docs /priv/plts /bench +rebar3 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..cad8d03 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +erlang 26.2 diff --git a/src/shards.erl b/src/shards.erl index add6b04..5965b74 100644 --- a/src/shards.erl +++ b/src/shards.erl @@ -970,6 +970,15 @@ maybe_register(Name, Pid, Options) -> ok end. +-ifndef(OTP_RELEASE). +%% OTP 20 or lower. +-define(OTP_RELEASE, 20). +-endif. + +-if(?OTP_RELEASE >= 26). +%% @private +wrap_exit() -> ok. +-else. %% @private wrap_exit() -> % We wait for the 'EXIT' signal from the partition supervisor knowing @@ -978,6 +987,7 @@ wrap_exit() -> receive {'EXIT', _Pid, _Reason} -> ok end. +-endif. %% @equiv next(Tab, Key1, shards_meta:get(Tab)) next(Tab, Key1) -> diff --git a/test/shards_SUITE.erl b/test/shards_SUITE.erl index 0435ec4..7fe9807 100644 --- a/test/shards_SUITE.erl +++ b/test/shards_SUITE.erl @@ -40,21 +40,6 @@ t_table_creation_errors/1 ]). -% %% Test Cases Helpers -% -export([ -% t_basic_ops_/1, -% t_match_ops_/1, -% t_select_ops_/1 -% ]). - -% %% Helpers -% -export([ -% init_shards/0, -% init_shards/1, -% cleanup_shards/0, -% delete_shards/0 -% ]). - -define(EXCLUDED_FUNS, [ module_info, all,