LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0001-clean-up-workarounds-for-Erlang-OTP-18.patch of Package rabbitmq-server (Project home:Ledest:erlang)

From 8520ecccc33b70c811df696ce97a38c4e8ad4fff Mon Sep 17 00:00:00 2001
From: Led <ledest@gmail.com>
Date: Tue, 7 Nov 2017 18:49:01 +0200
Subject: [PATCH] clean up workarounds for Erlang/OTP < 18

---
 src/gm.erl                                    |   2 +-
 src/lqueue.erl                                |   4 +-
 src/rabbit_amqqueue_process.erl               |  10 +--
 src/rabbit_binding.erl                        |   2 +-
 src/rabbit_channel.erl                        |   2 +-
 src/rabbit_cli.erl                            |   2 +-
 src/rabbit_dead_letter.erl                    |   2 +-
 src/rabbit_error_logger.erl                   |   2 +-
 src/rabbit_hipe.erl                           |   6 +-
 src/rabbit_limiter.erl                        |   2 +-
 src/rabbit_mirror_queue_master.erl            |   6 +-
 src/rabbit_mirror_queue_mode_exactly.erl      |   2 +-
 src/rabbit_mirror_queue_sync.erl              |   7 +-
 src/rabbit_msg_store.erl                      |   4 +-
 src/rabbit_password.erl                       |   2 +-
 src/rabbit_queue_consumers.erl                |  10 +--
 src/rabbit_queue_index.erl                    |  14 ++--
 src/rabbit_queue_location_random.erl          |   2 +-
 src/rabbit_reader.erl                         |   9 +-
 src/rabbit_variable_queue.erl                 |  14 ++--
 src/term_to_binary_compat.erl                 |  24 ------
 test/backing_queue_SUITE.erl                  |   2 +-
 test/channel_operation_timeout_test_queue.erl |  14 ++--
 test/priority_queue_SUITE.erl                 |   2 +-
 test/term_to_binary_compat_prop_SUITE.erl     | 114 --------------------------
 25 files changed, 58 insertions(+), 202 deletions(-)
 delete mode 100644 src/term_to_binary_compat.erl
 delete mode 100644 test/term_to_binary_compat_prop_SUITE.erl

diff --git a/src/gm.erl b/src/gm.erl
index d6005fe55..6c58c2846 100644
--- a/src/gm.erl
+++ b/src/gm.erl
@@ -1090,7 +1090,7 @@ join_group(Self, GroupName, #gm_group { members = Members } = Group, TxnFun) ->
                                prune_or_create_group(Self, GroupName, TxnFun),
                                TxnFun);
                 Alive ->
-                    Left = lists:nth(rand_compat:uniform(length(Alive)), Alive),
+                    Left = lists:nth(rand:uniform(length(Alive)), Alive),
                     Handler =
                         fun () ->
                                 join_group(
diff --git a/src/lqueue.erl b/src/lqueue.erl
index fc7157dff..065206107 100644
--- a/src/lqueue.erl
+++ b/src/lqueue.erl
@@ -27,9 +27,7 @@
 
 -export_type([?MODULE/0]).
 
--include_lib("rabbit_common/include/old_builtin_types.hrl").
-
--opaque ?MODULE() :: {non_neg_integer(), ?QUEUE_TYPE()}.
+-opaque ?MODULE() :: {non_neg_integer(), queue:queue()}.
 -type value()     :: any().
 -type result()    :: 'empty' | {'value', value()}.
 
diff --git a/src/rabbit_amqqueue_process.erl b/src/rabbit_amqqueue_process.erl
index 5918a2b58..3c4f5ce3c 100644
--- a/src/rabbit_amqqueue_process.erl
+++ b/src/rabbit_amqqueue_process.erl
@@ -95,7 +95,7 @@
 -spec info_keys() -> rabbit_types:info_keys().
 -spec init_with_backing_queue_state
         (rabbit_types:amqqueue(), atom(), tuple(), any(),
-         [rabbit_types:delivery()], pmon:pmon(), ?DICT_TYPE()) ->
+         [rabbit_types:delivery()], pmon:pmon(), dict:dict()) ->
             #q{}.
 
 %%----------------------------------------------------------------------------
@@ -464,7 +464,7 @@ ensure_ttl_timer(undefined, State) ->
     State;
 ensure_ttl_timer(Expiry, State = #q{ttl_timer_ref       = undefined,
                                     args_policy_version = Version}) ->
-    After = (case Expiry - time_compat:os_system_time(micro_seconds) of
+    After = (case Expiry - os:system_time(micro_seconds) of
                  V when V > 0 -> V + 999; %% always fire later
                  _            -> 0
              end) div 1000,
@@ -784,7 +784,7 @@ calculate_msg_expiry(#basic_message{content = Content}, TTL) ->
     {ok, MsgTTL} = rabbit_basic:parse_expiration(Props),
     case lists:min([TTL, MsgTTL]) of
         undefined -> undefined;
-        T         -> time_compat:os_system_time(micro_seconds) + T * 1000
+        T         -> os:system_time(micro_seconds) + T * 1000
     end.
 
 %% Logically this function should invoke maybe_send_drained/2.
@@ -795,7 +795,7 @@ calculate_msg_expiry(#basic_message{content = Content}, TTL) ->
 drop_expired_msgs(State) ->
     case is_empty(State) of
         true  -> State;
-        false -> drop_expired_msgs(time_compat:os_system_time(micro_seconds),
+        false -> drop_expired_msgs(os:system_time(micro_seconds),
                                    State)
     end.
 
@@ -1415,7 +1415,7 @@ handle_pre_hibernate(State = #q{backing_queue = BQ,
       State, #q.stats_timer,
       fun () -> emit_stats(State,
                            [{idle_since,
-                             time_compat:os_system_time(milli_seconds)},
+                             os:system_time(milli_seconds)},
                             {consumer_utilisation, ''}])
                 end),
     State1 = rabbit_event:stop_stats_timer(State#q{backing_queue_state = BQS3},
diff --git a/src/rabbit_binding.erl b/src/rabbit_binding.erl
index a02cba53d..305eb3920 100644
--- a/src/rabbit_binding.erl
+++ b/src/rabbit_binding.erl
@@ -52,7 +52,7 @@
 
 %% TODO this should really be opaque but that seems to confuse 17.1's
 %% dialyzer into objecting to everything that uses it.
--type deletions() :: ?DICT_TYPE().
+-type deletions() :: dict:dict().
 
 -spec recover([rabbit_exchange:name()], [rabbit_amqqueue:name()]) ->
                         'ok'.
diff --git a/src/rabbit_channel.erl b/src/rabbit_channel.erl
index 6e1f5060e..5a8189666 100644
--- a/src/rabbit_channel.erl
+++ b/src/rabbit_channel.erl
@@ -624,7 +624,7 @@ handle_pre_hibernate(State) ->
       State, #ch.stats_timer,
       fun () -> emit_stats(State,
                            [{idle_since,
-                             time_compat:os_system_time(milli_seconds)}])
+                             os:system_time(milli_seconds)}])
                 end),
     {hibernate, rabbit_event:stop_stats_timer(State, #ch.stats_timer)}.
 
diff --git a/src/rabbit_cli.erl b/src/rabbit_cli.erl
index c4c7b8eae..5d47a2121 100644
--- a/src/rabbit_cli.erl
+++ b/src/rabbit_cli.erl
@@ -177,7 +177,7 @@ name_type() ->
     end.
 
 generate_cli_node_name() ->
-    Base = rabbit_misc:format("rabbitmq-cli-~2..0b", [rand_compat:uniform(100)]),
+    Base = rabbit_misc:format("rabbitmq-cli-~2..0b", [rand:uniform(100)]),
     NameAsList =
         case {name_type(), inet_db:res_option(domain)} of
             {longnames, []} ->
diff --git a/src/rabbit_dead_letter.erl b/src/rabbit_dead_letter.erl
index af897ccb6..ca4871d2e 100644
--- a/src/rabbit_dead_letter.erl
+++ b/src/rabbit_dead_letter.erl
@@ -49,7 +49,7 @@ make_msg(Msg = #basic_message{content       = Content,
             _         -> {[RK], fun (H) -> lists:keydelete(<<"CC">>, 1, H) end}
         end,
     ReasonBin = list_to_binary(atom_to_list(Reason)),
-    TimeSec = time_compat:os_system_time(seconds),
+    TimeSec = os:system_time(seconds),
     PerMsgTTL = per_msg_ttl_header(Content#content.properties),
     HeadersFun2 =
         fun (Headers) ->
diff --git a/src/rabbit_error_logger.erl b/src/rabbit_error_logger.erl
index 4f7c4e32c..7558ccc6e 100644
--- a/src/rabbit_error_logger.erl
+++ b/src/rabbit_error_logger.erl
@@ -97,7 +97,7 @@ publish(_Other, _Format, _Data, _State) ->
 publish1(RoutingKey, Format, Data, LogExch) ->
     %% 0-9-1 says the timestamp is a "64 bit POSIX timestamp". That's
     %% second resolution, not millisecond.
-    Timestamp = time_compat:os_system_time(seconds),
+    Timestamp = os:system_time(seconds),
 
     Args = [truncate:term(A, ?LOG_TRUNC) || A <- Data],
     Headers = [{<<"node">>, longstr, list_to_binary(atom_to_list(node()))}],
diff --git a/src/rabbit_hipe.erl b/src/rabbit_hipe.erl
index d4597d4ef..6957d85cb 100644
--- a/src/rabbit_hipe.erl
+++ b/src/rabbit_hipe.erl
@@ -79,7 +79,7 @@ do_hipe_compile(HipeModules, CompileFun) ->
     Count = length(HipeModules),
     io:format("~nHiPE compiling:  |~s|~n                 |",
               [string:copies("-", Count)]),
-    T1 = time_compat:monotonic_time(),
+    T1 = erlang:monotonic_time(),
     %% We use code:get_object_code/1 below to get the beam binary,
     %% instead of letting hipe get it itself, because hipe:c/{1,2}
     %% expects the given filename to actually exist on disk: it does not
@@ -99,8 +99,8 @@ do_hipe_compile(HipeModules, CompileFun) ->
          {'DOWN', MRef, process, _, normal} -> ok;
          {'DOWN', MRef, process, _, Reason} -> exit(Reason)
      end || {_Pid, MRef} <- PidMRefs],
-    T2 = time_compat:monotonic_time(),
-    Duration = time_compat:convert_time_unit(T2 - T1, native, seconds),
+    T2 = erlang:monotonic_time(),
+    Duration = erlang:convert_time_unit(T2 - T1, native, seconds),
     io:format("|~n~nCompiled ~B modules in ~Bs~n", [Count, Duration]),
     {ok, Count, Duration}.
 
diff --git a/src/rabbit_limiter.erl b/src/rabbit_limiter.erl
index 1e715a8c1..e81b10a55 100644
--- a/src/rabbit_limiter.erl
+++ b/src/rabbit_limiter.erl
@@ -432,7 +432,7 @@ notify_queues(State = #lim{ch_pid = ChPid, queues = Queues}) ->
             %% We randomly vary the position of queues in the list,
             %% thus ensuring that each queue has an equal chance of
             %% being notified first.
-            {L1, L2} = lists:split(rand_compat:uniform(L), QList),
+            {L1, L2} = lists:split(rand:uniform(L), QList),
             [[ok = rabbit_amqqueue:resume(Q, ChPid) || Q <- L3]
              || L3 <- [L2, L1]],
             ok
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl
index efb7fb34f..eed0269ab 100644
--- a/src/rabbit_mirror_queue_master.erl
+++ b/src/rabbit_mirror_queue_master.erl
@@ -57,13 +57,13 @@
                                  coordinator         :: pid(),
                                  backing_queue       :: atom(),
                                  backing_queue_state :: any(),
-                                 seen_status         :: ?DICT_TYPE(),
+                                 seen_status         :: dict:dict(),
                                  confirmed           :: [rabbit_guid:guid()],
-                                 known_senders       :: ?SET_TYPE()
+                                 known_senders       :: sets:set()
                                }.
 -spec promote_backing_queue_state
         (rabbit_amqqueue:name(), pid(), atom(), any(), pid(), [any()],
-         ?DICT_TYPE(), [pid()]) ->
+         dict:dict(), [pid()]) ->
             master_state().
 
 -spec sender_death_fun() -> death_fun().
diff --git a/src/rabbit_mirror_queue_mode_exactly.erl b/src/rabbit_mirror_queue_mode_exactly.erl
index 593f0a413..c2ffa39f5 100644
--- a/src/rabbit_mirror_queue_mode_exactly.erl
+++ b/src/rabbit_mirror_queue_mode_exactly.erl
@@ -45,7 +45,7 @@ suggested_queue_nodes(Count, MNode, SNodes, _SSNodes, Poss) ->
             end}.
 
 shuffle(L) ->
-    {_, L1} = lists:unzip(lists:keysort(1, [{rand_compat:uniform(), N} || N <- L])),
+    {_, L1} = lists:unzip(lists:keysort(1, [{rand:uniform(), N} || N <- L])),
     L1.
 
 validate_policy(N) when is_integer(N) andalso N > 0 ->
diff --git a/src/rabbit_mirror_queue_sync.erl b/src/rabbit_mirror_queue_sync.erl
index 9e6182488..9a3942bf1 100644
--- a/src/rabbit_mirror_queue_sync.erl
+++ b/src/rabbit_mirror_queue_sync.erl
@@ -104,7 +104,7 @@ master_batch_go0(Args, BatchSize, BQ, BQS) ->
                     false -> {cont, Acc1}
                 end
         end,
-    FoldAcc = {[], 0, {0, BQ:depth(BQS)}, time_compat:monotonic_time()},
+    FoldAcc = {[], 0, {0, BQ:depth(BQS)}, erlang:monotonic_time()},
     bq_fold(FoldFun, FoldAcc, Args, BQ, BQS).
 
 master_batch_send({Syncer, Ref, Log, HandleInfo, EmitStats, Parent},
@@ -164,12 +164,11 @@ stop_syncer(Syncer, Msg) ->
     end.
 
 maybe_emit_stats(Last, I, EmitStats, Log) ->
-    Interval = time_compat:convert_time_unit(
-                 time_compat:monotonic_time() - Last, native, micro_seconds),
+    Interval = erlang:convert_time_unit(erlang:monotonic_time() - Last, native, micro_seconds),
     case Interval > ?SYNC_PROGRESS_INTERVAL of
         true  -> EmitStats({syncing, I}),
                  Log("~p messages", [I]),
-                 time_compat:monotonic_time();
+                 erlang:monotonic_time();
         false -> Last
     end.
 
diff --git a/src/rabbit_msg_store.erl b/src/rabbit_msg_store.erl
index ec828feac..f6a81bb51 100644
--- a/src/rabbit_msg_store.erl
+++ b/src/rabbit_msg_store.erl
@@ -157,7 +157,7 @@
 -type client_msstate() :: #client_msstate {
                       server             :: server(),
                       client_ref         :: client_ref(),
-                      file_handle_cache  :: ?DICT_TYPE(),
+                      file_handle_cache  :: dict:dict(),
                       index_state        :: any(),
                       index_module       :: atom(),
                       dir                :: file:filename(),
@@ -171,7 +171,7 @@
         fun ((A) -> 'finished' |
                     {rabbit_types:msg_id(), non_neg_integer(), A}).
 -type maybe_msg_id_fun() ::
-        'undefined' | fun ((?GB_SET_TYPE(), 'written' | 'ignored') -> any()).
+        'undefined' | fun ((gb_sets:set(), 'written' | 'ignored') -> any()).
 -type maybe_close_fds_fun() :: 'undefined' | fun (() -> 'ok').
 -type deletion_thunk() :: fun (() -> boolean()).
 
diff --git a/src/rabbit_password.erl b/src/rabbit_password.erl
index 02aa62d73..9b8ea150a 100644
--- a/src/rabbit_password.erl
+++ b/src/rabbit_password.erl
@@ -35,7 +35,7 @@ hash(HashingMod, Cleartext) ->
     <<SaltBin/binary, Hash/binary>>.
 
 generate_salt() ->
-    Salt = rand_compat:uniform(16#ffffffff),
+    Salt = rand:uniform(16#ffffffff),
     <<Salt:32>>.
 
 salted_hash(Salt, Cleartext) ->
diff --git a/src/rabbit_queue_consumers.erl b/src/rabbit_queue_consumers.erl
index 567a7356f..f319e4f3f 100644
--- a/src/rabbit_queue_consumers.erl
+++ b/src/rabbit_queue_consumers.erl
@@ -96,7 +96,7 @@
 
 new() -> #state{consumers = priority_queue:new(),
                 use       = {active,
-                             time_compat:monotonic_time(micro_seconds),
+                             erlang:monotonic_time(micro_seconds),
                              1.0}}.
 
 max_active_priority(#state{consumers = Consumers}) ->
@@ -346,9 +346,9 @@ drain_mode(true)  -> drain;
 drain_mode(false) -> manual.
 
 utilisation(#state{use = {active, Since, Avg}}) ->
-    use_avg(time_compat:monotonic_time(micro_seconds) - Since, 0, Avg);
+    use_avg(erlang:monotonic_time(micro_seconds) - Since, 0, Avg);
 utilisation(#state{use = {inactive, Since, Active, Avg}}) ->
-    use_avg(Active, time_compat:monotonic_time(micro_seconds) - Since, Avg).
+    use_avg(Active, erlang:monotonic_time(micro_seconds) - Since, Avg).
 
 %%----------------------------------------------------------------------------
 
@@ -455,10 +455,10 @@ update_use({inactive, _, _, _}   = CUInfo, inactive) ->
 update_use({active,   _, _}      = CUInfo,   active) ->
     CUInfo;
 update_use({active,   Since,         Avg}, inactive) ->
-    Now = time_compat:monotonic_time(micro_seconds),
+    Now = erlang:monotonic_time(micro_seconds),
     {inactive, Now, Now - Since, Avg};
 update_use({inactive, Since, Active, Avg},   active) ->
-    Now = time_compat:monotonic_time(micro_seconds),
+    Now = erlang:monotonic_time(micro_seconds),
     {active, Now, use_avg(Active, Now - Since, Avg)}.
 
 use_avg(0, 0, Avg) ->
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 5a0f76a54..5d2a9ffd8 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -224,13 +224,13 @@
 -type segment() :: ('undefined' |
                     #segment { num                :: non_neg_integer(),
                                path               :: file:filename(),
-                               journal_entries    :: ?ARRAY_TYPE(),
-                               entries_to_segment :: ?ARRAY_TYPE(),
+                               journal_entries    :: array:array(),
+                               entries_to_segment :: array:array(),
                                unacked            :: non_neg_integer()
                              }).
 -type seq_id() :: integer().
--type seg_dict() :: {?DICT_TYPE(), [segment()]}.
--type on_sync_fun() :: fun ((?GB_SET_TYPE()) -> ok).
+-type seg_dict() :: {dict:dict(), [segment()]}.
+-type on_sync_fun() :: fun ((gb_sets:set()) -> ok).
 -type qistate() :: #qistate { dir                 :: file:filename(),
                               segments            :: 'undefined' | seg_dict(),
                               journal_handle      :: hdl(),
@@ -238,8 +238,8 @@
                               max_journal_entries :: non_neg_integer(),
                               on_sync             :: on_sync_fun(),
                               on_sync_msg         :: on_sync_fun(),
-                              unconfirmed         :: ?GB_SET_TYPE(),
-                              unconfirmed_msg     :: ?GB_SET_TYPE(),
+                              unconfirmed         :: gb_sets:set(),
+                              unconfirmed_msg     :: gb_sets:set(),
                               pre_publish_cache   :: list(),
                               delivered_cache     :: list()
                             }.
@@ -653,7 +653,7 @@ recover_message(false,     _, no_del,  RelSeq, {Segment, DirtyCount}) ->
      DirtyCount + 2}.
 
 queue_name_to_dir_name(Name = #resource { kind = queue }) ->
-    <<Num:128>> = erlang:md5(term_to_binary_compat:term_to_binary_1(Name)),
+    <<Num:128>> = erlang:md5(term_to_binary(Name, [{minor_version, 1}])),
     rabbit_misc:format("~.36B", [Num]).
 
 queues_dir() ->
diff --git a/src/rabbit_queue_location_random.erl b/src/rabbit_queue_location_random.erl
index d103d3f12..83fd8cd51 100644
--- a/src/rabbit_queue_location_random.erl
+++ b/src/rabbit_queue_location_random.erl
@@ -39,6 +39,6 @@ description() ->
 
 queue_master_location(#amqqueue{} = Q) ->
     Cluster    = rabbit_queue_master_location_misc:all_nodes(Q),
-    RandomPos  = erlang:phash2(time_compat:monotonic_time(), length(Cluster)),
+    RandomPos  = erlang:phash2(erlang:monotonic_time(), length(Cluster)),
     MasterNode = lists:nth(RandomPos + 1, Cluster),
     {ok, MasterNode}.
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index a6cca9438..e3a66a912 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -371,8 +371,7 @@ start_connection(Parent, HelperSup, Deb, Sock) ->
                   capabilities       = [],
                   auth_mechanism     = none,
                   auth_state         = none,
-                  connected_at       = time_compat:os_system_time(
-                                         milli_seconds)},
+                  connected_at       = os:system_time(milli_seconds)},
                 callback            = uninitialized_callback,
                 recv_len            = 0,
                 pending_recv        = false,
@@ -671,7 +670,7 @@ maybe_block(State = #v1{connection_state = blocking,
                       throttle = update_last_blocked_by(
                                    Throttle#throttle{
                                      last_blocked_at =
-                                       time_compat:monotonic_time()})},
+                                       erlang:monotonic_time()})},
     case {blocked_by_alarm(State), blocked_by_alarm(State1)} of
         {false, true} -> ok = send_blocked(State1);
         {_,        _} -> ok
@@ -1444,9 +1443,7 @@ i(state, #v1{connection_state = ConnectionState,
         (credit_flow:blocked() %% throttled by flow now
          orelse                %% throttled by flow recently
            (WasBlockedBy =:= flow andalso T =/= never andalso
-            time_compat:convert_time_unit(time_compat:monotonic_time() - T,
-                                          native,
-                                          micro_seconds) < 5000000)) of
+            erlang:convert_time_unit(erlang:monotonic_time() - T, native, micro_seconds) < 5000000)) of
         true  -> flow;
         false -> ConnectionState
     end;
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 43bc0e78a..f1cb721d6 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -398,10 +398,10 @@
              out_counter           :: non_neg_integer(),
              in_counter            :: non_neg_integer(),
              rates                 :: rates(),
-             msgs_on_disk          :: ?GB_SET_TYPE(),
-             msg_indices_on_disk   :: ?GB_SET_TYPE(),
-             unconfirmed           :: ?GB_SET_TYPE(),
-             confirmed             :: ?GB_SET_TYPE(),
+             msgs_on_disk          :: gb_sets:set(),
+             msg_indices_on_disk   :: gb_sets:set(),
+             unconfirmed           :: gb_sets:set(),
+             confirmed             :: gb_sets:set(),
              ack_out_counter       :: non_neg_integer(),
              ack_in_counter        :: non_neg_integer(),
              disk_read_count       :: non_neg_integer(),
@@ -808,7 +808,7 @@ update_rates(State = #vqstate{ in_counter      =     InCount,
                                                ack_in    =  AckInRate,
                                                ack_out   = AckOutRate,
                                                timestamp = TS }}) ->
-    Now = time_compat:monotonic_time(),
+    Now = erlang:monotonic_time(),
 
     Rates = #rates { in        = update_rate(Now, TS,     InCount,     InRate),
                      out       = update_rate(Now, TS,    OutCount,    OutRate),
@@ -823,7 +823,7 @@ update_rates(State = #vqstate{ in_counter      =     InCount,
                    rates           = Rates }.
 
 update_rate(Now, TS, Count, Rate) ->
-    Time = time_compat:convert_time_unit(Now - TS, native, micro_seconds) /
+    Time = erlang:convert_time_unit(Now - TS, native, micro_seconds) /
         ?MICROS_PER_SECOND,
     if
         Time == 0 -> Rate;
@@ -1339,7 +1339,7 @@ init(IsDurable, IndexState, DeltaCount, DeltaBytes, Terms,
                                     transient    = 0,
                                     end_seq_id   = NextSeqId })
             end,
-    Now = time_compat:monotonic_time(),
+    Now = erlang:monotonic_time(),
     IoBatchSize = rabbit_misc:get_env(rabbit, msg_store_io_batch_size,
                                       ?IO_BATCH_SIZE),
 
diff --git a/src/term_to_binary_compat.erl b/src/term_to_binary_compat.erl
deleted file mode 100644
index b5e8f72bd..000000000
--- a/src/term_to_binary_compat.erl
+++ /dev/null
@@ -1,24 +0,0 @@
-%% The contents of this file are subject to the Mozilla Public License
-%% Version 1.1 (the "License"); you may not use this file except in
-%% compliance with the License. You may obtain a copy of the License
-%% at http://www.mozilla.org/MPL/
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and
-%% limitations under the License.
-%%
-%% The Original Code is RabbitMQ.
-%%
-%% The Initial Developer of the Original Code is GoPivotal, Inc.
-%% Copyright (c) 2017 Pivotal Software, Inc.  All rights reserved.
-%%
-
--module(term_to_binary_compat).
-
--include("rabbit.hrl").
-
--export([term_to_binary_1/1]).
-
-term_to_binary_1(Term) ->
-    term_to_binary(Term, [{minor_version, 1}]).
diff --git a/test/backing_queue_SUITE.erl b/test/backing_queue_SUITE.erl
index 441e1127a..3a60ebb0e 100644
--- a/test/backing_queue_SUITE.erl
+++ b/test/backing_queue_SUITE.erl
@@ -1224,7 +1224,7 @@ maybe_switch_queue_mode(VQ) ->
 
 random_queue_mode() ->
     Modes = [lazy, default],
-    lists:nth(rand_compat:uniform(length(Modes)), Modes).
+    lists:nth(rand:uniform(length(Modes)), Modes).
 
 pub_res({_, VQS}) ->
     VQS;
diff --git a/test/channel_operation_timeout_test_queue.erl b/test/channel_operation_timeout_test_queue.erl
index 6253910a0..1d0abd360 100644
--- a/test/channel_operation_timeout_test_queue.erl
+++ b/test/channel_operation_timeout_test_queue.erl
@@ -174,10 +174,10 @@
              out_counter           :: non_neg_integer(),
              in_counter            :: non_neg_integer(),
              rates                 :: rates(),
-             msgs_on_disk          :: ?GB_SET_TYPE(),
-             msg_indices_on_disk   :: ?GB_SET_TYPE(),
-             unconfirmed           :: ?GB_SET_TYPE(),
-             confirmed             :: ?GB_SET_TYPE(),
+             msgs_on_disk          :: gb_sets:set(),
+             msg_indices_on_disk   :: gb_sets:set(),
+             unconfirmed           :: gb_sets:set(),
+             confirmed             :: gb_sets:set(),
              ack_out_counter       :: non_neg_integer(),
              ack_in_counter        :: non_neg_integer(),
              disk_read_count       :: non_neg_integer(),
@@ -559,7 +559,7 @@ update_rates(State = #vqstate{ in_counter      =     InCount,
                                                ack_in    =  AckInRate,
                                                ack_out   = AckOutRate,
                                                timestamp = TS }}) ->
-    Now = time_compat:monotonic_time(),
+    Now = erlang:monotonic_time(),
 
     Rates = #rates { in        = update_rate(Now, TS,     InCount,     InRate),
                      out       = update_rate(Now, TS,    OutCount,    OutRate),
@@ -574,7 +574,7 @@ update_rates(State = #vqstate{ in_counter      =     InCount,
                    rates           = Rates }.
 
 update_rate(Now, TS, Count, Rate) ->
-    Time = time_compat:convert_time_unit(Now - TS, native, micro_seconds) /
+    Time = erlang:convert_time_unit(Now - TS, native, micro_seconds) /
         ?MICROS_PER_SECOND,
     if
         Time == 0 -> Rate;
@@ -1072,7 +1072,7 @@ init(IsDurable, IndexState, DeltaCount, DeltaBytes, Terms,
                                     count        = DeltaCount1,
                                     end_seq_id   = NextSeqId })
             end,
-    Now = time_compat:monotonic_time(),
+    Now = erlang:monotonic_time(),
     IoBatchSize = rabbit_misc:get_env(rabbit, msg_store_io_batch_size,
                                       ?IO_BATCH_SIZE),
 
diff --git a/test/priority_queue_SUITE.erl b/test/priority_queue_SUITE.erl
index 5e1069077..bc16032d6 100644
--- a/test/priority_queue_SUITE.erl
+++ b/test/priority_queue_SUITE.erl
@@ -595,7 +595,7 @@ publish_payload(Ch, Q, PPds) ->
     amqp_channel:wait_for_confirms(Ch).
 
 publish_many(_Ch, _Q, 0) -> ok;
-publish_many( Ch,  Q, N) -> publish1(Ch, Q, rand_compat:uniform(5)),
+publish_many( Ch,  Q, N) -> publish1(Ch, Q, rand:uniform(5)),
                             publish_many(Ch, Q, N - 1).
 
 publish1(Ch, Q, P) ->
diff --git a/test/term_to_binary_compat_prop_SUITE.erl b/test/term_to_binary_compat_prop_SUITE.erl
deleted file mode 100644
index ba5069860..000000000
--- a/test/term_to_binary_compat_prop_SUITE.erl
+++ /dev/null
@@ -1,114 +0,0 @@
-%% The contents of this file are subject to the Mozilla Public License
-%% Version 1.1 (the "License"); you may not use this file except in
-%% compliance with the License. You may obtain a copy of the License
-%% at http://www.mozilla.org/MPL/
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and
-%% limitations under the License.
-%%
-%% The Original Code is RabbitMQ.
-%%
-%% The Initial Developer of the Original Code is GoPivotal, Inc.
-%% Copyright (c) 2017 Pivotal Software, Inc.  All rights reserved.
-%%
-
-
--module(term_to_binary_compat_prop_SUITE).
-
--compile(export_all).
-
--include("rabbit.hrl").
--include_lib("common_test/include/ct.hrl").
--include_lib("proper/include/proper.hrl").
-
--define(ITERATIONS_TO_RUN_UNTIL_CONFIDENT, 10000).
-
-all() ->
-    [
-        ensure_term_to_binary_defaults_to_version_1,
-        term_to_binary_latin_atom,
-        queue_name_to_binary
-    ].
-
-erts_gt_8() ->
-    Vsn = erlang:system_info(version),
-    [Maj|_] = string:tokens(Vsn, "."),
-    list_to_integer(Maj) > 8.
-
-init_per_suite(Config) ->
-    rabbit_ct_helpers:log_environment(),
-    rabbit_ct_helpers:run_setup_steps(Config).
-
-end_per_suite(Config) ->
-    rabbit_ct_helpers:run_teardown_steps(Config).
-
-init_per_testcase(Testcase, Config) ->
-    rabbit_ct_helpers:testcase_started(Config, Testcase).
-
-%% R16B03 defaults term_to_binary version to 0, this test would always fail
-ensure_term_to_binary_defaults_to_version_1(Config) ->
-    CurrentERTS = erlang:system_info(version),
-    MinimumTestedERTS = "6.0",
-    case rabbit_misc:version_compare(CurrentERTS, MinimumTestedERTS, gte) of
-        true ->
-            Property = fun () ->
-                        prop_ensure_term_to_binary_defaults_to_version_1(Config)
-                       end,
-            rabbit_ct_proper_helpers:run_proper(
-                Property, [],
-                ?ITERATIONS_TO_RUN_UNTIL_CONFIDENT);
-        false ->
-            ct:pal(
-              ?LOW_IMPORTANCE,
-              "This test require ERTS ~p or above, running on ~p~n"
-              "Skipping test...",
-              [MinimumTestedERTS, CurrentERTS])
-    end.
-
-prop_ensure_term_to_binary_defaults_to_version_1(_Config) ->
-    ?FORALL(Term, any(),
-        begin
-            Current = term_to_binary(Term),
-            Compat = term_to_binary_compat:term_to_binary_1(Term),
-            Current =:= Compat
-        end).
-
-term_to_binary_latin_atom(Config) ->
-    Property = fun () -> prop_term_to_binary_latin_atom(Config) end,
-    rabbit_ct_proper_helpers:run_proper(Property, [],
-                                        ?ITERATIONS_TO_RUN_UNTIL_CONFIDENT).
-
-prop_term_to_binary_latin_atom(_Config) ->
-    ?FORALL(LatinString, list(integer(0, 255)),
-        begin
-            Length = length(LatinString),
-            Atom = list_to_atom(LatinString),
-            Binary = list_to_binary(LatinString),
-            <<131,100, Length:16, Binary/binary>> =:=
-                term_to_binary_compat:term_to_binary_1(Atom)
-        end).
-
-queue_name_to_binary(Config) ->
-    Property = fun () -> prop_queue_name_to_binary(Config) end,
-    rabbit_ct_proper_helpers:run_proper(Property, [],
-                                        ?ITERATIONS_TO_RUN_UNTIL_CONFIDENT).
-
-
-prop_queue_name_to_binary(_Config) ->
-    ?FORALL({VHost, QName}, {binary(), binary()},
-            begin
-                VHostBSize = byte_size(VHost),
-                NameBSize = byte_size(QName),
-                Expected =
-                    <<131,                               %% Binary format "version"
-                      104, 4,                            %% 4-element tuple
-                      100, 0, 8, "resource",             %% `resource` atom
-                      109, VHostBSize:32, VHost/binary,  %% Vhost binary
-                      100, 0, 5, "queue",                %% `queue` atom
-                      109, NameBSize:32, QName/binary>>, %% Name binary
-                Resource = rabbit_misc:r(VHost, queue, QName),
-                Current = term_to_binary_compat:term_to_binary_1(Resource),
-                Current =:= Expected
-            end).
-- 
2.16.4