Skip to content

Add CompletionStage variants to ClusterAdminClient as an alternative to ActionListener#20509

Open
cwperks wants to merge 4 commits intoopensearch-project:mainfrom
cwperks:indices-admin-async
Open

Add CompletionStage variants to ClusterAdminClient as an alternative to ActionListener#20509
cwperks wants to merge 4 commits intoopensearch-project:mainfrom
cwperks:indices-admin-async

Conversation

@cwperks
Copy link
Copy Markdown
Member

@cwperks cwperks commented Jan 30, 2026

Description

Similar to #19161 and #18998 this PR applies the same concept to ClusterAdminClient.

One of my eventual goals is to deprecate and remove anything from these interfaces that returns an ActionFuture to discourage any usage of blocking actions. Even though these signatures are primarily used in tests, I don't think they should be part of the interfaces.

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…to ActionListener

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks requested review from a team and peternied as code owners January 30, 2026 15:02
@cwperks cwperks changed the title Indices admin async Add CompletionStage variants to ClusterAdminClient as an alternative to ActionListener Jan 30, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 30, 2026

No actionable comments were generated in the recent review. 🎉

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 07e455c and 22550b1.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

📝 Walkthrough

Walkthrough

Adds CompletionStage-returning async helper methods to ClusterAdminClient that wrap existing ActionListener-based calls using CompletableFuture, updates a test to use the new stateAsync API, and adds an Unreleased changelog entry documenting the additions.

Changes

Cohort / File(s) Summary
Changelog
CHANGELOG.md
Added Unreleased 3.x entry documenting CompletionStage variants for ClusterAdminClient (PR reference).
Cluster admin async API
server/src/main/java/org/opensearch/transport/client/ClusterAdminClient.java
Added many public default methods (CompletionStage-returning) for cluster operations (health, state, settings, reroute, nodes info/stats/usage/hotthreads, cluster stats, tasks, search shards, repositories, snapshots, pipelines, stored scripts, dangling indices, weighted routing, decommissioning, search pipelines). Each method creates a CompletableFuture and delegates to existing APIs via ActionListener.wrap. New imports for CompletableFuture and CompletionStage. Review attention: concurrency/exception propagation and API contract consistency.
Test update
server/src/test/java/org/opensearch/ratelimitting/admissioncontrol/AdmissionControlSingleNodeTests.java
Replaced use of ActionFuture for cluster state with stateAsync(...).toCompletableFuture().join() and added null-checks; removed unused imports. Verify test timing/exception behavior changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding CompletionStage variants to ClusterAdminClient as an alternative to ActionListener.
Description check ✅ Passed The description includes context about related PRs, explains the intent to modernize the API, and covers most checklist items, though testing and documentation boxes remain unchecked.
Docstring Coverage ✅ Passed Docstring coverage is 92.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 07e455c: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Copy Markdown
Contributor

✅ Gradle check result for 07e455c: SUCCESS

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 30, 2026

Codecov Report

❌ Patch coverage is 2.22222% with 132 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.27%. Comparing base (93ae8db) to head (22550b1).
⚠️ Report is 145 commits behind head on main.

Files with missing lines Patch % Lines
...pensearch/transport/client/ClusterAdminClient.java 2.22% 132 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20509      +/-   ##
============================================
- Coverage     73.33%   73.27%   -0.06%     
- Complexity    72125    72144      +19     
============================================
  Files          5798     5799       +1     
  Lines        329654   329858     +204     
  Branches      47491    47518      +27     
============================================
- Hits         241741   241715      -26     
- Misses        68504    68778     +274     
+ Partials      19409    19365      -44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 4, 2026

✅ Gradle check result for 22550b1: SUCCESS

@peterzhuamazon
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 19, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@opensearch-trigger-bot
Copy link
Copy Markdown
Contributor

This PR is stalled because it has been open for 30 days with no activity.

@opensearch-trigger-bot opensearch-trigger-bot bot added stalled Issues that have stalled and removed stalled Issues that have stalled labels Mar 23, 2026
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.

2 participants