Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-define index.mapper.dynamic setting in 8.x #109341

Merged

Conversation

martijnvg
Copy link
Member

@martijnvg martijnvg commented Jun 4, 2024

Currently when upgrading a 7.x cluster to 8.x with index.mapper.dynamic index setting defined the following happens:

  • In case of a full cluster restart upgrade, then the index setting gets archived and after the upgrade the cluster is in a green health.
  • In case of a rolling cluster restart upgrade, then shards of indices with the index setting fail to allocate as nodes start with 8.x version. The result is that the cluster has a red health and the index setting isn't archived. Closing and opening the index should archive the index setting and allocate the shards.

The change is about ensuring the same behavior happens when upgrading a cluster from 7.x to 8.x with indices that have the index.mapper.dynamic index setting defined. By re-defining the index.mapper.dynamic index setting with IndexSettingDeprecatedInV7AndRemovedInV8 property, the index is allowed to exist in 7.x indices, but can't be defined in new indices after the upgrade. This way we don't have to rely on index archiving and upgrading via full cluster restart or rolling restart will yield the same outcome.

Based on the test in #109301.
Relates to #109160 and #96075

Forward port from elastic#109301 to main branch only, and also checks whether the setting gets archived.

Relates to elastic#109160 and elastic#96075
@martijnvg martijnvg added >test Issues or PRs that are addressing/adding tests :StorageEngine/Mapping The storage related side of mappings labels Jun 4, 2024
@martijnvg martijnvg changed the title Add rolling upgrade test for the index.mapper.dynamic index setting bug. Re-define index.mapper.dynamic setting in 8.x Jun 10, 2024
@martijnvg martijnvg added v8.14.1 >bug and removed >test Issues or PRs that are addressing/adding tests labels Jun 10, 2024
@elasticsearchmachine
Copy link
Collaborator

Hi @martijnvg, I've created a changelog YAML for you.

@martijnvg martijnvg marked this pull request as ready for review June 10, 2024 13:37
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @martijnvg

@@ -147,6 +147,18 @@ public boolean isAutoUpdate() {
Property.Dynamic,
Property.IndexScope
);
/**
* Legacy index setting, kept for 7.x BWC compatibility. This setting has no effect in 8.x. Do not use.
* TODO: Remove in 9.0
Copy link
Member

Choose a reason for hiding this comment

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

Can we use @UpdateForV9 instead of TODO?

@martijnvg martijnvg added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport-and-merge labels Jun 11, 2024
@elasticsearchmachine elasticsearchmachine merged commit 09fc320 into elastic:main Jun 11, 2024
15 checks passed
@martijnvg martijnvg deleted the index-mapper-index-setting-test-main branch June 11, 2024 08:18
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Jun 11, 2024
Currently when upgrading a 7.x cluster to 8.x with
`index.mapper.dynamic` index setting defined the following happens:

- In case of a full cluster restart upgrade, then the index setting gets archived and after the upgrade the cluster is in a green health.
- In case of a rolling cluster restart upgrade, then shards of indices with the index setting fail to allocate as nodes start with 8.x version. The result is that the cluster has a red health and the index setting isn't archived. Closing and opening the index should archive the index setting and allocate the shards.

The change is about ensuring the same behavior happens when upgrading a
cluster from 7.x to 8.x with indices that have the
`index.mapper.dynamic` index setting defined.  By re-defining the
`index.mapper.dynamic `index setting with
`IndexSettingDeprecatedInV7AndRemovedInV8` property, the index is
allowed to exist in 7.x indices, but can't be defined in new indices
after the upgrade. This way we don't have to rely on index archiving and
upgrading via full cluster restart or rolling restart will yield the
same outcome.

Based on the test in elastic#109301. Relates to elastic#109160 and elastic#96075
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.14

elasticsearchmachine pushed a commit that referenced this pull request Jun 11, 2024
Currently when upgrading a 7.x cluster to 8.x with
`index.mapper.dynamic` index setting defined the following happens:

- In case of a full cluster restart upgrade, then the index setting gets archived and after the upgrade the cluster is in a green health.
- In case of a rolling cluster restart upgrade, then shards of indices with the index setting fail to allocate as nodes start with 8.x version. The result is that the cluster has a red health and the index setting isn't archived. Closing and opening the index should archive the index setting and allocate the shards.

The change is about ensuring the same behavior happens when upgrading a
cluster from 7.x to 8.x with indices that have the
`index.mapper.dynamic` index setting defined.  By re-defining the
`index.mapper.dynamic `index setting with
`IndexSettingDeprecatedInV7AndRemovedInV8` property, the index is
allowed to exist in 7.x indices, but can't be defined in new indices
after the upgrade. This way we don't have to rely on index archiving and
upgrading via full cluster restart or rolling restart will yield the
same outcome.

Based on the test in #109301. Relates to #109160 and #96075
javanna added a commit to javanna/elasticsearch that referenced this pull request Sep 17, 2024
This setting had been removed in the past, it was reintroudced for bw comp with 7.x with elastic#109341. It can now be removed from main as it no longer supports indices created with 7.x
javanna added a commit that referenced this pull request Sep 18, 2024
This setting had been removed in the past, it was reintroudced for bw comp with 7.x with #109341. It can now be removed from main as it no longer supports indices created with 7.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :StorageEngine/Mapping The storage related side of mappings Team:StorageEngine v8.14.1 v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants