Skip to content

Conversation

@vivek8420
Copy link
Collaborator

@vivek8420 vivek8420 commented Aug 18, 2025

Issues

Test case verifying the fix for the Venice production incident where missing virtual topology configuration led to disproportionate partition assignment in CRUSH rebalancer.

Background: Venice HAR cluster with topology /mz_virtualZone/host/applicationInstanceId
had one instance join with missing mz_virtualZone key, causing it to receive 3.26x more partitions than expected (2,166 vs 664) due to becoming a singleton fault zone.

Description

Instances missing required fault zone configuration are now excluded from rebalancing instead of creating singleton fault zones, preventing partition imbalance.

PR for fix: https://github.com/linkedin/helix/pull/40/files

Tests

  • The following tests are written for this issue:

(List the names of added unit/integration tests)

  1. testMissingVirtualConfig_whenRequiredInstanceTopologyKeysNotPresent_TopologyOverAllocationToBadInstance : Test the original problem: missing virtual topology configuration leads to over-allocation. This demonstrates a bad instance received ~2x more partitions.
  2. testMissingVirtualConfig_whenRequiredInstanceTopologyKeysIsPresent_BadInstanceExcludedFromRebalancing :
    Test the fixed behavior: missing virtual topology configuration leads to instance exclusion. This demonstrates the fix where bad instances are excluded from rebalancing.
  • The following is the result of the "mvn test" command on the appropriate module:

(If CI test fails due to known issue, please specify the issue and test PR locally. Then copy & paste the result of "mvn test" to here.)

Changes that Break Backward Compatibility (Optional)

  • My PR contains changes that break backward compatibility or previous assumptions for certain methods or API. They include:

(Consider including all behavior changes for public methods or API. Also include these changes in merge description so that other developers are aware of these changes. This allows them to make relevant code changes in feature branches accounting for the new method/API behavior.)

Documentation (Optional)

  • In case of new functionality, my PR adds documentation in the following wiki page:

(Link the GitHub wiki you added)

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml
    (helix-style-intellij.xml if IntelliJ IDE is used)

@vivek8420 vivek8420 changed the title Fixed the bug if virtual topology zone config not present then exclude that instance from selection Adding the Tests for fix if virtual topology zone config not present then exclude that instance from selection Aug 19, 2025
@vivek8420 vivek8420 changed the title Adding the Tests for fix if virtual topology zone config not present then exclude that instance from selection Added tests validating fix for instances with incomplete virtual topology configuration causing partition imbalance Aug 19, 2025
* This demonstrates a bad instance received ~3x more partitions.
*/
@Test
public void testMissingVirtualConfig_whenRequiredInstanceTopologyKeysNotPresent_TopologyOverAllocationToBadInstance() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

too long method name, please use a shorter one. Also, don't mix camelCase and underscores.

public class TestCrushRebalanceMissingVirtualTopology extends ZkTestBase {

private final String className = getShortClassName();
private String clusterName;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit : I see helix uses _ standard to define class level variable. Not a standard used in java(more of python standard), but since this is used across the repo(could be used initially to easily differentiate between class vs local) so lets continue this.

_gSetupTool.addInstanceToCluster(clusterName, badInstanceName);

// Get the existing config and modify it
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can initialised configAccessor once in @beforeMethod, I see it being initialized multiple times.

setupClusterWithoutRequiredInstanceTopologyKeys();

// Add resource with CRUSH rebalancer strategy
_gSetupTool.addResourceToCluster(clusterName, DB_NAME, PARTITIONS,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Extract it to helper method to reuse across tests.

private ClusterControllerManager controller;
private List<MockParticipantManager> participants = new ArrayList<>();
private List<String> nodes = new ArrayList<>();
private Set<String> allDBs = new HashSet<>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This need not be defined at class level, I see it being used locally


/**
* Test the original problem: missing virtual topology configuration leads to over-allocation.
* This demonstrates a bad instance received ~3x more partitions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This test will start failing once the change for not allowing the bad participant to join the cluster. I believe these tests won't be required then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants