apache / apache/helix

Preserve input instance order for zone_based stoppable check

Open
#3,028 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
504
Forks
255
Avg merge
17d 47m
Merged PRs (30d)
2

Description

Currently, `getZoneBasedInstances()` which zone_based check calls internally uses a TreeSet, which leads to lexicographical sorting of instances during the stoppable check. This behavior results in the output instance order being different from the input list, even when multiple instances are equally stoppable.

This issue proposes to make the ordering deterministic based on user input, by introducing a new boolean parameter `preserveOrder` to facilitate preserving order for zone based checks and relevant REST API changes.

When `preserveOrder` is set to `true`, the original order of the input list will be preserved.

Default behavior (`preserveOrder = false`) will maintain backward compatibility for OSS users who may rely on the current output order.

This change aims to improve predictability in testing and usage scenarios where instance order matters. We'll ensure this behavior is clearly documented to avoid incorrect assumptions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.