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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Optimized date histogram aggregations by preventing unnecessary object allocations in date rounding utils ([19088](https://github.com/opensearch-project/OpenSearch/pull/19088))
- Optimize source conversion in gRPC search hits using zero-copy BytesRef ([#19280](https://github.com/opensearch-project/OpenSearch/pull/19280))
- Add failureaccess as runtime dependency to transport-grpc module ([#19339](https://github.com/opensearch-project/OpenSearch/pull/19339))
- Change shrink request to throw IllegalArgumentException when index not write blocked ([#19414](https://github.com/opensearch-project/OpenSearch/pull/19414))

### Fixed
- Fix unnecessary refreshes on update preparation failures ([#15261](https://github.com/opensearch-project/OpenSearch/issues/15261))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ setup:
- skip:
features: allowed_warnings

# try shrink without making it read only
- 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

# make it read-only
- do:
indices.put_settings:
Expand All @@ -45,7 +59,6 @@ setup:
cluster.health:
wait_for_status: green
index: source

# now we do the actual shrink
- do:
allowed_warnings:
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