Skip to content
This repository was archived by the owner on Nov 17, 2020. It is now read-only.

fix supervisor2's state for get {badrecord,state} error when release upgrade #230

Merged
merged 1 commit into from
Oct 15, 2017
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
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ ifeq ($(call compare_version,$(ERTS_VER),$(tls_atom_version_MAX_ERTS_VER),<),tru
RMQ_ERLC_OPTS += -Ddefine_tls_atom_version
endif

# supervisor's state change from erts-7.0(18)
new_sup2_state_MAX_ERTS_VER = 7.0
ifeq ($(call compare_version,$(ERTS_VER),$(new_sup2_state_MAX_ERTS_VER),>),true)
RMQ_ERLC_OPTS += -Ddefine_new_sup2_state
endif

# For src/*_compat.erl modules, we don't want to set -Werror because for
# instance, warnings about removed functions (e.g. ssl:connection_info/1
# in Erlang 20) can't be turned off.
Expand Down
13 changes: 13 additions & 0 deletions src/supervisor2.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@

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

-ifndef(define_new_sup2_state).
-record(state, {name,
strategy :: strategy(),
children = [] :: [child_rec()],
Expand All @@ -127,6 +128,18 @@
restarts = [],
module,
args}).
-else.
-record(state, {name,
strategy :: strategy(),
children = [] :: [child_rec()],
dynamics :: ?DICT_TYPE() | ?SET_TYPE(),
intensity :: non_neg_integer(),
period :: pos_integer(),
restarts = [],
dynamic_restarts = 0 :: non_neg_integer(),
module,
args}).
-endif.
-type state() :: #state{}.

-define(is_simple(State), State#state.strategy =:= simple_one_for_one).
Expand Down