HDDS-15969. Prioritize Ratis Streaming capable DataNodes during Pipeline creation with graceful fallback - #10865
HDDS-15969. Prioritize Ratis Streaming capable DataNodes during Pipeline creation with graceful fallback#10865chungen0126 wants to merge 10 commits into
Conversation
…ine creation with graceful fallback
|
@yandrey321 PTAL |
szetszwo
left a comment
There was a problem hiding this comment.
@chungen0126 , thanks for working on this! Please see if the suggested change would work.
|
This is fine. A little rewrite can make the code more self explanatory. The pipeline choosing algorithm could end up becoming too complex to maintain. and then: |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Implements a two-phase datanode selection strategy for 3-way Ratis pipelines to prefer RATIS_DATASTREAM-capable nodes and gracefully fall back to standard selection when streaming-capable nodes are insufficient.
Changes:
- Add strict-then-fallback node selection in
RatisPipelineProviderfor factor THREE pipelines based on RATIS_DATASTREAM port presence. - Refactor node exclusion filtering to support optional RATIS_DATASTREAM capability filtering.
- Add unit tests to validate prioritization and fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java | Adds two-phase placement logic and refactors exclusion filtering to optionally require RATIS_DATASTREAM. |
| hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestRatisPipelineProvider.java | Adds tests and test utilities to verify streaming-capable prioritization and fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| List<DatanodeDetails> excludeDueToEngagement = filterNodes(true); | ||
| List<DatanodeDetails> currentExcluded = new ArrayList<>(excludedNodes); | ||
| currentExcluded.addAll(excludeDueToEngagement); | ||
| try { | ||
| dns = placementPolicy.chooseDatanodes(currentExcluded, | ||
| favoredNodes, factor.getNumber(), minRatisVolumeSizeBytes, | ||
| containerSizeBytes); | ||
| } catch (SCMException scmException) { | ||
| excludeDueToEngagement = filterNodes(false); | ||
| currentExcluded = new ArrayList<>(excludedNodes); | ||
| currentExcluded.addAll(excludeDueToEngagement); | ||
| dns = placementPolicy.chooseDatanodes(currentExcluded, | ||
| favoredNodes, factor.getNumber(), minRatisVolumeSizeBytes, | ||
| containerSizeBytes); |
| /** | ||
| * | ||
| * @return | ||
| */ | ||
| private List<DatanodeDetails> filterNodes(boolean filterRatisStreaming) { |
| } else { | ||
| excludedNodes.addAll(excludeDueToEngagement); | ||
| } | ||
| List<DatanodeDetails> excludeDueToEngagement = filterNodes(true); |
| private DatanodeDetails createDatanodeDetails(boolean supportRatisStreaming) { | ||
| Random random = ThreadLocalRandom.current(); | ||
| String ipAddress = random.nextInt(256) | ||
| + "." + random.nextInt(256) | ||
| + "." + random.nextInt(256) | ||
| + "." + random.nextInt(256); |
What changes were proposed in this pull request?
During rolling upgrades or in heterogeneous clusters, random node selection makes forming a 100% Ratis Streaming pipeline rare (e.g., (1/2)^3 = 12.5% chance when 50% nodes support it), leading to frequent client fallbacks.
To maximize streaming pipeline creation without sacrificing availability, we introduce a two-phase node selection strategy for THREE-factor pipelines:
This prioritizes Ratis Streaming nodes when available while ensuring full cluster fallback resilience.
Key Implementation Details:
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15969
How was this patch tested?
Added new unit tests in TestRatisPipelineProvider:
ci: https://github.com/chungen0126/ozone/actions/runs/30141420657