Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly filter out non-primary exchanges #1752

Open
wants to merge 1 commit into
base: develop-3.0
Choose a base branch
from
Open
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: 1 addition & 5 deletions src/riak_kv_entropy_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -956,11 +956,7 @@ add_index_exchanges(Index, State) ->
-spec prune_exchanges([exchange()])
-> [exchange()].
prune_exchanges(Exchanges) ->
L = [if A < B ->
{A, B, IndexN};
true ->
{B, A, IndexN}
end || {A, B, IndexN} <- Exchanges],
L = [Exchange || {A, B, _IndexN} = Exchange <- Exchanges, A < B],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a hard time to see that in all cases in which prune_exchages is used, this will give the desired result. The original returns all tripples {A, B, I} and ensures that A =< B for all of them. Your solution just removes all {A, B, I} if A >= B.
Apparently you want this, because that's what the commit comment states. But how is function used by the rest of riak?

lists:usort(L).

-spec already_exchanging(index() ,state()) -> boolean().
Expand Down