apache / apache/druid

Wrong order in BalancerStrategy.pickServersToDrop()

Open
#7,128 0 comments 0 reactions 0 assignees View on GitHub
Area - Segment Balancing/Coordination Bug
Dominant language
Java
Stars
14.1k
Forks
3.8k
Avg merge
2d 58m
Merged PRs (30d)
233

Description

`ServerHolder` are sorted by *available* space, so `NavigableSet` (unless uses `Comparator.reverseOrder()`) have ServerHolders with the *most* available space in the end. Therefore `set.descendingIterator()` suggests to drop segment from least utilized servers first, that's the opposite of what should be done.

However, I think that this default implementation should just be removed because `BalancerStrategy` is not annotated `@ExtensionPoint` and all production implementations of `BalancerStrategy` override this method. Then the signature should be simplified too, accepting any `Collection` rather than only `NavigableSet`.

FYI @clintropolis

Contributor guide

Open the contributing guide

Research direction

Start at BalancerStrategy.pickServersToDrop() and inspect how its NavigableSet ordering and descendingIterator() select servers. Review all production implementations that override the method and determine the impact of changing the parameter to Collection. Done means the incorrect default behavior is removed and the affected implementations and callers remain consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.