Skip to content

Shrink request to throw IllegalArgumentException when index not write blocked#19414

Closed
monusingh-1 wants to merge 1 commit intoopensearch-project:mainfrom
monusingh-1:fix3
Closed

Shrink request to throw IllegalArgumentException when index not write blocked#19414
monusingh-1 wants to merge 1 commit intoopensearch-project:mainfrom
monusingh-1:fix3

Conversation

@monusingh-1
Copy link
Copy Markdown

@monusingh-1 monusingh-1 commented Sep 25, 2025

Description

This change changes the Exception thrown when shrink operation is performed on an index which does not have write block from IllegalStateException(5xx) to IllegalArgumentException(4xx)

Related Issues

Resolves #[19026]

Testing

curl -X POST "localhost:9200/test-01/_shrink/test-shrink-01" -H 'Content-Type: application/json' -d'              15:57:01
{
  "settings": {
    "index.number_of_shards": 1,
    "index.number_of_replicas": 0
  }
}'

Before

{"error":{"root_cause":[{"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use "index.blocks.write=true""}],"type":"illegal_state_exception","reason":"index test-01 must block write operations to resize index. use "index.blocks.write=true""},"status":500}

After

{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"index test-01 must block write operations to resize index. use "index.blocks.write=true""}],"type":"illegal_argument_exception","reason":"index test-01 must block write operations to resize index. use "index.blocks.write=true""},"status":400}%

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.

@monusingh-1 monusingh-1 changed the title Fix validation exception on shrink Shrink request to throw IllegalArgumentException when index not write blocked Sep 25, 2025
…t write blocked

Signed-off-by: Monu Singh <smonujat@gmail.com>
@github-actions
Copy link
Copy Markdown
Contributor

❌ Gradle check result for 2df8790: 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?

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.

1 participant