-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ZDT] add aliases when creating the index (#179792)
## Summary Fix #179783 Create the aliases during initial index creation, instead of doing it in a later stage. This avoids an additional roundtrip with ES during project creation. **Before:** ``` INIT -> CREATE_TARGET_INDEX -> UPDATE_ALIASES -> INDEX_STATE_UPDATE_DONE -> DONE ``` **After:** ``` INIT -> CREATE_TARGET_INDEX -> INDEX_STATE_UPDATE_DONE -> DONE ```
- Loading branch information
1 parent
6ecbe53
commit 8b95195
Showing
14 changed files
with
129 additions
and
81 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
...-objects-migration-server-internal/src/zdt/model/stages/create_target_index.test.mocks.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...s/core-saved-objects-migration-server-internal/src/zdt/utils/get_creation_aliases.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { getCreationAliases } from './get_creation_aliases'; | ||
|
||
describe('getCreationAliases', () => { | ||
it('returns the correct list of alias', () => { | ||
const aliases = getCreationAliases({ indexPrefix: '.kibana', kibanaVersion: '8.13.0' }); | ||
expect(aliases).toEqual(['.kibana', '.kibana_8.13.0']); | ||
}); | ||
|
||
it('returns the correct version alias', () => { | ||
const aliases = getCreationAliases({ indexPrefix: '.kibana', kibanaVersion: '8.17.2' }); | ||
expect(aliases).toEqual(['.kibana', '.kibana_8.17.2']); | ||
}); | ||
}); |
24 changes: 24 additions & 0 deletions
24
...bjects/core-saved-objects-migration-server-internal/src/zdt/utils/get_creation_aliases.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
interface GetAliasActionOpts { | ||
indexPrefix: string; | ||
kibanaVersion: string; | ||
} | ||
|
||
/** | ||
* Build the list of alias actions to perform, depending on the current state of the cluster. | ||
*/ | ||
export const getCreationAliases = ({ | ||
indexPrefix, | ||
kibanaVersion, | ||
}: GetAliasActionOpts): string[] => { | ||
const globalAlias = indexPrefix; | ||
const versionAlias = `${indexPrefix}_${kibanaVersion}`; | ||
return [globalAlias, versionAlias]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters