Skip to content

Fix database name lost from connection config

Thong Kuah requested to merge fix-lb-names into master

What does this MR do?

When the config/database.yml is using a three-tier config with main:, fix a place where we call establish_connection, and lose the database name. This ~bug was first found in !68232 (comment 652631254)

Screenshots or Screencasts (strongly suggested)

How to setup and validate locally (strongly suggested)

  1. Setup the config/database.yml to have three-tier style config. It should already be setup so with GDK [1] - if not, run make gitlab/config/database.yml to regenerate it.
  2. Run rails console
  3. ActiveRecord::Base.connection.pool.db_config.name should return main now.

[1] Here's my config for example:

development:
  main:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_development
    host: /Users/tkuah/code/ee-gdk/postgresql
    port: 5432
    pool: 10
    prepared_statements: false
    variables:
      statement_timeout: 120s

test: &test
  main:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_test
    host: /Users/tkuah/code/ee-gdk/postgresql
    port: 5432
    pool: 10
    prepared_statements: false
    variables:
      statement_timeout: 120s

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by Thong Kuah

Merge request reports

Loading