Merge pull request #9663 from zmstone/0102-fix-stopped-nodes-detection

0102 fix stopped nodes detection
This commit is contained in:
Zaiming (Stone) Shi 2023-01-08 10:03:48 +01:00 committed by GitHub
commit 5653d113ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 7 deletions

View File

@ -512,7 +512,7 @@ do_alarm(Fun, Res, #{tnx_id := Id} = Meta) ->
wait_for_all_nodes_commit(TnxId, Delay, Remain) ->
Lagging = lagging_nodes(TnxId),
Stopped = stopped_nodes(),
Stopped = Lagging -- mria_mnesia:running_nodes(),
case Lagging -- Stopped of
[] when Stopped =:= [] ->
ok;
@ -537,9 +537,10 @@ wait_for_nodes_commit(RequiredSyncs, TnxId, Delay, Remain) ->
[] ->
ok;
Lagging ->
case stopped_nodes() of
Stopped = Lagging -- mria_mnesia:running_nodes(),
case Stopped of
[] -> {peers_lagging, Lagging};
Stopped -> {stopped_nodes, Stopped}
_ -> {stopped_nodes, Stopped}
end
end
end.
@ -558,9 +559,6 @@ commit_status_trans(Operator, TnxId) ->
Result = '$2',
mnesia:select(?CLUSTER_COMMIT, [{MatchHead, [Guard], [Result]}]).
stopped_nodes() ->
ekka_cluster:info(stopped_nodes).
get_retry_ms() ->
emqx_conf:get([node, cluster_call, retry_interval], timer:minutes(1)).

View File

@ -1,6 +1,6 @@
{application, emqx_conf, [
{description, "EMQX configuration management"},
{vsn, "0.1.8"},
{vsn, "0.1.9"},
{registered, []},
{mod, {emqx_conf_app, []}},
{applications, [kernel, stdlib]},

View File

@ -48,11 +48,14 @@ init_per_suite(Config) ->
meck:new(emqx_alarm, [non_strict, passthrough, no_link]),
meck:expect(emqx_alarm, activate, 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.
end_per_suite(_Config) ->
ekka:stop(),
mria:stop(),
meck:unload(mria_mnesia),
mria_mnesia:delete_schema(),
meck:unload(emqx_alarm),
ok.