Merge pull request #9663 from zmstone/0102-fix-stopped-nodes-detection
0102 fix stopped nodes detection
This commit is contained in:
commit
5653d113ac
|
@ -512,7 +512,7 @@ do_alarm(Fun, Res, #{tnx_id := Id} = Meta) ->
|
||||||
|
|
||||||
wait_for_all_nodes_commit(TnxId, Delay, Remain) ->
|
wait_for_all_nodes_commit(TnxId, Delay, Remain) ->
|
||||||
Lagging = lagging_nodes(TnxId),
|
Lagging = lagging_nodes(TnxId),
|
||||||
Stopped = stopped_nodes(),
|
Stopped = Lagging -- mria_mnesia:running_nodes(),
|
||||||
case Lagging -- Stopped of
|
case Lagging -- Stopped of
|
||||||
[] when Stopped =:= [] ->
|
[] when Stopped =:= [] ->
|
||||||
ok;
|
ok;
|
||||||
|
@ -537,9 +537,10 @@ wait_for_nodes_commit(RequiredSyncs, TnxId, Delay, Remain) ->
|
||||||
[] ->
|
[] ->
|
||||||
ok;
|
ok;
|
||||||
Lagging ->
|
Lagging ->
|
||||||
case stopped_nodes() of
|
Stopped = Lagging -- mria_mnesia:running_nodes(),
|
||||||
|
case Stopped of
|
||||||
[] -> {peers_lagging, Lagging};
|
[] -> {peers_lagging, Lagging};
|
||||||
Stopped -> {stopped_nodes, Stopped}
|
_ -> {stopped_nodes, Stopped}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -558,9 +559,6 @@ commit_status_trans(Operator, TnxId) ->
|
||||||
Result = '$2',
|
Result = '$2',
|
||||||
mnesia:select(?CLUSTER_COMMIT, [{MatchHead, [Guard], [Result]}]).
|
mnesia:select(?CLUSTER_COMMIT, [{MatchHead, [Guard], [Result]}]).
|
||||||
|
|
||||||
stopped_nodes() ->
|
|
||||||
ekka_cluster:info(stopped_nodes).
|
|
||||||
|
|
||||||
get_retry_ms() ->
|
get_retry_ms() ->
|
||||||
emqx_conf:get([node, cluster_call, retry_interval], timer:minutes(1)).
|
emqx_conf:get([node, cluster_call, retry_interval], timer:minutes(1)).
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_conf, [
|
{application, emqx_conf, [
|
||||||
{description, "EMQX configuration management"},
|
{description, "EMQX configuration management"},
|
||||||
{vsn, "0.1.8"},
|
{vsn, "0.1.9"},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{mod, {emqx_conf_app, []}},
|
{mod, {emqx_conf_app, []}},
|
||||||
{applications, [kernel, stdlib]},
|
{applications, [kernel, stdlib]},
|
||||||
|
|
|
@ -48,11 +48,14 @@ init_per_suite(Config) ->
|
||||||
meck:new(emqx_alarm, [non_strict, passthrough, no_link]),
|
meck:new(emqx_alarm, [non_strict, passthrough, no_link]),
|
||||||
meck:expect(emqx_alarm, activate, 3, ok),
|
meck:expect(emqx_alarm, activate, 3, ok),
|
||||||
meck:expect(emqx_alarm, deactivate, 3, ok),
|
meck:expect(emqx_alarm, deactivate, 3, ok),
|
||||||
|
meck:new(mria_mnesia, [non_strict, passthrough, no_link]),
|
||||||
|
meck:expect(mria_mnesia, running_nodes, 0, [?NODE1, {node(), ?NODE2}, {node(), ?NODE3}]),
|
||||||
Config.
|
Config.
|
||||||
|
|
||||||
end_per_suite(_Config) ->
|
end_per_suite(_Config) ->
|
||||||
ekka:stop(),
|
ekka:stop(),
|
||||||
mria:stop(),
|
mria:stop(),
|
||||||
|
meck:unload(mria_mnesia),
|
||||||
mria_mnesia:delete_schema(),
|
mria_mnesia:delete_schema(),
|
||||||
meck:unload(emqx_alarm),
|
meck:unload(emqx_alarm),
|
||||||
ok.
|
ok.
|
||||||
|
|
Loading…
Reference in New Issue