Skip to content

Commit 786723b

Browse files
authored
Merge branch '8.19' into sec-api-links
2 parents 5ba57d2 + 1738bdf commit 786723b

14 files changed

Lines changed: 510 additions & 42 deletions

File tree

x-pack/platform/plugins/private/translations/translations/fr-FR.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49966,7 +49966,6 @@
4996649966
"xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "Corrigez ce problème en retirant les paramètres de ce cluster. La correction peut s'effectuer automatiquement.",
4996749967
"xpack.upgradeAssistant.esDeprecations.dataStreamsTypeLabel": "Flux de données",
4996849968
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "Manuel",
49969-
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "Ce problème doit être corrigé manuellement.",
4997049969
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "Fermer",
4997149970
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "Index : {indexName}",
4997249971
"xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "Fermer",

x-pack/platform/plugins/private/translations/translations/ja-JP.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49925,7 +49925,6 @@
4992549925
"xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "このクラスターから設定を削除して、この問題を解決します。この問題は自動的に解決できます。",
4992649926
"xpack.upgradeAssistant.esDeprecations.dataStreamsTypeLabel": "データストリーム",
4992749927
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "手動",
49928-
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "この問題は自動的に解決する必要があります。",
4992949928
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "閉じる",
4993049929
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "インデックス:{indexName}",
4993149930
"xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "閉じる",

x-pack/platform/plugins/private/translations/translations/zh-CN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50009,7 +50009,6 @@
5000950009
"xpack.upgradeAssistant.esDeprecations.clusterSettings.resolutionTooltipLabel": "通过从此集群中移除设置来解决该问题。此问题会自动解决。",
5001050010
"xpack.upgradeAssistant.esDeprecations.dataStreamsTypeLabel": "数据流",
5001150011
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellLabel": "手动",
50012-
"xpack.upgradeAssistant.esDeprecations.defaultDeprecation.manualCellTooltipLabel": "此问题需要手动解决。",
5001350012
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.closeButtonLabel": "关闭",
5001450013
"xpack.upgradeAssistant.esDeprecations.deprecationDetailsFlyout.secondaryDescription": "索引:{indexName}",
5001550014
"xpack.upgradeAssistant.esDeprecations.healthIndicatorFlyout.closeButtonLabel": "关闭",

x-pack/platform/plugins/private/upgrade_assistant/__jest__/client_integration/es_deprecations/deprecations_list.test.ts

Lines changed: 237 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
import { act } from 'react-dom/test-utils';
99

1010
import { API_BASE_PATH } from '../../../common/constants';
11-
import type { MlAction } from '../../../common/types';
11+
import type {
12+
ESUpgradeStatus,
13+
EnrichedDeprecationInfo,
14+
MlAction,
15+
ReindexAction,
16+
UnfreezeAction,
17+
} from '../../../common/types';
1218
import { setupEnvironment } from '../helpers';
1319
import { ElasticsearchTestBed, setupElasticsearchPage } from './es_deprecations.helpers';
1420
import {
@@ -310,4 +316,234 @@ describe('ES deprecations table', () => {
310316
);
311317
});
312318
});
319+
320+
describe('recommended actions for indices', () => {
321+
it('recommends set unfreeze if index is frozen', async () => {
322+
httpRequestsMockHelpers.setLoadEsDeprecationsResponse({
323+
...esDeprecationsMockResponse,
324+
migrationsDeprecations: esDeprecationsMockResponse.migrationsDeprecations.map(
325+
(deprecation) =>
326+
deprecation === esDeprecationsMockResponse.migrationsDeprecations[3]
327+
? ({
328+
level: 'critical',
329+
resolveDuringUpgrade: false,
330+
type: 'index_settings',
331+
message: 'Index created before 7.0',
332+
details: 'deprecation details',
333+
url: 'doc_url',
334+
index: 'reindex_index',
335+
correctiveAction: {
336+
type: 'unfreeze',
337+
metadata: {
338+
isClosedIndex: false,
339+
isFrozenIndex: true,
340+
isInDataStream: false,
341+
},
342+
} as UnfreezeAction,
343+
} as EnrichedDeprecationInfo)
344+
: deprecation
345+
),
346+
} as ESUpgradeStatus);
347+
348+
await act(async () => {
349+
testBed = await setupElasticsearchPage(httpSetup);
350+
});
351+
testBed.component.update();
352+
353+
const { find } = testBed;
354+
355+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
356+
expect(find('reindexTableCell-correctiveAction').text()).toContain('Recommended: unfreeze');
357+
});
358+
it('recommends set as read-only if index is a follower index', async () => {
359+
httpRequestsMockHelpers.setReindexStatusResponse('reindex_index', {
360+
reindexOp: null,
361+
warnings: [],
362+
hasRequiredPrivileges: true,
363+
meta: {
364+
indexName: 'follower-index',
365+
reindexName: 'reindexed-follower-index',
366+
aliases: [],
367+
isFrozen: false,
368+
isReadonly: false,
369+
isInDataStream: false,
370+
isFollowerIndex: true,
371+
},
372+
});
373+
374+
await act(async () => {
375+
testBed = await setupElasticsearchPage(httpSetup);
376+
});
377+
378+
testBed.component.update();
379+
380+
const { find } = testBed;
381+
382+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
383+
expect(find('reindexTableCell-correctiveAction').text()).toContain(
384+
'Recommended: set to read-only'
385+
);
386+
});
387+
388+
it('recommends set as read-only if index is bigger than 1GB', async () => {
389+
httpRequestsMockHelpers.setLoadEsDeprecationsResponse({
390+
...esDeprecationsMockResponse,
391+
migrationsDeprecations: esDeprecationsMockResponse.migrationsDeprecations.map(
392+
(deprecation) =>
393+
deprecation === esDeprecationsMockResponse.migrationsDeprecations[3]
394+
? ({
395+
level: 'critical',
396+
resolveDuringUpgrade: false,
397+
type: 'index_settings',
398+
message: 'Index created before 7.0',
399+
details: 'deprecation details',
400+
url: 'doc_url',
401+
index: 'reindex_index',
402+
correctiveAction: {
403+
type: 'reindex',
404+
indexSizeInBytes: 1173741824, // > 1GB
405+
metadata: {
406+
isClosedIndex: false,
407+
isFrozenIndex: false,
408+
isInDataStream: false,
409+
},
410+
} as ReindexAction,
411+
} as EnrichedDeprecationInfo)
412+
: deprecation
413+
),
414+
} as ESUpgradeStatus);
415+
416+
httpRequestsMockHelpers.setReindexStatusResponse('reindex_index', {
417+
reindexOp: null,
418+
warnings: [],
419+
hasRequiredPrivileges: true,
420+
meta: {
421+
indexName: 'large-index',
422+
reindexName: 'reindexed-large-index',
423+
aliases: [],
424+
isFrozen: false,
425+
isReadonly: false,
426+
isInDataStream: false,
427+
isFollowerIndex: false,
428+
},
429+
});
430+
431+
await act(async () => {
432+
testBed = await setupElasticsearchPage(httpSetup);
433+
});
434+
testBed.component.update();
435+
436+
const { find } = testBed;
437+
438+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
439+
expect(find('reindexTableCell-correctiveAction').text()).toContain(
440+
'Recommended: set to read-only'
441+
);
442+
});
443+
444+
it('recommends reindexing if index is already read-only', async () => {
445+
httpRequestsMockHelpers.setReindexStatusResponse('reindex_index', {
446+
reindexOp: null,
447+
warnings: [],
448+
hasRequiredPrivileges: true,
449+
meta: {
450+
indexName: 'readonly-index',
451+
reindexName: 'reindexed-readonly-index',
452+
aliases: [],
453+
isFrozen: false,
454+
isReadonly: true,
455+
isInDataStream: false,
456+
isFollowerIndex: false,
457+
},
458+
});
459+
460+
await act(async () => {
461+
testBed = await setupElasticsearchPage(httpSetup);
462+
});
463+
464+
testBed.component.update();
465+
466+
const { find } = testBed;
467+
468+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
469+
expect(find('reindexTableCell-correctiveAction').text()).toContain('Recommended: reindex');
470+
});
471+
472+
it('recommends set as read-only if reindexing is excluded', async () => {
473+
httpRequestsMockHelpers.setLoadEsDeprecationsResponse({
474+
...esDeprecationsMockResponse,
475+
migrationsDeprecations: esDeprecationsMockResponse.migrationsDeprecations.map(
476+
(deprecation) =>
477+
deprecation === esDeprecationsMockResponse.migrationsDeprecations[3]
478+
? ({
479+
level: 'critical',
480+
resolveDuringUpgrade: false,
481+
type: 'index_settings',
482+
message: 'Index created before 7.0',
483+
details: 'deprecation details',
484+
url: 'doc_url',
485+
index: 'reindex_index',
486+
correctiveAction: {
487+
type: 'reindex',
488+
excludedActions: ['readOnly'],
489+
metadata: {
490+
isClosedIndex: false,
491+
isFrozenIndex: false,
492+
isInDataStream: false,
493+
},
494+
} as ReindexAction,
495+
} as EnrichedDeprecationInfo)
496+
: deprecation
497+
),
498+
} as ESUpgradeStatus);
499+
500+
httpRequestsMockHelpers.setReindexStatusResponse('reindex_index', {
501+
reindexOp: null,
502+
warnings: [],
503+
hasRequiredPrivileges: true,
504+
meta: {
505+
indexName: 'excluded-index',
506+
reindexName: 'reindexed-excluded-index',
507+
aliases: [],
508+
isFrozen: false,
509+
isReadonly: false,
510+
isInDataStream: false,
511+
isFollowerIndex: false,
512+
},
513+
});
514+
515+
await act(async () => {
516+
testBed = await setupElasticsearchPage(httpSetup);
517+
});
518+
testBed.component.update();
519+
520+
const { find } = testBed;
521+
522+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
523+
expect(find('reindexTableCell-correctiveAction').text()).toContain('Recommended: reindex');
524+
});
525+
526+
it('recommends reindexing by default', async () => {
527+
const { find } = testBed;
528+
expect(find('reindexTableCell-correctiveAction').length).toBe(1);
529+
expect(find('reindexTableCell-correctiveAction').text()).toContain('Recommended: reindex');
530+
});
531+
});
532+
describe('recommended actions for data streams', () => {
533+
it('recommends read-only by default', async () => {
534+
const { find } = testBed;
535+
536+
expect(find('dataStreamReindexTableCell-correctiveAction').at(0).text()).toContain(
537+
'Recommended: set to read-only'
538+
);
539+
});
540+
541+
it('recommends reindexing if read-only is excluded', async () => {
542+
const { find } = testBed;
543+
544+
expect(find('dataStreamReindexTableCell-correctiveAction').at(1).text()).toContain(
545+
'Recommended: reindex'
546+
);
547+
});
548+
});
313549
});

x-pack/platform/plugins/private/upgrade_assistant/common/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,5 @@ export interface FeatureSet {
371371

372372
export type DataSourceExclusions = Record<string, Array<'readOnly' | 'reindex'>>;
373373
export type DataSourceAutoResolution = Record<string, 'readOnly'>;
374+
375+
export type IndicesResolutionType = 'readonly' | 'reindex' | 'unfreeze';

0 commit comments

Comments
 (0)