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

support/db: Add timeout on horizon db ingestion statements #2570

Closed
wants to merge 1 commit into from

Conversation

tamirms
Copy link
Contributor

@tamirms tamirms commented May 8, 2020

PR Checklist

PR Structure

  • This PR has reasonably narrow scope (if not, break it down into smaller PRs).
  • This PR avoids mixing refactoring changes with feature changes (split into two PRs
    otherwise).
  • This PR's title starts with name of package that is most changed in the PR, ex.
    services/friendbot, or all or doc if the changes are broad or impact many
    packages.

Thoroughness

  • This PR adds tests for the most critical parts of the new functionality or fixes.
  • I've updated any docs (developer docs, .md
    files, etc... affected by this change). Take a look in the docs folder for a given service,
    like this one.

Release planning

  • I've updated the relevant CHANGELOG (here for Horizon) if
    needed with deprecations, added features, breaking changes, and DB schema changes.
  • I've decided if this PR requires a new major/minor version according to
    semver, or if it's mainly a patch change. The PR is targeted at the next
    release branch if it's not a patch change.

What

Add timeout on horizon db select and exec operations.

Why

Currently there is no timeout on any of the horizon DB operations. That means a postgres query which hangs indefinitely could block ingestion from progressing.

Known limitations

[N/A]

@cla-bot cla-bot bot added the cla: yes label May 8, 2020
@tamirms tamirms requested a review from a team May 8, 2020 18:28
@bartekn
Copy link
Contributor

bartekn commented May 27, 2020

I wonder if we still need it since we have #2560 now? AFAIR, adding timeout was suppose to fix issues when ingestion is starved by HTTP server but it shouldn't be a problem any longer?

@ire-and-curses
Copy link
Member

I wonder if we still need it since we have #2560 now? AFAIR, adding timeout was suppose to fix issues when ingestion is starved by HTTP server but it shouldn't be a problem any longer?

Is there any downside to a timeout? Having the possibility of these hanging forever seems worse?

@tamirms
Copy link
Contributor Author

tamirms commented May 27, 2020

I'm ok with closing the PR if that is your preference @bartekn

@bartekn
Copy link
Contributor

bartekn commented May 27, 2020

Is there any downside to a timeout? Having the possibility of these hanging forever seems worse?

It's not a problem if it's doing nothing (ex. waiting for a free connection from a pool as before #2560) but if the query actually executes but a little longer I think it's actually better to wait. With timeout it's possible that ingestion will fall into an infinite loop (slow query, timeout, slow query, timeout, ...).

I'm ok with closing the PR if that is your preference @bartekn

I think we should leave the timeout code in db.Session, just remove it from ingest. And maybe let's add other stellar/go members to review because it's a shared package.

@tamirms
Copy link
Contributor Author

tamirms commented May 28, 2020

Going to close this PR since there is no immediate use case anymore

@tamirms tamirms closed this May 28, 2020
@tamirms tamirms deleted the ingestion-db-timeout branch May 28, 2020 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants