Skip to content

[UA] Do not allow reindexing data_stream backing indices (and other enhancements)#213755

Merged
gsoldevila merged 8 commits intoelastic:8.xfrom
gsoldevila:no-reindexing-data-stream-backing-indices
Mar 13, 2025
Merged

[UA] Do not allow reindexing data_stream backing indices (and other enhancements)#213755
gsoldevila merged 8 commits intoelastic:8.xfrom
gsoldevila:no-reindexing-data-stream-backing-indices

Conversation

@gsoldevila
Copy link
Contributor

@gsoldevila gsoldevila commented Mar 10, 2025

Summary

The PR brings the following improvements to the UA ES deprecations flows:

  • Remove the "Reindex" option for Frozen index deprecations that are related to a data stream's backing index (backing indices cannot be alias-based, see thread).
  • Propagate "isClosedIndex" information to the UI side, so that we can show a warning message in the reindex flows flyouts. The original functionality got lost in the woods.
  • Propagate "isClosedIndex", "isFrozenIndex", "isReadonly" properties as part of the correctiveAction details ONLY for index_settings migrations, instead of doing it as top level properties for all migrations. These properties did not make for most migration types.
  • Big refactor in migrations.ts file (server side). The logic for obtaining, filtering and enriching ES deprecations had become quite fragmented and hard to read. @Bamieh @jloleysens please take a close look at this one.
  • Improve existing type definitions.

Here are screenshots for each of the combinations:

old + open

image

old + closed

image

old + frozen + open

image

old + frozen + closed

image

old + open + manual write block (readonly)

image

old + closed + manual write block (readonly)

image

old + frozen + open + manual write block (readonly)

image

old + frozen + closed + manual write block (readonly)

image

@gsoldevila gsoldevila added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:version Backport to applied version labels v8.18.0 v8.19.0 labels Mar 10, 2025
@gsoldevila gsoldevila requested review from Bamieh and jloleysens March 10, 2025 14:34
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@gsoldevila gsoldevila marked this pull request as draft March 10, 2025 14:38
@gsoldevila gsoldevila marked this pull request as ready for review March 11, 2025 14:11
@gsoldevila gsoldevila force-pushed the no-reindexing-data-stream-backing-indices branch from 74bf706 to 0cd39ab Compare March 12, 2025 16:52
@gsoldevila gsoldevila changed the title Do not allow reindexing data_stream backing indices [UA] Do not allow reindexing data_stream backing indices (and other enhancements) Mar 12, 2025
Copy link
Contributor

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

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

Checked the PR again after the more recent changes. LTGM. The migrations file needed some refactoring :elasticheart:

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Great work @gsoldevila !! Thanks for restoring the lost behaviour and cleaning up the code a bit, way more readable now 👏🏻

I did not test locally but the logic and re-added copy looks solid. When you get a chance, if you still have this running would you mind adding some screenshots to the PR description of what changed?

/>
);

expect(wrapper).toMatchInlineSnapshot(`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I tried to get this right but I couldn't get the assertions to be against just the data-test-subj attribute (in this case data-test-subj="startIndexReadonlyButton"). I believe there should be a way to say: "I expect data tests subject X to exist".

These snapshots serve that purpose too, they just a bit verbose IMO.

Not something we need to change on this PR though!

</EuiText>
),
},
/* We cannot unfreeze backing indices (that would break the related data_stream) */
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/* We cannot unfreeze backing indices (that would break the related data_stream) */
/* We cannot reindex backing indices in the same way as regular indices (that would break the related data_stream) */

id="xpack.upgradeAssistant.esDeprecations.indices.indexFlyout.detailsStep.unfreeze.option2.description"
defaultMessage="Alternatively, you can reindex the data into a new, compatible index. All existing documents will be copied over to a new index, and the old index will be removed. Depending on the size of the index and the available resources, the reindexing operation can take some time. Your data will be in read-only mode until the reindexing has completed."
/>
{isClosedIndex && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice! This addresses my concern of showing this warning when the reindex option is not present.

<EuiFlexItem grow={false}>
<EuiFlexGroup gutterSize="s">
{!hasFetchFailed && !isCompleted && hasRequiredPrivileges && (
{/* We cannot unfreeze backing indices (that would break the related data_stream) */}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{/* We cannot unfreeze backing indices (that would break the related data_stream) */}
{/* We cannot reindex backing indices in the same way as regular indices (that would break the related data_stream) */}

@gsoldevila gsoldevila force-pushed the no-reindexing-data-stream-backing-indices branch from 933d08d to c775fd4 Compare March 13, 2025 10:03
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
upgradeAssistant 194 195 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
upgradeAssistant 212.2KB 213.8KB +1.6KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
upgradeAssistant 23.8KB 23.8KB -1.0B

History

@gsoldevila gsoldevila merged commit f2ae059 into elastic:8.x Mar 13, 2025
8 checks passed
@gsoldevila
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.18

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

gsoldevila added a commit to gsoldevila/kibana that referenced this pull request Mar 13, 2025
…nhancements) (elastic#213755)

## Summary

The PR brings the following improvements to the UA ES deprecations
flows:

* Remove the "Reindex" option for _Frozen index_ deprecations that are
related to a data stream's backing index (backing indices cannot be
alias-based, see
[thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)).
* Propagate `"isClosedIndex"` information to the UI side, so that we can
show a warning message in the reindex flows flyouts. The [original
functionality](elastic#58890) got lost in
the woods.
* Propagate `"isClosedIndex", "isFrozenIndex", "isReadonly"` properties
as part of the `correctiveAction` details ONLY for _index_settings
migrations_, instead of doing it as top level properties for all
migrations. These properties did not make for most migration types.
* Big refactor in `migrations.ts` file (server side). The logic for
obtaining, filtering and enriching ES deprecations had become quite
fragmented and hard to read. @Bamieh @jloleysens please take a close
look at this one.
* Improve existing type definitions.

(cherry picked from commit f2ae059)
gsoldevila added a commit that referenced this pull request Mar 14, 2025
…other enhancements) (#213755) (#214386)

# Backport

This will backport the following commits from `8.x` to `8.18`:
- [[UA] Do not allow reindexing data_stream backing indices (and other
enhancements) (#213755)](#213755)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-03-13T13:34:47Z","message":"[UA]
Do not allow reindexing data_stream backing indices (and other
enhancements) (#213755)\n\n## Summary\n\nThe PR brings the following
improvements to the UA ES deprecations\nflows:\n\n* Remove the
\"Reindex\" option for _Frozen index_ deprecations that are\nrelated to
a data stream's backing index (backing indices cannot be\nalias-based,
see\n[thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)).\n*
Propagate `\"isClosedIndex\"` information to the UI side, so that we
can\nshow a warning message in the reindex flows flyouts. The
[original\nfunctionality](#58890)
got lost in\nthe woods.\n* Propagate `\"isClosedIndex\",
\"isFrozenIndex\", \"isReadonly\"` properties\nas part of the
`correctiveAction` details ONLY for _index_settings\nmigrations_,
instead of doing it as top level properties for all\nmigrations. These
properties did not make for most migration types.\n* Big refactor in
`migrations.ts` file (server side). The logic for\nobtaining, filtering
and enriching ES deprecations had become quite\nfragmented and hard to
read. @Bamieh @jloleysens please take a close\nlook at this one.\n*
Improve existing type
definitions.","sha":"f2ae05909dd81e3cc368173b350b331587a99d8d","branchLabelMapping":{"^v8.16.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:version","v8.18.0","v8.19.0"],"title":"[UA]
Do not allow reindexing data_stream backing indices (and other
enhancements)","number":213755,"url":"https://github.com/elastic/kibana/pull/213755","mergeCommit":{"message":"[UA]
Do not allow reindexing data_stream backing indices (and other
enhancements) (#213755)\n\n## Summary\n\nThe PR brings the following
improvements to the UA ES deprecations\nflows:\n\n* Remove the
\"Reindex\" option for _Frozen index_ deprecations that are\nrelated to
a data stream's backing index (backing indices cannot be\nalias-based,
see\n[thread](https://elastic.slack.com/archives/C08A04N8XHV/p1741017934359239)).\n*
Propagate `\"isClosedIndex\"` information to the UI side, so that we
can\nshow a warning message in the reindex flows flyouts. The
[original\nfunctionality](#58890)
got lost in\nthe woods.\n* Propagate `\"isClosedIndex\",
\"isFrozenIndex\", \"isReadonly\"` properties\nas part of the
`correctiveAction` details ONLY for _index_settings\nmigrations_,
instead of doing it as top level properties for all\nmigrations. These
properties did not make for most migration types.\n* Big refactor in
`migrations.ts` file (server side). The logic for\nobtaining, filtering
and enriching ES deprecations had become quite\nfragmented and hard to
read. @Bamieh @jloleysens please take a close\nlook at this one.\n*
Improve existing type
definitions.","sha":"f2ae05909dd81e3cc368173b350b331587a99d8d"}},"sourceBranch":"8.x","suggestedTargetBranches":["8.18"],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v8.18.0 v8.19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments