fix(dsrepl): apply unnecessary rebalancing transitions cleanly

This commit is contained in:
Andrew Mayorov 2024-04-08 13:25:45 +02:00
parent dcde30c38a
commit 4c0cc079c2
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 6 additions and 2 deletions

View File

@ -481,15 +481,19 @@ modify_db_sites_trans(DB, Modifications) ->
case Sites of
Sites0 ->
ok;
_Chagned ->
_Changed ->
assign_db_sites_trans(DB, Sites)
end.
update_replica_set_trans(DB, Shard, Trans) ->
case mnesia:read(?SHARD_TAB, {DB, Shard}, write) of
[Record = #?SHARD_TAB{replica_set = ReplicaSet0, target_set = TargetSet0}] ->
%% NOTE
%% It's possible to complete a transition that's no longer planned. We
%% should anticipate that we may stray _away_ from the target set.
TargetSet1 = emqx_maybe:define(TargetSet0, ReplicaSet0),
ReplicaSet = apply_transition(Trans, ReplicaSet0),
case lists:usort(TargetSet0) of
case lists:usort(TargetSet1) of
ReplicaSet ->
TargetSet = undefined;
TS ->