Skip to content

Conversation

@Russole
Copy link
Contributor

@Russole Russole commented Jan 8, 2026

What changes were proposed in this pull request?

  • Fix inconsistent default handling for OZONE_DATANODE_PIPELINE_LIMIT
  • Use conf.getInt(..., DEFAULT) instead of falling back to 0 when the config is unset
  • Ensure the behavior matches OZONE_DATANODE_PIPELINE_LIMIT_DEFAULT (default = 2)

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14369

How was this patch tested?

All CI checks passed.
https://github.com/Russole/ozone/actions/runs/20823196572

Copy link
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

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

Thanks @Russole for working on the patch.
There are two more classes where OZONE_DATANODE_PIPELINE_LIMIT_DEFAULT value should be used instead of 0.
SCMNodeManager : https://github.com/Gargi-jais11/ozone/blob/64bb019407bc001fbe2c6339141908c3e7d59b8f/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/node/SCMNodeManager.java#L198-L199
PipelinePlacementPolicy : https://github.com/Gargi-jais11/ozone/blob/64bb019407bc001fbe2c6339141908c3e7d59b8f/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelinePlacementPolicy.java#L79-L80

Each layer needs the correct default value because they all independently read the configuration and use it in different ways. Fixing only one would leave inconsistencies in the others, causing incorrect behavior.

@Gargi-jais11
Copy link
Contributor

It is also good if you add test cases for this part in TestPipelinePlacementPolicy, TestRatisPipelineProvider and TestSCMNodeManager.
1. RatisPipelineProvider

Test flow:
- Creates config without setting pipeline limit
- Creates pipelines up to expected limit (6 pipelines with 10 nodes)
- Verifies 7th pipeline creation throws SCMException
- Validates error message mentions default limit of 2

Coverage:
- Default value (2) used instead of 0 
- Pipeline limit enforcement works 
- Error messages accurate 

2. PipelinePlacementPolicy

Test flow:
- Creates policy with config without limit set
- Adds exactly 2 pipelines to test node (default limit)
- Verifies node is filtered out when choosing nodes for new pipeline

3. SCMNodeManager

Test flow:
- Creates node manager with config without limit set
- Registers datanode with healthy volumes
- Calls pipelineLimit() and verifies returns 2

@Russole
Copy link
Contributor Author

Russole commented Jan 10, 2026

Thanks @Gargi-jais11 for the reviews. I’ve addressed the comments and updated the patch accordingly.

@Russole Russole requested a review from Gargi-jais11 January 10, 2026 03:09
Copy link
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

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

Thank @Russole for updating the patch. Please fine some more comments inlined.

Comment on lines 2075 to 2077
int limit = nodeManager.pipelineLimit(dn);
assertEquals(ScmConfigKeys.OZONE_DATANODE_PIPELINE_LIMIT_DEFAULT, limit);
assertEquals(2, limit);
Copy link
Contributor

Choose a reason for hiding this comment

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

This assertion is redundant. The first assertion itself is enough to check that it picks the default value.

// Registers datanode with healthy volumes
DatanodeDetails dn = registerWithCapacity(nodeManager);

// Calls pipelineLimit() and verifies returns 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Calls pipelineLimit() and verifies returns 2
// Calls pipelineLimit() and verifies returns default value

* Test that pipelineLimit() uses the default value when the config is not set.
*/
@Test
public void testPipelineLimitDefaultIsTwoWhenUnset()
Copy link
Contributor

Choose a reason for hiding this comment

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

rename it as something more generic:testUsesDefaultPipelineLimitWhenUnset()

@Gargi-jais11
Copy link
Contributor

@szetszwo Please review this patch.

@jojochuang jojochuang requested a review from szetszwo January 12, 2026 17:27
Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

@Russole , thanks for working on this! The change looks good. Just have some comments on the existing names.

ScmConfigKeys.OZONE_SCM_PIPELINE_PER_METADATA_VOLUME_DEFAULT);
String dnLimit = conf.get(ScmConfigKeys.OZONE_DATANODE_PIPELINE_LIMIT);
this.heavyNodeCriteria = dnLimit == null ? 0 : Integer.parseInt(dnLimit);
this.heavyNodeCriteria = conf.getInt(
Copy link
Contributor

Choose a reason for hiding this comment

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

The existing field name heavyNodeCriteria is quite creative but unclear what does it mean. Could you rename it to datanodePipelineLimit?

String dnLimit = conf.get(ScmConfigKeys.OZONE_DATANODE_PIPELINE_LIMIT);
this.maxPipelinePerDatanode = dnLimit == null ? 0 :
Integer.parseInt(dnLimit);
this.maxPipelinePerDatanode = conf.getInt(
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's also rename it to datanodePipelineLimit. So it is easier to tell that they are the same thing.

@jojochuang
Copy link
Contributor

This issue is related to #9580

@Russole
Copy link
Contributor Author

Russole commented Jan 12, 2026

Thanks @szetszwo and @jojochuang for the review. I’ve updated the implementation based on the comments.

this.stateManager = stateManager;
String dnLimit = conf.get(ScmConfigKeys.OZONE_DATANODE_PIPELINE_LIMIT);
this.heavyNodeCriteria = dnLimit == null ? 0 : Integer.parseInt(dnLimit);
this.heavyNodeCriteria = conf.getInt(
Copy link
Contributor

Choose a reason for hiding this comment

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

@Russole , there is one more field to rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder.

Copy link
Contributor

@szetszwo szetszwo left a comment

Choose a reason for hiding this comment

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

+1 the change looks good

Copy link
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

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

LGTM

@szetszwo szetszwo merged commit ef4bb7f into apache:master Jan 13, 2026
44 checks passed
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.

4 participants