Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ setup:
- match: { _id: "1" }
- match: { _source: { foo: "hello world" } }

- do:
catch: /action_request_validation_exception/
indices.shrink:
index: "source"
target: "new_shrunken_index"
wait_for_active_shards: 1
cluster_manager_timeout: 10s
body:
settings:
index.number_of_replicas: 0
index.number_of_shards: 1
index.blocks.read_only: true


# Related issue: https://github.com/opensearch-project/OpenSearch/issues/4845
---
"Returns error if target index's metadata write is blocked":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1652,7 +1652,7 @@ static IndexMetadata validateResize(ClusterState state, String sourceIndex, Stri

// ensure write operations on the source index is blocked
if (state.blocks().indexBlocked(ClusterBlockLevel.WRITE, sourceIndex) == false) {
throw new IllegalStateException(
throw new IllegalArgumentException(
"index " + sourceIndex + " must block write operations to resize index. use \"index.blocks.write=true\""
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void testValidateShrinkIndex() {
assertEquals(
"index source must block write operations to resize index. use \"index.blocks.write=true\"",
expectThrows(
IllegalStateException.class,
IllegalArgumentException.class,
() -> MetadataCreateIndexService.validateShrinkIndex(
createClusterState("source", randomIntBetween(2, 100), randomIntBetween(0, 10), Settings.EMPTY),
"source",
Expand Down Expand Up @@ -443,7 +443,7 @@ public void testValidateSplitIndex() {
assertEquals(
"index source must block write operations to resize index. use \"index.blocks.write=true\"",
expectThrows(
IllegalStateException.class,
IllegalArgumentException.class,
() -> MetadataCreateIndexService.validateSplitIndex(
createClusterState("source", randomIntBetween(2, 100), randomIntBetween(0, 10), Settings.EMPTY),
"source",
Expand Down Expand Up @@ -529,7 +529,7 @@ public void testValidateCloneIndex() {
assertEquals(
"index source must block write operations to resize index. use \"index.blocks.write=true\"",
expectThrows(
IllegalStateException.class,
IllegalArgumentException.class,
() -> MetadataCreateIndexService.validateCloneIndex(
createClusterState("source", randomIntBetween(2, 100), randomIntBetween(0, 10), Settings.EMPTY),
"source",
Expand Down
Loading