Fix disable_prepared_statements clobbering pool size

What does this MR do?

In gitlab-com/gl-infra/production#5238 (comment 637008856) we found the pool size reverted back to 5. It turns out that disable_prepared_statements was using a cached value.

This fixes to use the actual db config right before we make another establish_connection

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

Remove pool from your config/database.yml. Setup load_balancing in config/database.yml.

development:
  host: ...
  # ...
  load_balancing:
    hosts:
      - <same as hosts>
      - <same as hosts>

Test out the main connection's pool size with:

ActiveRecord::Base.connection.pool.stat

Conformity

Availability and Testing

-->

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Thong Kuah

Merge request reports

Loading