-
Notifications
You must be signed in to change notification settings - Fork 503
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
services/horizon/internal: Create separate db connections for ingestion #2560
Conversation
We can probably merge it into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Added two comments but I don't have a strong opinion on any.
services/horizon/internal/init.go
Outdated
@@ -19,33 +19,70 @@ import ( | |||
"github.com/stellar/go/support/log" | |||
) | |||
|
|||
func mustInitHorizonDB(app *App) { | |||
session, err := db.Open("postgres", app.config.DatabaseURL) | |||
const maxIngestionDBConnections = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it belongs to the ingest
package. Say, we add a new routine that require an extra DB connection. Would be easier to increment it there.
services/horizon/internal/init.go
Outdated
// and another pool for ingestion. Ideally the total connections in both | ||
// pools should be bounded by HorizonDBMaxOpenConnections. But, if the ingestion | ||
// pool consumes a significant quota of HorizonDBMaxOpenConnections then we will | ||
// allow a total of HorizonDBMaxOpenConnections + maxIngestionDBConnections connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just return an error (maybe at a command validation stage in root.go
) when ingestion connections is equal/greater than max set by a user. The reason is that user may explicitly set the max number of open connections in Postgres config so these extra 2 connections won't be established (and will probably generate a bunch of errors in the log).
PR Checklist
PR Structure
otherwise).
services/friendbot
, orall
ordoc
if the changes are broad or impact manypackages.
Thoroughness
.md
files, etc... affected by this change). Take a look in the
docs
folder for a given service,like this one.
Release planning
needed with deprecations, added features, breaking changes, and DB schema changes.
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
Fixes #2018
Create separate db connections to the horizon and stellar core databases for ingestion.
Why
Known limitations
[N/A]