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

[Reporting/CSV] Do not fail the job if scroll ID can not be cleared #76014

Merged
merged 3 commits into from
Sep 1, 2020

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Aug 26, 2020

Summary

Closes #75594

Release note:

  • Fixed an issue with CSV Export where a job could fail if clearing the scroll ID failed in Elasticsearch.

This PR avoids failing the CSV Reporting job if the call to clear the scroll fails. At that point, the CSV content has already been generated and is ready for export.

Reasons why Elasticsearch returns a 404 when called to clear a scroll:

If Elasticsearch can not find an active search context, it will return a 404 Not Found HTTP status code.

  • If a clear scroll action was called on a non-existent (or already cleared) scroll_id.
    • Response {"succeeded":true,"num_freed":0} is returned by Elasticsearch when a scroll is cleared .
  • The active scroll search context has been cleared by another "clear scroll" request.
  • The active scroll search context has expired.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

@elasticmachine Merge upstream

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

return callEndpoint('clearScroll', {
scrollId: [scrollId],
});
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we wrap these in a try/catch, or do:

return callEndpoint('clearScroll', { scrollId: [scrollId] }).catch((err) => {
        // Do not throw the error, as the job can still be completed successfully
        logger.warn('Scroll context can not be cleared!');
        logger.error(err);
});

Copy link
Contributor

Choose a reason for hiding this comment

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

Just a matter of code/preference. The .catch is a bit more concise whereas the try/catch is more idiomatic async/await js

Copy link
Member Author

Choose a reason for hiding this comment

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

It definitely could go either way, in which case I like to defer to the existing async style in other code in the file. In this case, async/await follows the code style in this file

@tsullivan
Copy link
Member Author

Thank @joelgriffith !

@tsullivan tsullivan merged commit ba9ad8d into elastic:master Sep 1, 2020
tsullivan added a commit to tsullivan/kibana that referenced this pull request Sep 1, 2020
…lastic#76014)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
tsullivan added a commit that referenced this pull request Sep 1, 2020
…76014) (#76402)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 2, 2020
* master: (223 commits)
  skip flaky suite (elastic#75724)
  [Reporting] Add functional test for Reports in non-default spaces (elastic#76053)
  [Enterprise Search] Fix various icons in dark mode (elastic#76430)
  skip flaky suite (elastic#76245)
  Add `auto` interval to histogram AggConfig (elastic#76001)
  [Resolver] generator uses setup_node_env (elastic#76422)
  [Ingest Manager] Support both zip & tar archives from Registry (elastic#76197)
  [Ingest Manager] Improve agent vs kibana version checks (elastic#76238)
  Manually building `KueryNode` for Fleet's routes (elastic#75693)
  remove dupe tinymath section (elastic#76093)
  Create APM issue template (elastic#76362)
  Delete unused file. (elastic#76386)
  [SECURITY_SOLUTION][ENDPOINT] Trusted Apps Create API (elastic#76178)
  [Detections Engine] Add Alert actions to the Timeline (elastic#73228)
  [Dashboard First] Library Notification (elastic#76122)
  [Maps] Add mvt support for ES doc sources  (elastic#75698)
  Add setHeaderActionMenu API to AppMountParameters (elastic#75422)
  [ML] Remove "Are you sure" from data frame analytics jobs (elastic#76214)
  [yarn] remove typings-tester, use @ts-expect-error (elastic#76341)
  [Reporting/CSV] Do not fail the job if scroll ID can not be cleared (elastic#76014)
  ...
@tsullivan tsullivan deleted the fix/75594 branch September 3, 2020 22:44
@sophiec20 sophiec20 added the (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:fix v7.10.0 v8.0.0
Projects
None yet
5 participants