Skip to content

HDDS-17113. SCM to prefer a Ratis pipeline on the writer's datanode when allocating blocks - #11617

Draft
smengcl wants to merge 4 commits into
apache:masterfrom
smengcl:HDDS-17113
Draft

smengcl wants to merge 4 commits into
apache:masterfrom
smengcl:HDDS-17113

Conversation

@smengcl

@smengcl smengcl commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

When a client runs on a datanode host (for example an HBase RegionServer colocated with a datanode), SCM picks a Ratis pipeline for a new block without looking at where the client is, so often no replica is local to the writer. HDFS writes the first replica on the writer's datanode, which later lets reads of that data (such as HBase compactions) use short circuit reads.

This change adds hdds.scm.block.allocation.prefer.client.local (default false). When it is set:

  • OM passes the client address to SCM on every block allocation, even when OM sorts the datanodes itself.
  • SCM first tries open Ratis pipelines led by the client's datanode, then other open pipelines that contain it, and falls back to the pipeline choose policy when none of those has a usable container. A pipeline led by the client's datanode also keeps the client to leader hop of each write on the same host (see HDDS-11000).

EC allocation and the default behavior are unchanged.

What is the link to the Apache JIRA

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

How was this patch tested?

  • New unit tests in TestWritableRatisContainerProvider (prefers a pipeline led by the client, then one containing it, and falls back when the local pipeline has no container or the client is in no pipeline) and in TestOMAllocateBlockRequest (OM sends the client address to SCM when the flag is set).
  • Existing TestSCMBlockProtocolServer, TestBlockManager, TestOMKeyCreateRequest and TestOMFileCreateRequest pass.
  • On a 6 datanode docker compose cluster with the flag set, each writer running on a datanode that leads a pipeline got blocks on that pipeline. hsync latency differences between local leader, local follower and remote writers were within noise there, since all containers share one host. A real network A/B is still needed to measure the latency effect.

🤖 Generated with Claude Code

smengcl and others added 3 commits October 18, 2026 13:55
…g Ratis blocks

Add hdds.scm.block.allocation.prefer.client.local (default false). When set,
OM passes the client address to SCM on every block allocation and SCM tries
open pipelines that contain the client's datanode before the pipeline choose
policy, like the HDFS writer-local first replica.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…er local pipelines

Ratis writes go through the leader, so a pipeline led by the writer's datanode keeps the
client-to-leader hop on the same host.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… client local is set

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 18, 2026 20:55
@smengcl smengcl self-assigned this Oct 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment on lines +105 to +114
@Config(key = "hdds.scm.block.allocation.prefer.client.local",
type = ConfigType.BOOLEAN,
defaultValue = "false",
tags = { ConfigTag.SCM, ConfigTag.PIPELINE, ConfigTag.PERFORMANCE },
description = "If true, when allocating a Ratis block for a client that runs on a datanode host, SCM prefers "
+ "an open pipeline that contains that datanode, so one replica is local to the writer (like the HDFS "
+ "first replica). Falls back to the pipeline choose policy when no such pipeline has a usable container. "
+ "OM reads the same key to pass the client address to SCM on every block allocation."
)
private boolean preferClientLocalPipeline;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Open question to reviewers: Should this be made the default?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants