-
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
Use PiT for outdated document search #98797
Use PiT for outdated document search #98797
Conversation
* index for backup purposes, but won't be available in the upgraded index. | ||
*/ | ||
unusedTypesQuery: Option.Option<estypes.QueryContainer>, | ||
query: estypes.QueryContainer | undefined, |
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.
It's always defined, so I removed the Option
container
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.
Should we update the readWithPit
description?
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.
It's always defined
Why the | undefined
then? For testing purposes?
Was the comment meant for reindex
, L586, where you changed from Option.Option<estypes.QueryContainer>
to estypes.QueryContainer
?
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.
Why the | undefined then? For testing purposes?
Was the comment meant for reindex, L586, where you changed from Option.Option<estypes.QueryContainer> to estypes.QueryContainer?
yes for both
|
||
export type FatalState = BaseState & { |
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.
it improves TS performance
@@ -997,6 +1008,8 @@ interface SearchForOutdatedDocumentsOptions { | |||
* Search for outdated saved object documents with the provided query. Will | |||
* return one batch of documents. Searching should be repeated until no more | |||
* outdated documents can be found. | |||
* | |||
* Used for testing only |
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.
we can move it to testing tools in a follow-up
Actions.readWithPit( | ||
client, | ||
state.pitId, | ||
state.outdatedDocumentsQuery, |
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.
it doesn't use unusedTypesQuery
because target index
already contains filtered SO types
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.
Code review only: Implementation looks solid and the logic flow makes sense.
I left a few comments and questions but these shouldn't hold up the PR.
LGTM
* index for backup purposes, but won't be available in the upgraded index. | ||
*/ | ||
unusedTypesQuery: Option.Option<estypes.QueryContainer>, | ||
query: estypes.QueryContainer | undefined, |
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.
Should we update the readWithPit
description?
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.
LGTM
* index for backup purposes, but won't be available in the upgraded index. | ||
*/ | ||
unusedTypesQuery: Option.Option<estypes.QueryContainer>, | ||
query: estypes.QueryContainer | undefined, |
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.
It's always defined
Why the | undefined
then? For testing purposes?
Was the comment meant for reindex
, L586, where you changed from Option.Option<estypes.QueryContainer>
to estypes.QueryContainer
?
const readWithPitTask = readWithPit( | ||
client, | ||
pitResponse.right.pitId, | ||
{ | ||
match: { title: { query: 'doc' } }, | ||
}, | ||
1000, | ||
undefined, | ||
true | ||
); |
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.
We may want to switch to an object argument the next time we touch this code, argument list is hard to follow without seing the signature (undefined, true
). For consistency, we may even want to do that for all actions
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.
src/core/server/saved_objects/migrationsv2/integration_tests/actions.test.ts
Outdated
Show resolved
Hide resolved
expect.not.objectContaining({ | ||
_seq_no: expect.any(Number), | ||
_primary_term: expect.any(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.
NIT: Test will pass if _seq_no
or _primary_term
exist but it not a number. I would rather test for property existence here. OTOH, by the ES spec, these properties are numbers, so it's probably fine as it is.
// contains migrated index with 8.0 aliases to skip migration, but run outdated doc search | ||
dataArchive: Path.join(__dirname, 'archives', '8.0.0_migrated_with_outdated_docs.zip'), |
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.
with 8.0 aliases
We'll probably need to disable this test in the 7.x
branch, as I think it will fail because the alias points to an higher version of Kibana?
But I don't see any other option to test such scenario on master
.
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.
discussed offline: it's okay to skip the test on 7.x
branch to reduce the maintenance cost of different fixtures for 8 and 7.x branches
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
* use PiT for OUTDATED_DOCUEMENT_SEARCH step * update tests * fix typo * fix so migrations unit tests * TEMP: use wait_for when transformin docs * add a step to refresh target index if transformed outdated docs * add unit tests * refresh before searching outdated docs * add integration test for outdated docs migration * add a step to refresh target index if transformed outdated docs * make query required * address comments
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* Use PiT for outdated document search (#98797) * use PiT for OUTDATED_DOCUEMENT_SEARCH step * update tests * fix typo * fix so migrations unit tests * TEMP: use wait_for when transformin docs * add a step to refresh target index if transformed outdated docs * add unit tests * refresh before searching outdated docs * add integration test for outdated docs migration * add a step to refresh target index if transformed outdated docs * make query required * address comments * skip test Co-authored-by: Mikhail Shustov <restrry@gmail.com>
Summary
Part of #90279
PR adds PiT usage when searching for outdated docs. I removed
refresh: wait_for
to reduce reindex overhead. Instead, Kibana does manualrefresh
after all the docs were transformed (for both index migration and outdated documents migration).Checklist
Delete any items that are not applicable to this PR.