Skip to content

Treat shrink/split/clone source settings as read-only in normalizer - #1144

Merged
jwils merged 1 commit into
mainfrom
joshuaw/normalizer-ignore-shrink-source-settings
Apr 22, 2026
Merged

Treat shrink/split/clone source settings as read-only in normalizer#1144
jwils merged 1 commit into
mainfrom
joshuaw/normalizer-ignore-shrink-source-settings

Conversation

@jwils

@jwils jwils commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

OpenSearch exposes three settings on indices produced by a shrink (or split/clone) that are rejected on write:

  • index.resize.source.name
  • index.resize.source.uuid
  • index.routing.allocation.initial_recovery._id

Admin::IndexDefinitionConfigurator::ForIndex#settings_updates diffs current vs desired settings and PUTs null for any setting present in current but absent from desired (to restore its default). When a shrunk index is present, the PUT fails with:

[400] illegal_argument_exception: unknown setting [index.resize.source.name]
  please check that any required plugins are installed, or check the
  breaking changes documentation for removed settings

…with the other two surfacing as suppressed exceptions. This causes the admin lambda's update_opensearch_config run to fail hard.

This PR adds the three settings to IndexConfigNormalizer::READ_ONLY_SETTINGS so they are dropped from current_settings during normalization and the update loop leaves them alone — the same pattern already used for index.creation_date, index.uuid, index.history.uuid, etc.

Test plan

  • Extended the existing "filters out read-only settings" spec in index_config_normalizer_spec.rb to cover all three new entries; full index_config_normalizer_spec.rb suite passes (10 examples, 0 failures)

🤖 Generated with Claude Code

@myronmarston myronmarston left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM apart from the build failure.

OpenSearch exposes `index.resize.source.name`, `index.resize.source.uuid`,
and `index.routing.allocation.initial_recovery._id` when you fetch the
settings for an index produced by a shrink, split, or clone, but rejects
PUTs that try to write them (`illegal_argument_exception: unknown
setting`). The admin update loop diffs current vs desired settings and
PUTs null for anything present in current but absent from desired, so
running `update_opensearch_config` against a cluster containing such an
index fails with a 400.

Add these three settings to `READ_ONLY_SETTINGS` so the normalizer
drops them from current_settings and the update loop leaves them alone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jwils
jwils force-pushed the joshuaw/normalizer-ignore-shrink-source-settings branch from 02dd47a to 9ad8ed7 Compare April 22, 2026 15:53
@jwils
jwils merged commit 71221ce into main Apr 22, 2026
25 checks passed
@jwils
jwils deleted the joshuaw/normalizer-ignore-shrink-source-settings branch April 22, 2026 16:51
jwils added a commit that referenced this pull request Apr 22, 2026
`index.routing_partition_size` and `index.codec` are both static
(non-dynamic) index settings. OpenSearch exposes them on read but
rejects PUTs against `_settings` for them on an open index:

- `routing_partition_size` is index-creation-only and defaults to `1`
  when not set, so any PUT for it (including PUTs of null to restore the
  default) is rejected outright with `Can't update non dynamic
  settings`.
- `index.codec` can only be changed on a closed index, so PUTs against
  an open index fail the same way (`Can't update non dynamic settings
  [[index.codec]] for open indices [...]`).

The admin update loop diffs current vs desired settings and PUTs null
for anything present in current but absent from desired, so running
`clusters:configure:perform` against a cluster that surfaces either
setting fails with a 400.

Add both to `READ_ONLY_SETTINGS` so the normalizer drops them from
current_settings and the update loop leaves them alone, matching the
pattern established in #1144.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jwils added a commit that referenced this pull request Apr 22, 2026
`index.routing_partition_size` and `index.codec` are both static
(non-dynamic) index settings. OpenSearch exposes them on read but
rejects PUTs against `_settings` for them on an open index:

- `routing_partition_size` is index-creation-only and defaults to `1`
  when not set, so any PUT for it (including PUTs of null to restore the
  default) is rejected outright with `Can't update non dynamic
  settings`.
- `index.codec` can only be changed on a closed index, so PUTs against
  an open index fail the same way (`Can't update non dynamic settings
  [[index.codec]] for open indices [...]`).

The admin update loop diffs current vs desired settings and PUTs null
for anything present in current but absent from desired, so running
`clusters:configure:perform` against a cluster that surfaces either
setting fails with a 400.

Add both to `READ_ONLY_SETTINGS` so the normalizer drops them from
current_settings and the update loop leaves them alone, matching the
pattern established in #1144.
jwils added a commit that referenced this pull request Apr 23, 2026
Distills the patterns Myron Marston applies when reviewing merged PRs
(naming at the caller's level of abstraction, respond_to? as a code
smell, wrapper-class DI pattern, load-bearing tests, RBS/YARD hygiene,
etc.) into an edit-first skill.

Invoked as /myron-polish, the skill walks the current branch's diff
against main and applies fixes directly rather than producing review
comments. It loops — re-scan, apply edits, run script/lint --fix /
script/spellcheck -w / script/type_check / script/run_gem_specs — until
a full iteration makes zero edits and every verification command passes.
Capped at 8 iterations.

Source material: Myron's review bodies and inline comments on merged
PRs #974, #973, #1067, #1066, #1108, #1120, #1131, #1134, #1144, #1107.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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