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

historyarchive: Introduce a History Archive pool that's selected from for all calls #3402

Merged
merged 10 commits into from
Feb 16, 2021

Conversation

Shaptic
Copy link
Contributor

@Shaptic Shaptic commented Feb 11, 2021

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

This is an improvement over #3375 which just chooses a random URL from the list. Instead, we should actually create a pool of all history archive connections and cycle through them randomly for each HA-related operation we need.

Why

With this change, we actually use the entire URL list in the configuration that the user provides. This adds resilience and redundancy. See stellar/horizon-internal#3 for more context.

Known limitations

n/a

@Shaptic Shaptic requested a review from a team February 11, 2021 02:57
@Shaptic Shaptic self-assigned this Feb 11, 2021
historyarchive/pool.go Outdated Show resolved Hide resolved
Copy link
Contributor

@bartekn bartekn left a comment

Choose a reason for hiding this comment

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

LGTM! I agree with @tamirms's type PooledArchive []ArchiveInterface idea, it should be easier to use from outside.

Comment on lines 1 to 4
// Copyright 2016 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need copyright comment on top of this file. At least we don't have it in most of other files. @ire-and-curses?

Suggested change
// Copyright 2016 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0

Copy link
Member

Choose a reason for hiding this comment

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

Re: copyright - let's just follow whatever we do everywhere else in the codebase.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so I was confused by this, too. In the historyarchive package, all of the files have copyright notices. The years are mixed, but all of them have one. So I added it here.

historyarchive/pool.go Outdated Show resolved Hide resolved
historyarchive/pool.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tamirms tamirms left a comment

Choose a reason for hiding this comment

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

looks great! I left just one minor comment about the constructor name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants