Skip to content

Draft: Investigate Rails 6.0 and Rails 6.1 native database sharding

Thong Kuah requested to merge rails-6-1-shard-one into tk-bump-rails-to-6-1

What does this MR do?

Investigation MR for #328516 (closed).

Based off tk-bump-rails-to-6-1 which is a static copy of id-bump-rails-to-6-1

To avoid namespace ID clashes, run this in the gitlabhq_development_shard_one DB:

ALTER SEQUENCE users_id_seq RESTART WITH 1000;
ALTER SEQUENCE namespaces_id_seq RESTART WITH 1000;
ALTER SEQUENCE projects_id_seq RESTART WITH 1000;
ALTER SEQUENCE issues_id_seq RESTART WITH 1000;

I used this config/database.yml

development:
  primary:
    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
  primary_replica:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_development
    host: /Users/tkuah/code/ee-gdk/postgresql-replica
    port: 5432
    pool: 10
    prepared_statements: false
    variables:
      statement_timeout: 120s
    replica: true
  shard_one:
    adapter: postgresql
    encoding: unicode
    database: gitlabhq_development_shard_one
    host: /Users/tkuah/code/ee-gdk/postgresql
    port: 5432
    pool: 10
    prepared_statements: false
    variables:
      statement_timeout: 120s

test: &test
  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

Create a route for the lost-and-found Group.

Route.create!(source_id: 2, source_type: 'Namespace', path: 'lost-and-found', name: 'lost-and-found')
Edited by Thong Kuah

Merge request reports

Loading