Skip to content

Conversation

@batcity
Copy link

@batcity batcity commented Jan 21, 2026

Description

removed references to cluster state from ConcreteIndices object

Related Issues

Partially Resolves 20085

How did I test my fix:

I started opensearch locally and I ran the following script:

for i in $(seq 1 4); do
  echo "Iteration $i"

  # Start bulk asynchronously
  curl -s -XPOST localhost:9200/_bulk \
    -H "Content-Type: application/x-ndjson" \
    --data-binary @bulk.json &

  # Force a cluster state update
  curl -s -XPUT localhost:9200/churn_index_$i \
    -H "Content-Type: application/json" \
    -d '{
      "settings": {
        "number_of_shards": 1,
        "number_of_replicas": 0
      }
    }' >/dev/null
done

Before my changes you can see that the ConcreteIndices object references clusterState:

before_concrete_indices_references

After my changes you can see that the ConcreteIndices object no longer references clusterState:

after_concrete_indices_references

I've verified that the unit tests still succeed as well:

unit-tests-succeed

Check List

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

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.

@batcity batcity requested a review from a team as a code owner January 21, 2026 13:18
@github-actions github-actions bot added the bug Something isn't working label Jan 21, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
📝 Walkthrough

Walkthrough

This refactoring makes the ConcreteIndices class stateless by removing its stored ClusterState field and propagating the cluster state as a parameter through the resolveIfAbsent method and related helper methods that require it for index resolution.

Changes

Cohort / File(s) Change Summary
ConcreteIndices Refactoring
server/src/main/java/org/opensearch/action/bulk/TransportBulkAction.java
ConcreteIndices constructor simplified to accept only IndexNameExpressionResolver (removing ClusterState); resolveIfAbsent() method signature updated to accept ClusterState parameter; helper methods addFailureIfIndexIsUnavailable() and addFailureIfAppendOnlyIndexAndOpsDeleteOrUpdate() updated to accept ClusterState clusterstate parameter; all call sites propagate clusterState to these methods; minor conditional logic change from includeDataStreams == false to !includeDataStreams

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The PR description includes all required template sections: a clear description of changes, a related issue reference, testing approach with evidence, and checklist confirmation.
Title check ✅ Passed The title accurately describes the main objective of the changeset: removing ClusterState references from the ConcreteIndices object by making it state-less and passing ClusterState as a parameter to methods that need it.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Contributor

❌ Gradle check result for 1ab5f71: 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?

Copy link
Member

@sandeshkr419 sandeshkr419 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, looks good!

Can you add a changelog entry and run spotless - should get the CI to green.

Also, ensure your commits are signed-off correctly for DCO to pass: https://github.com/opensearch-project/OpenSearch/pull/20454/checks?check_run_id=61019418886

@sandeshkr419 sandeshkr419 changed the title issue-20085: remove references to cluster state from ConcreteIndices object Remove ClusterState reference from ConcreteIndices Jan 27, 2026
@sandeshkr419 sandeshkr419 changed the title Remove ClusterState reference from ConcreteIndices Remove ClusterState reference in ConcreteIndices Jan 27, 2026
@batcity batcity force-pushed the issue-20085-partial-fix branch from 1ab5f71 to 43020d6 Compare January 28, 2026 14:06
@batcity batcity force-pushed the issue-20085-partial-fix branch from 43020d6 to b7ddfac Compare January 28, 2026 14:09
@github-actions
Copy link
Contributor

❌ Gradle check result for 3a1f530: 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?

@batcity
Copy link
Author

batcity commented Jan 28, 2026

@sandeshkr419 np, I've updated the changelog, ran spotless and fixed the sign-off. The jenkins build still seems to be failing though, could you take a look to see what's going on. I don't think I have access to view the failure

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] JVM memory pressure build due to TransportBulkRequest pile up because of cluster state objects.

2 participants