Skip to content

Pool conn config#526

Draft
aditya1702 wants to merge 13 commits intopgx-migrationfrom
pool-conn-config
Draft

Pool conn config#526
aditya1702 wants to merge 13 commits intopgx-migrationfrom
pool-conn-config

Conversation

@aditya1702
Copy link
Contributor

What

[TODO: Short statement about what is changing.]

Why

[TODO: Why this change is being made. Include any context required to understand the why.]

Known limitations

[TODO or N/A]

Issue that this PR addresses

[TODO: Attach the link to the GitHub issue or task. Include the priority of the task here in addition to the link.]

Checklist

PR Structure

  • It is not possible to break this PR down into smaller PRs.
  • This PR does not mix refactoring changes with feature changes.
  • This PR's title starts with name of package that is most changed in the PR, or all if the changes are broad or impact many packages.

Thoroughness

  • This PR adds tests for the new functionality or fixes.
  • All updated queries have been tested (refer to this check if the data set returned by the updated query is expected to be same as the original one).

Release

  • This is not a breaking change.
  • This is ready to be tested in development.
  • The new functionality is gated with a feature flag if this is not ready for production.

Replace hardcoded pool constants with Default* named constants and add
a PoolConfig struct + DefaultPoolConfig() constructor. Update
OpenDBConnectionPool and OpenDBConnectionPoolForBackfill to accept
variadic ...PoolConfig so all existing call sites continue to compile
without changes.
Parses Go duration strings (e.g. "5m", "10s") from CLI flags or
environment variables into *time.Duration ConfigKey. Follows the same
pattern as SetConfigOptionLogLevel. Includes table-driven tests covering
empty input, invalid strings, CLI args, and env vars.
Exposes --db-max-conns, --db-min-conns, --db-max-conn-lifetime, and
--db-max-conn-idle-time flags (with matching DB_* env vars) that can
be appended to any command's cfgOpts. Duration flags use the new
SetConfigOptionDuration custom setter. Defaults mirror the existing
Default* pool constants.
Adds DBMaxConns, DBMinConns, DBMaxConnLifetime, DBMaxConnIdleTime fields
to ingest.Configs. buildPoolConfig() merges non-zero values over the
defaults so zero values (unset flags) leave current behaviour unchanged.
setupDeps now passes the pool config to both OpenDBConnectionPool and
OpenDBConnectionPoolForBackfill.
Adds DBMaxConns, DBMinConns, DBMaxConnLifetime, DBMaxConnIdleTime to
serve.Configs with a BuildPoolConfig() method (exported so cmd/serve.go
can call it). initHandlerDeps and cmd/serve.go PersistentPreRunE now
pass the pool config to OpenDBConnectionPool. Same buildPoolConfig logic
as ingest: zero values leave defaults intact.
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.

1 participant