Skip to content

HBASE-30247 Validate negative client timeout configuration#8458

Open
velpro-8620 wants to merge 1 commit into
apache:masterfrom
velpro-8620:HBASE-30247
Open

HBASE-30247 Validate negative client timeout configuration#8458
velpro-8620 wants to merge 1 commit into
apache:masterfrom
velpro-8620:HBASE-30247

Conversation

@velpro-8620

Copy link
Copy Markdown

What changes were proposed in this pull request?

This change validates negative client timeout configuration values when constructing
ConnectionConfiguration.

Invalid values such as hbase.rpc.timeout=-1 now fail early with
IllegalArgumentException instead of later failing during batch Put in
AsyncProcess.

Why are the changes needed?

HBASE-30247 reports that a negative hbase.rpc.timeout is accepted during client
configuration and only fails later at runtime during batch operations.

Failing fast makes the configuration error easier to diagnose and prevents the
surprising runtime exception path.

How was this patch tested?

mvn -pl hbase-client -am -DskipITs -Dtest=TestConnectionConfiguration test

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds fail-fast validation for negative client timeout configuration values during ConnectionConfiguration construction in hbase-client, preventing later runtime failures (e.g., during batch operations in AsyncProcess) and improving diagnosability of misconfiguration.

Changes:

  • Introduces a helper to reject negative timeout values (throws IllegalArgumentException with the offending key/value).
  • Applies non-negative validation to multiple client timeout-related configuration keys when building ConnectionConfiguration.
  • Adds unit tests asserting negative values are rejected and zero values remain allowed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
hbase-client/src/main/java/org/apache/hadoop/hbase/client/ConnectionConfiguration.java Adds non-negative validation for client timeout configs during connection configuration construction.
hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestConnectionConfiguration.java Adds tests to verify negative timeout values fail fast and zero values are accepted.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +120 to +121
this.replicaCallTimeoutMicroSecondScan = getNonNegativeInt(conf, PRIMARY_SCAN_TIMEOUT_MICROSECOND,
PRIMARY_SCAN_TIMEOUT_MICROSECOND_DEFAULT);
Comment on lines +53 to +58
List<String> timeoutKeys = Arrays.asList(HConstants.HBASE_CLIENT_META_OPERATION_TIMEOUT,
HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, ConnectionConfiguration.PRIMARY_CALL_TIMEOUT_MICROSECOND,
ConnectionConfiguration.PRIMARY_SCAN_TIMEOUT_MICROSECOND,
HConstants.HBASE_CLIENT_META_REPLICA_SCAN_TIMEOUT, HConstants.HBASE_RPC_TIMEOUT_KEY,
HConstants.HBASE_RPC_READ_TIMEOUT_KEY, ConnectionConfiguration.HBASE_CLIENT_META_READ_RPC_TIMEOUT_KEY,
HConstants.HBASE_RPC_WRITE_TIMEOUT_KEY);
@guluo2016

Copy link
Copy Markdown
Member

Please run mvn spotless:apply to fix the style issues, thanks

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