mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
# Backport This will backport the following commits from `8.x` to `main`: - [[UA] Handle frozen indices deprecations (#208156)](https://github.com/elastic/kibana/pull/208156) <!--- Backport version: 9.6.4 --> ### 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-01-30T22:36:28Z","message":"[UA] Handle frozen indices deprecations (#208156)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana-team/issues/1392\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"cc358e3c46e5df2af834e341114f23aa1fd4f7d1","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] Handle frozen indices deprecations","number":208156,"url":"https://github.com/elastic/kibana/pull/208156","mergeCommit":{"message":"[UA] Handle frozen indices deprecations (#208156)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana-team/issues/1392\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"cc358e3c46e5df2af834e341114f23aa1fd4f7d1"}},"sourceBranch":"8.x","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/211165","number":211165,"state":"MERGED","mergeCommit":{"sha":"22a748198915940c4bbcf59eab167caae462284e","message":"[8.18] [UA] Handle frozen indices deprecations (#208156) (#211165)\n\n# Backport\n\nThis will backport the following commits from `8.x` to `8.18`:\n- [[UA] Handle frozen indices deprecations\n(#208156)](https://github.com/elastic/kibana/pull/208156)\n\n<!--- Backport version: 8.9.8 -->\n\n### Questions ?\nPlease refer to the [Backport tool\ndocumentation](https://github.com/sqren/backport)\n\n<!--BACKPORT [{\"author\":{\"name\":\"Gerard\nSoldevila\",\"email\":\"gerard.soldevila@elastic.co\"},\"sourceCommit\":{\"committedDate\":\"2025-01-30T22:36:28Z\",\"message\":\"[UA]\nHandle frozen indices deprecations (#208156)\\n\\n## Summary\\r\\n\\r\\nCloses\nhttps://github.com/elastic/kibana-team/issues/1392\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<42973632+kibanamachine@users.noreply.github.com>\",\"sha\":\"cc358e3c46e5df2af834e341114f23aa1fd4f7d1\",\"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\"],\"number\":208156,\"url\":\"https://github.com/elastic/kibana/pull/208156\",\"mergeCommit\":{\"message\":\"[UA]\nHandle frozen indices deprecations (#208156)\\n\\n## Summary\\r\\n\\r\\nCloses\nhttps://github.com/elastic/kibana-team/issues/1392\\r\\n\\r\\n---------\\r\\n\\r\\nCo-authored-by:\nkibanamachine\n<42973632+kibanamachine@users.noreply.github.com>\",\"sha\":\"cc358e3c46e5df2af834e341114f23aa1fd4f7d1\"}},\"sourceBranch\":\"8.x\",\"suggestedTargetBranches\":[\"8.18\"],\"targetPullRequestStates\":[{\"branch\":\"8.18\",\"label\":\"v8.18.0\",\"labelRegex\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"},{\"branch\":\"8.19\",\"label\":\"v8.19.0\",\"labelRegex\":\"^v(\\\\d+).(\\\\d+).\\\\d+$\",\"isSourceBranch\":false,\"state\":\"NOT_CREATED\"}]}]\nBACKPORT-->\n\nCo-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
This commit is contained in:
parent
54b6e65a20
commit
c14d52a12a
11 changed files with 272 additions and 8 deletions
|
@ -299,6 +299,7 @@ export const getDocLinks = ({ kibanaBranch, buildFlavor }: GetDocLinkOptions): D
|
|||
overview: `${KIBANA_DOCS}upgrade-assistant.html`,
|
||||
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
|
||||
remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`,
|
||||
unfreezeApi: `${ELASTICSEARCH_DOCS}unfreeze-index-api.html`,
|
||||
reindexWithPipeline: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-with-an-ingest-pipeline`,
|
||||
},
|
||||
rollupJobs: `${KIBANA_DOCS}data-rollups.html`,
|
||||
|
|
|
@ -260,6 +260,7 @@ export interface DocLinks {
|
|||
readonly overview: string;
|
||||
readonly batchReindex: string;
|
||||
readonly remoteReindex: string;
|
||||
readonly unfreezeApi: string;
|
||||
readonly reindexWithPipeline: string;
|
||||
};
|
||||
readonly rollupJobs: string;
|
||||
|
|
|
@ -237,6 +237,7 @@ export interface EnrichedDeprecationInfo
|
|||
| 'ilm_policies'
|
||||
| 'templates';
|
||||
isCritical: boolean;
|
||||
frozen?: boolean;
|
||||
status?: estypes.HealthReportIndicatorHealthStatus;
|
||||
index?: string;
|
||||
correctiveAction?:
|
||||
|
|
|
@ -87,3 +87,116 @@ exports[`ChecklistFlyout renders 1`] = `
|
|||
</EuiFlyoutFooter>
|
||||
</Fragment>
|
||||
`;
|
||||
|
||||
exports[`ChecklistFlyout renders for frozen indices 1`] = `
|
||||
<Fragment>
|
||||
<EuiFlyoutBody>
|
||||
<EuiText>
|
||||
<p>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="The index will be read-only during reindexing. You won't be able to add, update, or delete documents until reindexing is complete. If you need to reindex to a new cluster, use the reindex API. {docsLink}"
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexDescription"
|
||||
values={
|
||||
Object {
|
||||
"docsLink": <EuiLink
|
||||
href="https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/docs-reindex.html#reindex-from-remote"
|
||||
target="_blank"
|
||||
>
|
||||
Learn more
|
||||
</EuiLink>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</p>
|
||||
<EuiCallOut
|
||||
iconType="iInCircle"
|
||||
title={
|
||||
<Memo(MemoizedFormattedMessage)
|
||||
defaultMessage="This index is frozen"
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexFrozenIndexTitle"
|
||||
/>
|
||||
}
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Frozen indices will no longer be supported after upgrade, so this index will be deleted as part the reindex operation. {docsLink}"
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexFrozenIndex"
|
||||
values={
|
||||
Object {
|
||||
"docsLink": <EuiLink
|
||||
href="https://www.elastic.co/guide/en/elasticsearch/reference/mocked-test-branch/unfreeze-index-api.html"
|
||||
target="_blank"
|
||||
>
|
||||
Learn more
|
||||
</EuiLink>,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</EuiCallOut>
|
||||
<EuiSpacer />
|
||||
<p>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Reindexing is performed in the background. You can return to the Upgrade Assistant to view progress or resume reindexing after a Kibana restart."
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail"
|
||||
/>
|
||||
</p>
|
||||
</EuiText>
|
||||
<EuiSpacer />
|
||||
<ReindexProgress
|
||||
cancelReindex={[MockFunction]}
|
||||
reindexState={
|
||||
Object {
|
||||
"errorMessage": null,
|
||||
"hasRequiredPrivileges": true,
|
||||
"lastCompletedStep": undefined,
|
||||
"loadingState": 1,
|
||||
"meta": Object {
|
||||
"aliases": Array [],
|
||||
"indexName": "myIndex",
|
||||
"reindexName": "reindexed-myIndex",
|
||||
},
|
||||
"reindexTaskPercComplete": null,
|
||||
"reindexWarnings": Array [],
|
||||
"status": undefined,
|
||||
}
|
||||
}
|
||||
/>
|
||||
</EuiFlyoutBody>
|
||||
<EuiFlyoutFooter>
|
||||
<EuiFlexGroup
|
||||
justifyContent="spaceBetween"
|
||||
>
|
||||
<EuiFlexItem
|
||||
grow={false}
|
||||
>
|
||||
<EuiButtonEmpty
|
||||
flush="left"
|
||||
iconType="cross"
|
||||
onClick={[MockFunction]}
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Close"
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.closeButtonLabel"
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem
|
||||
grow={false}
|
||||
>
|
||||
<EuiButton
|
||||
color="primary"
|
||||
data-test-subj="startReindexingButton"
|
||||
disabled={false}
|
||||
fill={true}
|
||||
isLoading={false}
|
||||
onClick={[MockFunction]}
|
||||
>
|
||||
<MemoizedFormattedMessage
|
||||
defaultMessage="Start reindexing"
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel"
|
||||
/>
|
||||
</EuiButton>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</EuiFlyoutFooter>
|
||||
</Fragment>
|
||||
`;
|
||||
|
|
|
@ -36,6 +36,7 @@ jest.mock('../../../../../app_context', () => {
|
|||
describe('ChecklistFlyout', () => {
|
||||
const defaultProps = {
|
||||
indexName: 'myIndex',
|
||||
frozen: false,
|
||||
closeFlyout: jest.fn(),
|
||||
confirmInputValue: 'CONFIRM',
|
||||
onConfirmInputChange: jest.fn(),
|
||||
|
@ -67,6 +68,12 @@ describe('ChecklistFlyout', () => {
|
|||
expect(shallow(<ChecklistFlyoutStep {...defaultProps} />)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders for frozen indices', () => {
|
||||
const props = cloneDeep(defaultProps);
|
||||
props.frozen = true;
|
||||
expect(shallow(<ChecklistFlyoutStep {...props} />)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('disables button while reindexing', () => {
|
||||
const props = cloneDeep(defaultProps);
|
||||
props.reindexState.status = ReindexStatus.inProgress;
|
||||
|
|
|
@ -72,11 +72,12 @@ const buttonLabel = (status?: ReindexStatus) => {
|
|||
* Displays a flyout that shows the current reindexing status for a given index.
|
||||
*/
|
||||
export const ChecklistFlyoutStep: React.FunctionComponent<{
|
||||
frozen?: boolean;
|
||||
closeFlyout: () => void;
|
||||
reindexState: ReindexState;
|
||||
startReindex: () => void;
|
||||
cancelReindex: () => void;
|
||||
}> = ({ closeFlyout, reindexState, startReindex, cancelReindex }) => {
|
||||
}> = ({ frozen, closeFlyout, reindexState, startReindex, cancelReindex }) => {
|
||||
const {
|
||||
services: {
|
||||
api,
|
||||
|
@ -197,6 +198,37 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
|
|||
}}
|
||||
/>
|
||||
</p>
|
||||
{frozen && (
|
||||
<>
|
||||
<EuiCallOut
|
||||
title={
|
||||
<FormattedMessage
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexFrozenIndexTitle"
|
||||
defaultMessage="This index is frozen"
|
||||
/>
|
||||
}
|
||||
iconType="iInCircle"
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexFrozenIndex"
|
||||
defaultMessage="Frozen indices will no longer be supported after upgrade, so this index will be deleted as part the reindex operation. {docsLink}"
|
||||
values={{
|
||||
docsLink: (
|
||||
<EuiLink target="_blank" href={docLinks.links.upgradeAssistant.unfreezeApi}>
|
||||
{i18n.translate(
|
||||
'xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel',
|
||||
{
|
||||
defaultMessage: 'Learn more',
|
||||
}
|
||||
)}
|
||||
</EuiLink>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</EuiCallOut>
|
||||
<EuiSpacer />
|
||||
</>
|
||||
)}
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail"
|
||||
|
|
|
@ -73,6 +73,7 @@ export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({
|
|||
/>
|
||||
) : (
|
||||
<ChecklistFlyoutStep
|
||||
frozen={deprecation.frozen}
|
||||
closeFlyout={closeFlyout}
|
||||
startReindex={startReindexWithWarnings}
|
||||
reindexState={reindexState}
|
||||
|
|
|
@ -73,6 +73,25 @@
|
|||
"resolve_during_rolling_upgrade": false
|
||||
}
|
||||
],
|
||||
"frozen_index": [
|
||||
{
|
||||
"level": "critical",
|
||||
"message": "Old index with a compatibility version < 8.0",
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.0.html#breaking-changes-8.0",
|
||||
"details": "This index has version: 7.17.28-8.0.0",
|
||||
"resolve_during_rolling_upgrade": false,
|
||||
"_meta": { "reindex_required": true }
|
||||
},
|
||||
{
|
||||
"level": "critical",
|
||||
"message":
|
||||
"Index [frozen_index] is a frozen index. The frozen indices feature is deprecated and will be removed in version 9.0.",
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/frozen-indices.html",
|
||||
"details":
|
||||
"Frozen indices must be unfrozen before upgrading to version 9.0. (The legacy frozen indices feature no longer offers any advantages. You may consider cold or frozen tiers in place of frozen indices.)",
|
||||
"resolve_during_rolling_upgrade": false
|
||||
}
|
||||
],
|
||||
"closed_index": [
|
||||
{
|
||||
"level": "critical",
|
||||
|
|
|
@ -91,6 +91,20 @@ Object {
|
|||
"type": "index_settings",
|
||||
"url": "https: //www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-8.0.html",
|
||||
},
|
||||
Object {
|
||||
"correctiveAction": Object {
|
||||
"blockerForReindexing": undefined,
|
||||
"type": "reindex",
|
||||
},
|
||||
"details": "This index has version: 7.17.28-8.0.0",
|
||||
"frozen": true,
|
||||
"index": "frozen_index",
|
||||
"isCritical": true,
|
||||
"message": "Old index with a compatibility version < 8.0",
|
||||
"resolveDuringUpgrade": false,
|
||||
"type": "index_settings",
|
||||
"url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.0.html#breaking-changes-8.0",
|
||||
},
|
||||
Object {
|
||||
"correctiveAction": Object {
|
||||
"blockerForReindexing": "index-closed",
|
||||
|
@ -203,7 +217,7 @@ Object {
|
|||
"url": "https://github.com/elastic/elasticsearch/pull/117172",
|
||||
},
|
||||
],
|
||||
"totalCriticalDeprecations": 7,
|
||||
"totalCriticalDeprecations": 8,
|
||||
"totalCriticalHealthIssues": 0,
|
||||
}
|
||||
`;
|
||||
|
|
|
@ -238,6 +238,52 @@ describe('getESUpgradeStatus', () => {
|
|||
expect(upgradeStatus.totalCriticalDeprecations).toBe(0);
|
||||
});
|
||||
|
||||
it('filters out frozen indices if old index deprecations exist for the same indices', async () => {
|
||||
esClient.asCurrentUser.migration.deprecations.mockResponse({
|
||||
cluster_settings: [],
|
||||
node_settings: [],
|
||||
ml_settings: [],
|
||||
index_settings: {
|
||||
frozen_index: [
|
||||
{
|
||||
level: 'critical',
|
||||
message: 'Old index with a compatibility version < 8.0',
|
||||
url: 'https://www.elastic.co/guide/en/elasticsearch/reference/current/migrating-8.0.html#breaking-changes-8.0',
|
||||
details: 'This index has version: 7.17.28-8.0.0',
|
||||
resolve_during_rolling_upgrade: false,
|
||||
_meta: { reindex_required: true },
|
||||
},
|
||||
{
|
||||
level: 'critical',
|
||||
message:
|
||||
'Index [frozen_index] is a frozen index. The frozen indices feature is deprecated and will be removed in version 9.0.',
|
||||
url: 'https://www.elastic.co/guide/en/elasticsearch/reference/master/frozen-indices.html',
|
||||
details:
|
||||
'Frozen indices must be unfrozen before upgrading to version 9.0. (The legacy frozen indices feature no longer offers any advantages. You may consider cold or frozen tiers in place of frozen indices.)',
|
||||
resolve_during_rolling_upgrade: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
data_streams: {},
|
||||
// @ts-expect-error not in types yet
|
||||
ilm_policies: {},
|
||||
templates: {},
|
||||
});
|
||||
|
||||
// @ts-expect-error not full interface of response
|
||||
esClient.asCurrentUser.indices.resolveIndex.mockResponse(resolvedIndices);
|
||||
|
||||
const upgradeStatus = await getESUpgradeStatus(esClient, {
|
||||
...featureSet,
|
||||
});
|
||||
|
||||
expect([
|
||||
...upgradeStatus.migrationsDeprecations,
|
||||
...upgradeStatus.enrichedHealthIndicators,
|
||||
]).toHaveLength(1);
|
||||
expect(upgradeStatus.totalCriticalDeprecations).toBe(1);
|
||||
});
|
||||
|
||||
it('returns health indicators', async () => {
|
||||
esClient.asCurrentUser.migration.deprecations.mockResponse({
|
||||
cluster_settings: [],
|
||||
|
|
|
@ -127,13 +127,13 @@ export const getEnrichedDeprecations = async (
|
|||
|
||||
const systemIndicesList = convertFeaturesToIndicesArray(systemIndices.features);
|
||||
|
||||
const indexSettingsIndexNames = Object.keys(deprecations.index_settings).map(
|
||||
(indexName) => indexName!
|
||||
);
|
||||
const indexSettingsIndexNames = Object.keys(deprecations.index_settings);
|
||||
const indexSettingsIndexStates = indexSettingsIndexNames.length
|
||||
? await esIndicesStateCheck(dataClient.asCurrentUser, indexSettingsIndexNames)
|
||||
: {};
|
||||
|
||||
const deprecationsByIndex = new Map<string, EnrichedDeprecationInfo[]>();
|
||||
|
||||
return normalizeEsResponse(deprecations)
|
||||
.filter((deprecation) => {
|
||||
switch (deprecation.type) {
|
||||
|
@ -174,10 +174,39 @@ export const getEnrichedDeprecations = async (
|
|||
indexSettingsIndexStates[deprecation.index!] === 'closed' ? 'index-closed' : undefined;
|
||||
}
|
||||
|
||||
const enrichedDeprecation = _.omit(deprecation, 'metadata');
|
||||
return {
|
||||
...enrichedDeprecation,
|
||||
const enrichedDeprecation = {
|
||||
..._.omit(deprecation, 'metadata'),
|
||||
correctiveAction,
|
||||
};
|
||||
|
||||
if (deprecation.index) {
|
||||
const indexDeprecations = deprecationsByIndex.get(deprecation.index) || [];
|
||||
indexDeprecations.push(enrichedDeprecation);
|
||||
deprecationsByIndex.set(deprecation.index, indexDeprecations);
|
||||
}
|
||||
|
||||
return enrichedDeprecation;
|
||||
})
|
||||
.filter((deprecation) => {
|
||||
if (
|
||||
deprecation.index &&
|
||||
deprecation.message.includes(`Index [${deprecation.index}] is a frozen index`)
|
||||
) {
|
||||
// frozen indices are created in 7.x, so they are old / incompatible as well
|
||||
// reindexing + deleting is required, so no need to bubble up this deprecation in the UI
|
||||
const indexDeprecations = deprecationsByIndex.get(deprecation.index)!;
|
||||
const oldIndexDeprecation: EnrichedDeprecationInfo | undefined = indexDeprecations.find(
|
||||
(elem) =>
|
||||
elem.type === 'index_settings' &&
|
||||
elem.index === deprecation.index &&
|
||||
elem.correctiveAction?.type === 'reindex'
|
||||
);
|
||||
if (oldIndexDeprecation) {
|
||||
oldIndexDeprecation.frozen = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue