-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Prevent migration of system indices that match templates #87933
Prevent migration of system indices that match templates #87933
Conversation
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Hi @grcevski, I've created a changelog YAML for you. |
@@ -161,7 +163,8 @@ static List<GetFeatureUpgradeStatusResponse.IndexInfo> getIndexInfos(ClusterStat | |||
indexMetadata -> new GetFeatureUpgradeStatusResponse.IndexInfo( | |||
indexMetadata.getIndex().getName(), | |||
indexMetadata.getCreationVersion(), | |||
indexMetadata.getIndex().getName().equals(failedFeatureName) ? exception : null | |||
(indexMetadata.getIndex().getName().equals(failedFeatureName) | |||
|| indexMetadata.getIndex().getName().equals(failedFeatureUpgradedName)) ? exception : null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is interesting, in 8 we weren't properly determining the error status of the upgrade because the index reported in the exception has the upgraded suffix. My tests hit this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, that one's my bad! Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some minor notes, otherwise LGTM!
docs/changelog/87933.yaml
Outdated
summary: Prevent migration of indices that match templates | ||
area: Infra/Core | ||
type: bug | ||
issues: [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
ensureGreen(); | ||
|
||
client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest()).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should check that the upgrade is actually started (minimally, that accepted
is true
) here, otherwise I think testBailOnMigrateWithTemplatesV1
could pass if we get into a situation where we don't think the index needs to be migrated.
|
||
ensureGreen(); | ||
|
||
client().execute(PostFeatureUpgradeAction.INSTANCE, new PostFeatureUpgradeRequest()).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same thing about checking the response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. My only question is whether we could be a little more strict. Does Kibana use v1 or v2 templates? Could we completely block the other one (ie not allow that unused template type completely)?
Good idea, let me see what they use. They mentioned they are using the new type, but I'd have to confirm. |
OK, I don't think I can restrict it further. At some point they had a legacy index template, which they explicitly remove now and replace it with the new version. However a customer upgrading from an old version can potentially have the legacy one at the time of Elasticsearch upgrade because they haven't upgraded Kibana yet. From their code:
|
Legacy and composable templates may apply to system indices. We don't want this behavior during feature migration. The destination index should get its settings, mappings, and aliases from its system index descriptor. A user who gets this warning should modify their templates so that they do not match system indices, at least during the migration.
This PR is an 8.x version of #87262, where we add an additional flag to all
SystemIndexDescriptors
that allows certain SystemIndexDescriptors to use index templates. At the moment this is only applicable to Kibana (see elastic/kibana#134897).