-
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
Rewriting SO id during migration #97222
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
19b94c8
some typos
mshustov 59a3fed
implement an alternative client-side migration algorithm
mshustov 8c54a03
update tests
mshustov 2cf6d41
lol
mshustov 4afb285
remove unnecessary param from request generic
mshustov 6841668
remove unused parameter
mshustov f988f23
Merge branch 'master' into migration-id-gen
mshustov 10fdb61
Merge branch 'master' into migration-id-gen
mshustov d3a2dd1
optimize search when quierying SO for migration
mshustov be9438e
fix wrong type in fixtures
mshustov 4ebf73b
try shard_doc asc
mshustov 8983403
Merge branch 'master' into migration-id-gen
mshustov fdd18e4
Merge branch 'master' into migration-id-gen
mshustov e40c824
add an integration test
mshustov 8c03eaf
cleanup
mshustov dfdb8e8
Merge branch 'master' into migration-id-gen
mshustov 61ef354
Merge branch 'master' into migration-id-gen
mshustov 2fa72b9
Merge branch 'master' into migration-id-gen
mshustov e522a4b
track_total_hits: false to improve perf
mshustov ea3a1c4
add happy path test for transformDocs action
mshustov 3aab116
remove unused types
mshustov 0126616
fix wrong typing
mshustov aeb35cb
add cleanup phase
mshustov 9c768a9
add an integration test for cleanup phase
mshustov 8e331ce
add unit-tests for cleanup function
mshustov 5a5c309
Merge branch 'master' into migration-id-gen
mshustov 2b26a4e
Merge branch 'master' into migration-id-gen
mshustov d2dfc35
address comments
mshustov 5a2c5fe
Merge branch 'master' into migration-id-gen
mshustov 8d17ce0
Fix functional test
kertal abe3fff
Merge remote-tracking branch 'origin/migration-id-gen' into migration…
mshustov 1332961
Merge branch 'master' into migration-id-gen
mshustov a128d7b
set defaultIndex before each test. otherwise it is deleted in the fir…
mshustov 585bdd9
sourceIndex: Option.some<> for consistency
mshustov 145244a
Revert "set defaultIndex before each test. otherwise it is deleted in…
mshustov 44f7974
address comments from Pierre
mshustov 97315b6
fix test
mshustov f7b4d7d
Revert "fix test"
mshustov c6ff34b
revert min convert version back to 8.0
mshustov 94ea2cd
Merge branch 'master' into migration-id-gen
mshustov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,48 +229,6 @@ describe('KibanaMigrator', () => { | |
jest.clearAllMocks(); | ||
}); | ||
|
||
it('creates a V2 migrator that initializes a new index and migrates an existing index', async () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the implementation is tested in the integration tests |
||
const options = mockV2MigrationOptions(); | ||
const migrator = new KibanaMigrator(options); | ||
const migratorStatus = migrator.getStatus$().pipe(take(3)).toPromise(); | ||
migrator.prepareMigrations(); | ||
await migrator.runMigrations(); | ||
|
||
// Basic assertions that we're creating and reindexing the expected indices | ||
expect(options.client.indices.create).toHaveBeenCalledTimes(3); | ||
expect(options.client.indices.create.mock.calls).toEqual( | ||
expect.arrayContaining([ | ||
// LEGACY_CREATE_REINDEX_TARGET | ||
expect.arrayContaining([expect.objectContaining({ index: '.my-index_pre8.2.3_001' })]), | ||
// CREATE_REINDEX_TEMP | ||
expect.arrayContaining([ | ||
expect.objectContaining({ index: '.my-index_8.2.3_reindex_temp' }), | ||
]), | ||
// CREATE_NEW_TARGET | ||
expect.arrayContaining([expect.objectContaining({ index: 'other-index_8.2.3_001' })]), | ||
]) | ||
); | ||
// LEGACY_REINDEX | ||
expect(options.client.reindex.mock.calls[0][0]).toEqual( | ||
expect.objectContaining({ | ||
body: expect.objectContaining({ | ||
source: expect.objectContaining({ index: '.my-index' }), | ||
dest: expect.objectContaining({ index: '.my-index_pre8.2.3_001' }), | ||
}), | ||
}) | ||
); | ||
// REINDEX_SOURCE_TO_TEMP | ||
expect(options.client.reindex.mock.calls[1][0]).toEqual( | ||
expect.objectContaining({ | ||
body: expect.objectContaining({ | ||
source: expect.objectContaining({ index: '.my-index_pre8.2.3_001' }), | ||
dest: expect.objectContaining({ index: '.my-index_8.2.3_reindex_temp' }), | ||
}), | ||
}) | ||
); | ||
const { status } = await migratorStatus; | ||
return expect(status).toEqual('completed'); | ||
}); | ||
it('emits results on getMigratorResult$()', async () => { | ||
const options = mockV2MigrationOptions(); | ||
const migrator = new KibanaMigrator(options); | ||
|
@@ -378,6 +336,24 @@ const mockV2MigrationOptions = () => { | |
} as estypes.GetTaskResponse) | ||
); | ||
|
||
options.client.search = jest | ||
.fn() | ||
.mockImplementation(() => | ||
elasticsearchClientMock.createSuccessTransportRequestPromise({ hits: { hits: [] } }) | ||
); | ||
|
||
options.client.openPointInTime = jest | ||
.fn() | ||
.mockImplementationOnce(() => | ||
elasticsearchClientMock.createSuccessTransportRequestPromise({ id: 'pit_id' }) | ||
); | ||
|
||
options.client.closePointInTime = jest | ||
.fn() | ||
.mockImplementationOnce(() => | ||
elasticsearchClientMock.createSuccessTransportRequestPromise({ succeeded: true }) | ||
); | ||
|
||
return options; | ||
}; | ||
|
||
|
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
no changes in the file, a simple cleanup