Skip to content
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

[Upgrade Assistant] Update logic for handling reindex failures #124571

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
)}
{(hasFetchFailed || hasReindexingFailed) && (
<>
<EuiSpacer />
<EuiCallOut
color="danger"
iconType="alert"
Expand All @@ -130,6 +129,7 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
>
{reindexState.errorMessage}
</EuiCallOut>
<EuiSpacer />
</>
)}
<EuiText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,8 @@ export const reindexServiceFactory = (
// Do any other cleanup work necessary
reindexOp = await cleanupChanges(reindexOp);
} else {
// Check that it reindexed all documents
const {
body: { count },
} = await esClient.count({ index: reindexOp.attributes.indexName });

if (taskResponse.task.status!.created < count) {
Copy link
Contributor Author

@alisonelizabeth alisonelizabeth Feb 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a reliable check, as the documents could end up in an updated state. This could occur if Kibana is restarted and a user resumes the reindex process in Upgrade Assistant, which actually kicks off the reindex again. As the code is here, we would actually throw an error when there was not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Check that no failures occurred
if (taskResponse.response?.failures?.length) {
// Include the entire task result in the error message. This should be guaranteed
// to be JSON-serializable since it just came back from Elasticsearch.
throw error.reindexTaskFailed(`Reindexing failed: ${JSON.stringify(taskResponse)}`);
Expand Down