-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SO migration] remove v1 implementation #118000
[SO migration] remove v1 implementation #118000
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self-review
@@ -1,222 +1,504 @@ | |||
# Saved Object Migrations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old README
was about the v1 migration, so I replaced it with the one that was previously in the migrationsv2
folder.
export function disableUnknownTypeMappingFields( | ||
activeMappings: IndexMapping, | ||
sourceMappings: IndexMapping | ||
): IndexMapping { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted from migration_context.ts
, as this was the only function that is still used by v2.
export const excludeUnusedTypesQuery: estypes.QueryDslQueryContainer = { | ||
bool: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted from elastic_index.ts
, same, these were the only bits that are still used by v2.
@@ -64,10 +63,8 @@ export class KibanaMigrator { | |||
status: 'waiting_to_start', | |||
}); | |||
private readonly activeMappings: IndexMapping; | |||
// TODO migrationsV2: make private once we remove migrations v1 | |||
private readonly soMigrationsConfig: SavedObjectsMigrationConfigType; | |||
public readonly kibanaVersion: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kibanaVersion
is actually still directly accessed from the SO repository
kibana/src/core/server/saved_objects/service/lib/repository.ts
Lines 2053 to 2057 in 2e9d0c0
return getIndexForType({ | |
type, | |
defaultIndex: this._index, | |
typeRegistry: this._registry, | |
kibanaVersion: this._migrator.kibanaVersion, |
export type MigrationLogLevel = 'error' | 'info' | 'warning'; | ||
|
||
export interface MigrationLog { | ||
level: MigrationLogLevel; | ||
message: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it make sense to split the state-related types from the other types, especially as src/core/server/saved_objects/migrations/types.ts
was already present, so I created this state.ts
file.
@@ -370,10 +370,10 @@ export class SavedObjectsService | |||
}; | |||
} | |||
|
|||
public async start( | |||
{ elasticsearch, pluginsInitialized = true }: SavedObjectsStartDeps, | |||
migrationsRetryDelay?: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
migrationsRetryDelay
was only used by v1 migration
describe('Kibana index migration', () => { | ||
before(() => esDeleteAllIndices('.migrate-*')); | ||
|
||
it('Migrates an existing index that has never been migrated before', async () => { | ||
const index = '.migration-a'; | ||
const originalDocs = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This must be a very old FTR test, as it's not really using the Kibana instance and was directly manipulating the IndexMigrator
instead. As this class is no longer, I deleted the test suite, and as v2 is already properly covered in other FTR and IT tests suite, I did not add additional tests.
Pinging @elastic/kibana-core (Team:Core) |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
* remove v1 implementation * fix type * remove unused mock * expose kibanaVersion again * fix migrator mock * move KibanaMigrator out of the kibana subfolder * fix imports * moves migrationsv2 into migrations * fix test mocking
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
(backporting to 8.0 to avoid conflicts with other migration-related changes/PRs, as this doesn't impact production code) |
* remove v1 implementation * fix type * remove unused mock * expose kibanaVersion again * fix migrator mock * move KibanaMigrator out of the kibana subfolder * fix imports * moves migrationsv2 into migrations * fix test mocking Co-authored-by: Pierre Gayvallet <[email protected]>
Summary
Fix #96396
Replace #98892
src/core/server/saved_objects/migrationsv2
tosrc/core/server/saved_objects/migrations
Checklist