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 regression: reports always retrying regardless of outcome #26995

Merged
merged 5 commits into from
Dec 12, 2018
Merged

Reporting regression: reports always retrying regardless of outcome #26995

merged 5 commits into from
Dec 12, 2018

Conversation

joelgriffith
Copy link
Contributor

Summary

I've been experiencing a recent regression, where, reports are continuously retrying regardless of status. Upon further investigation it appears that our queries for outstanding jobs were returning jobs of all statuses. This PR fixes the underlying issue (which appears to be that should doesn't necessarily need to match in order to return). I'm not sure why this wasn't an issue prior, perhaps a bugfix that landed in ES or its deps.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

@@ -353,6 +353,7 @@ export class Worker extends events.EventEmitter {
constant_score: {
filter: {
bool: {
minimum_should_match: 1,
Copy link
Member

Choose a reason for hiding this comment

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

We want a query that's equivalent of

jobtype == this.jobtype &&
  (status == "pending" ||
    (status == "processing" && process_expiration <= nowTime))

I'd recommend trying to do this without using constant_score. Can we try:

{
  query: {
    bool: {
      filter: {
        bool: {
          must: { term: { jobtype: this.jobtype } },
          should: [
            { term: { status: 'pending' } },
            {
              bool: {
                must: [
                  { term: { status: 'processing' } },
                  { range: { process_expiration: { lte: nowTime } } }
                ]
              }
            }
          ]
        }
      }
    }
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dope! I still needed the minimum_should_match: 1 in order for this to work, just an FYI

Copy link
Member

Choose a reason for hiding this comment

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

With further digging, I find that adding minimum_should_match: 1 was perhaps the only change needed.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@joelgriffith joelgriffith added review (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead v6.0.0 v6.6.0 and removed v6.0.0 labels Dec 12, 2018
@tsullivan
Copy link
Member

I believe after this PR goes in, we can revert the changes to reporting tests in #26877

Copy link
Member

@tsullivan tsullivan left a comment

Choose a reason for hiding this comment

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

LGTM

@joelgriffith joelgriffith merged commit 93e3a4c into elastic:master Dec 12, 2018
@tsullivan
Copy link
Member

I got word that the change in ES around this was elastic/elasticsearch#35354

joelgriffith added a commit that referenced this pull request Dec 12, 2018
…26995) (#27082)

* This fixes an issue where reports are always retried regardless of status
@tsullivan
Copy link
Member

6.x/6.6.0: #27082

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead review v6.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants