Skip to content

Commit

Permalink
[index management] Remove index unfreeze code (elastic#205617)
Browse files Browse the repository at this point in the history
## Summary

Remove code related to unfreezing indices since the functionality is
being removed from v9 due to
elastic/elasticsearch#119227
  • Loading branch information
mattkime authored and CAWilson94 committed Jan 10, 2025
1 parent 1fa2c5c commit d7d3c64
Show file tree
Hide file tree
Showing 19 changed files with 1 addition and 202 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22348,7 +22348,6 @@
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "Afficher l'aperçu des index",
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "Afficher les paramètres des index",
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "Afficher les statistiques des index",
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "Dégeler {selectedIndexCount, plural, one {l'index} other {les index} }",
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "Retour aux index",
"xpack.idxMgmt.indexDetails.errorDescription": "Une erreur s'est produite lors du chargement des données pour l'index {indexName}. Assurez-vous que le nom de l'index dans l'URL est correct, puis réessayez.",
"xpack.idxMgmt.indexDetails.errorTitle": "Impossible de charger les détails d'index",
Expand Down Expand Up @@ -23248,8 +23247,6 @@
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "Nom de modèle obligatoire.",
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "Les espaces ne sont pas autorisés dans un nom de modèle.",
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "Un nom de modèle ne doit pas commencer par un trait de soulignement.",
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "L'index {indexNames} a été débloqué.",
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "Déverrouillage terminé : [{indexNames}]",
"xpack.idxMgmt.validators.string.invalidJSONError": "Format JSON non valide.",
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "Ajouter une stratégie de cycle de vie",
"xpack.indexLifecycleMgmt.appTitle": "Stratégies de cycle de vie des index",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22206,7 +22206,6 @@
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "インデックス概要を表示",
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "インデックス設定を表示",
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "インデックス統計を表示",
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "{selectedIndexCount, plural, other {個のインデックス} }の凍結を解除",
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "インデックスに戻る",
"xpack.idxMgmt.indexDetails.errorDescription": "インデックス{indexName}のデータを読み込む際にエラーが発生しました。URLのインデックス名が正しいことを確認し、もう一度試してください。",
"xpack.idxMgmt.indexDetails.errorTitle": "インデックス詳細を読み込めません",
Expand Down Expand Up @@ -23107,8 +23106,6 @@
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "テンプレート名が必要です。",
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "テンプレート名にスペースは使用できません。",
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "テンプレート名はアンダーラインで始めることはできません。",
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "インデックス{indexNames}が凍結解除されました。",
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "[{indexNames}] の凍結が解除されました",
"xpack.idxMgmt.validators.string.invalidJSONError": "無効な JSON フォーマット。",
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "ライフサイクルポリシーを追加",
"xpack.indexLifecycleMgmt.appTitle": "インデックスライフサイクルポリシー",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21851,7 +21851,6 @@
"xpack.idxMgmt.indexActionsMenu.showIndexOverviewLabel": "显示索引概览",
"xpack.idxMgmt.indexActionsMenu.showIndexSettingsLabel": "显示索引设置",
"xpack.idxMgmt.indexActionsMenu.showIndexStatsLabel": "显示索引统计信息",
"xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel": "取消冻结{selectedIndexCount, plural, other {索引} }",
"xpack.idxMgmt.indexDetails.backToIndicesButtonLabel": "返回到索引",
"xpack.idxMgmt.indexDetails.errorDescription": "加载索引 {indexName} 的数据时出现错误。请确保 URL 中的索引名称正确,然后重试。",
"xpack.idxMgmt.indexDetails.errorTitle": "无法加载索引详情",
Expand Down Expand Up @@ -22744,8 +22743,6 @@
"xpack.idxMgmt.templateValidation.templateNameRequiredError": "模板名称必填。",
"xpack.idxMgmt.templateValidation.templateNameSpacesError": "模板名称不允许包含空格。",
"xpack.idxMgmt.templateValidation.templateNameUnderscoreError": "模板名称不得以下划线开头。",
"xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage": "索引 {indexNames} 已取消冻结。",
"xpack.idxMgmt.unfreezeIndicesAction.successfullyUnfrozeIndicesMessage": "成功取消冻结:[{indexNames}]",
"xpack.idxMgmt.validators.string.invalidJSONError": "JSON 格式无效。",
"xpack.indexLifecycleMgmt.addLifecyclePolicyActionButtonLabel": "添加生命周期策略",
"xpack.indexLifecycleMgmt.appTitle": "索引生命周期策略",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export type TestSubjects =
| 'templatesTab'
| 'templateTable'
| 'title'
| 'unfreezeIndexMenuButton'
| 'updateEditIndexSettingsButton'
| 'updateIndexSettingsErrorCallout'
| 'viewButton'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,38 +336,6 @@ describe('<IndexManagementHome />', () => {
);
});

test('should be able to unfreeze a frozen index', async () => {
const { actions, exists, find } = testBed;

httpRequestsMockHelpers.setReloadIndicesResponse([{ ...indexMockA, isFrozen: false }]);

// Open context menu
await actions.clickManageContextMenuButton();
// Check that the unfreeze action exists for the current index and unfreeze it
expect(exists('unfreezeIndexMenuButton')).toBe(true);
await actions.clickContextMenuOption('unfreezeIndexMenuButton');

// After the index is unfrozen, we imediately do a reload. So we need to expect to see
// a reload server call also.
expect(httpSetup.post).toHaveBeenCalledWith(
`${API_BASE_PATH}/indices/unfreeze`,
expect.anything()
);
expect(httpSetup.post).toHaveBeenCalledWith(
`${API_BASE_PATH}/indices/reload`,
expect.anything()
);

find('indexTableRowCheckbox')
.at(0)
.simulate('change', { target: { checked: true } });

// Open context menu once again, since clicking an action will close it.
await actions.clickManageContextMenuButton();
// The unfreeze action should not be present anymore
expect(exists('unfreezeIndexMenuButton')).toBe(false);
});

test('should be able to force merge an index', async () => {
const { actions, exists } = testBed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1203,29 +1203,6 @@ describe('<IndexDetailsPage />', () => {
expect(testBed.routerMock.history.push).toHaveBeenCalledTimes(1);
expect(testBed.routerMock.history.push).toHaveBeenCalledWith('/indices');
});

it(`unfreezes a frozen index`, async () => {
httpRequestsMockHelpers.setLoadIndexDetailsResponse(testIndexName, {
...testIndexMock,
isFrozen: true,
});

await act(async () => {
testBed = await setup({ httpSetup });
});
testBed.component.update();

// already sent 6 requests while setting up the component
const numberOfRequests = 6;
expect(httpSetup.get).toHaveBeenCalledTimes(numberOfRequests);

await testBed.actions.contextMenu.clickManageIndexButton();
await testBed.actions.contextMenu.clickIndexAction('unfreezeIndexMenuButton');
expect(httpSetup.post).toHaveBeenCalledWith(`${API_BASE_PATH}/indices/unfreeze`, {
body: JSON.stringify({ indices: [testIndexName] }),
});
expect(httpSetup.get).toHaveBeenCalledTimes(numberOfRequests + 1);
});
});

describe('index name with a percent sign', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ describe('index table', () => {
expect(findTestSubject(rendered, 'refreshIndexMenuButton').length).toBe(0);
expect(findTestSubject(rendered, 'clearCacheIndexMenuButton').length).toBe(0);
expect(findTestSubject(rendered, 'flushIndexMenuButton').length).toBe(0);
expect(findTestSubject(rendered, 'unfreezeIndexMenuButton').length).toBe(0);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export {
UIM_INDEX_OPEN_MANY,
UIM_INDEX_REFRESH,
UIM_INDEX_REFRESH_MANY,
UIM_INDEX_UNFREEZE,
UIM_INDEX_UNFREEZE_MANY,
UIM_INDEX_SETTINGS_EDIT,
UIM_TEMPLATE_LIST_LOAD,
UIM_TEMPLATE_DELETE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export const UIM_INDEX_OPEN_MANY = 'index_open_many';
export const UIM_INDEX_REFRESH = 'index_refresh';
export const UIM_INDEX_REFRESH_MANY = 'index_refresh_many';
export const UIM_INDEX_SETTINGS_EDIT = 'index_settings_edit';
export const UIM_INDEX_UNFREEZE = 'index_unfreeze';
export const UIM_INDEX_UNFREEZE_MANY = 'index_unfreeze_many';
export const UIM_TEMPLATE_LIST_LOAD = 'template_list_load';
export const UIM_TEMPLATE_DELETE = 'template_delete';
export const UIM_TEMPLATE_DELETE_MANY = 'template_delete_many';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
forcemergeIndices as forcemergeIndicesRequest,
openIndices as openIndicesRequest,
refreshIndices as refreshIndicesRequest,
unfreezeIndices as unfreezeIndicesRequest,
} from '../../../../services';
import { notificationService } from '../../../../services/notification';
import { httpService } from '../../../../services/http';
Expand Down Expand Up @@ -162,24 +161,6 @@ export const ManageIndexButton: FunctionComponent<Props> = ({
}
}, [reloadIndices, indexNames]);

const unfreezeIndices = useCallback(async () => {
setIsLoading(true);
try {
await unfreezeIndicesRequest(indexNames);
await reloadIndices();
setIsLoading(false);
notificationService.showSuccessToast(
i18n.translate('xpack.idxMgmt.unfreezeIndicesAction.indexUnfrozenMessage', {
defaultMessage: 'The index {indexNames} was unfrozen.',
values: { indexNames: indexNames.join(', ') },
})
);
} catch (error) {
setIsLoading(false);
notificationService.showDangerToast(error.body.message);
}
}, [reloadIndices, indexNames]);

const forcemergeIndices = useCallback(
async (maxNumSegments: string) => {
setIsLoading(true);
Expand Down Expand Up @@ -251,7 +232,6 @@ export const ManageIndexButton: FunctionComponent<Props> = ({
flushIndices={flushIndices}
refreshIndices={refreshIndices}
clearCacheIndices={clearCacheIndices}
unfreezeIndices={unfreezeIndices}
forcemergeIndices={forcemergeIndices}
deleteIndices={deleteIndices}
performExtensionAction={performExtensionAction}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
refreshIndices,
performExtensionAction,
reloadIndices,
unfreezeIndices,
} from '../../../../store/actions';

import { getIndexStatusByIndexName, getIndicesByName } from '../../../../store/selectors';
Expand Down Expand Up @@ -53,9 +52,6 @@ const mapDispatchToProps = (dispatch, { indexNames }) => {
refreshIndices: () => {
dispatch(refreshIndices({ indexNames }));
},
unfreezeIndices: () => {
dispatch(unfreezeIndices({ indexNames }));
},
forcemergeIndices: (maxNumSegments) => {
dispatch(forcemergeIndices({ indexNames, maxNumSegments }));
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export interface IndexActionsContextMenuProps {
flushIndices: () => Promise<void>;
refreshIndices: () => Promise<void>;
clearCacheIndices: () => Promise<void>;
unfreezeIndices: () => Promise<void>;
forcemergeIndices: (maxNumSegments: string) => Promise<void>;
deleteIndices: () => Promise<void>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ export class IndexActionsContextMenu extends Component {
performExtensionAction,
indices,
reloadIndices,
unfreezeIndices,
indicesListURLParams,
} = this.props;
const allOpen = every(indexNames, (indexName) => {
return indexStatusByName[indexName] === INDEX_OPEN;
});
const allFrozen = every(indices, (index) => index.isFrozen);

const selectedIndexCount = indexNames.length;
const items = [];
if (isOnListView && selectedIndexCount === 1) {
Expand Down Expand Up @@ -191,18 +190,6 @@ export class IndexActionsContextMenu extends Component {
this.closePopoverAndExecute(flushIndices);
},
});
if (allFrozen) {
items.push({
'data-test-subj': 'unfreezeIndexMenuButton',
name: i18n.translate('xpack.idxMgmt.indexActionsMenu.unfreezeIndexLabel', {
defaultMessage: 'Unfreeze {selectedIndexCount, plural, one {index} other {indices} }',
values: { selectedIndexCount },
}),
onClick: () => {
this.closePopoverAndExecute(unfreezeIndices);
},
});
}
} else if (!allOpen && enableIndexActions) {
items.push({
'data-test-subj': 'openIndexMenuButton',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
UIM_INDEX_OPEN_MANY,
UIM_INDEX_REFRESH,
UIM_INDEX_REFRESH_MANY,
UIM_INDEX_UNFREEZE,
UIM_INDEX_UNFREEZE_MANY,
UIM_TEMPLATE_DELETE,
UIM_TEMPLATE_DELETE_MANY,
UIM_TEMPLATE_CREATE,
Expand Down Expand Up @@ -214,17 +212,6 @@ export async function clearCacheIndices(indices: string[]) {
return response;
}

export async function unfreezeIndices(indices: string[]) {
const body = JSON.stringify({
indices,
});
const response = await httpService.httpClient.post(`${API_BASE_PATH}/indices/unfreeze`, { body });
// Only track successful requests.
const eventName = indices.length > 1 ? UIM_INDEX_UNFREEZE_MANY : UIM_INDEX_UNFREEZE;
uiMetricService.trackMetric(METRIC_TYPE.COUNT, eventName);
return response;
}

export async function loadIndexSettings(indexName: string) {
const response = await httpService.httpClient.get(
`${API_BASE_PATH}/settings/${encodeURIComponent(indexName)}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export {
flushIndices,
forcemergeIndices,
clearCacheIndices,
unfreezeIndices,
loadIndexSettings,
updateIndexSettings,
loadIndexStats,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export * from './forcemerge_indices';
export * from './load_indices';
export * from './open_indices';
export * from './refresh_indices';
export * from './unfreeze_indices';
export * from './reload_indices';
export * from './table_state';
export * from './extension_action';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { registerOpenRoute } from './register_open_route';
import { registerRefreshRoute } from './register_refresh_route';
import { registerReloadRoute } from './register_reload_route';
import { registerDeleteRoute } from './register_delete_route';
import { registerUnfreezeRoute } from './register_unfreeze_route';
import { registerGetRoute } from './register_get_route';
import { registerCreateRoute } from './register_create_route';

Expand All @@ -30,7 +29,6 @@ export function registerIndicesRoutes(dependencies: RouteDependencies) {
registerRefreshRoute(dependencies);
registerReloadRoute(dependencies);
registerDeleteRoute(dependencies);
registerUnfreezeRoute(dependencies);
registerGetRoute(dependencies);
registerCreateRoute(dependencies);
}

This file was deleted.

0 comments on commit d7d3c64

Please sign in to comment.