Skip to content

Changing `max_replication_slots` doesn't reset postgresql instance after reconfigure

To /etc/gitlab/gitlab.rb, I added:

postgresql['max_replication_slots'] = 1

After running sudo gitlab-ctl reconfigure, I noticed PostgreSQL was HUP'ed but not restarted

  * template[/var/opt/gitlab/postgresql/data/postgresql.conf] action create
    - update content in file /var/opt/gitlab/postgresql/data/postgresql.conf from f2c533 to 42c4aa
    --- /var/opt/gitlab/postgresql/data/postgresql.conf 2017-05-16 22:10:36.260432779 +0000
    +++ /var/opt/gitlab/postgresql/data/.chef-postgresql.conf20170625-4141-zcsgtb       2017-06-25 21:07:49.656674991 +0000
    @@ -174,7 +174,7 @@
     max_wal_size = 1GB
     
     # The number of replication slots to reserve.
    -max_replication_slots = 0
    +max_replication_slots = 1
     
     
     # - Archiving -
  * execute[reload postgresql] action run
    - execute /opt/gitlab/bin/gitlab-ctl hup postgresql

  * template[/var/opt/gitlab/postgresql/data/runtime.conf] action create (up to date)
  * template[/var/opt/gitlab/postgresql/data/pg_hba.conf] action create (up to date)
  * template[/var/opt/gitlab/postgresql/data/pg_ident.conf] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql/log] action create (up to date)
  * directory[/opt/gitlab/sv/postgresql/log/main] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/run] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/log/run] action create (up to date)
  * template[/var/log/gitlab/postgresql/config] action create (up to date)
  * ruby_block[reload postgresql svlogd configuration] action nothing (skipped due to action :nothing)
  * file[/opt/gitlab/sv/postgresql/down] action delete (up to date)
  * directory[/opt/gitlab/sv/postgresql/control] action create (up to date)
  * template[/opt/gitlab/sv/postgresql/control/t] action create (up to date)
  * link[/opt/gitlab/init/postgresql] action create (up to date)
  * link[/opt/gitlab/service/postgresql] action create (up to date)
  * ruby_block[supervise_postgresql_sleep] action run (skipped due to not_if)
  * service[postgresql] action nothing (skipped due to action :nothing)

Upon trying to create a replication slot, I ran into the error:

$ sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -h /var/opt/gitlab/postgresql -d gitlabhq_production
psql (9.6.1)
Type "help" for help.

gitlabhq_production=# select * from pg_create_physical_replication_slot('geo_secondary');

Running sudo gitlab-ctl restart postgresql fixed it.

/cc: @ibaum