GitLab 13.4.0: ERROR: must be owner of extensions

Summary

I installed GitLab 13.3.7 at fresh Ubuntu 20.04 and recovered base. After that, I updated it to 13.4.0. I did the backup, recovery, and noticed that the recovery of the base got some errors. I rolled back to 13.3.7 again it had no these errors.

Also, I notice when I install fresh GitLab 13.4.0 I do the backup of fresh base and the recovery of the same base at once - the errors are here.

And I can not go on to update GitLab to the latest version.

Steps to reproduce

  1. Install fresh GitLab 13.4.0.
  2. Backup fresh base.
  3. Recover fresh base.
  4. Get errors.

Tried

  1. https://docs.gitlab.com/ee/install/postgresql_extensions.html
  2. https://docs.gitlab.com/omnibus/maintenance/#starting-a-postgresql-superuser-psql-session
  3. https://forum.gitlab.com/t/some-problem-on-gitlab-ce-13-4-0/43859

Example Project

Example Project
ok: down: puma: 1s, normally up
ok: down: sidekiq: 1s, normally up
Unpacking backup ... done
Be sure to stop Puma, Sidekiq, and any other process that
connects to the database before proceeding. For Omnibus
installs, see the following link for more information:
https://docs.gitlab.com/ee/raketasks/backup_restore.html#restore-for-omnibus-gitlab-installations

Before restoring the database, we will remove all existing
tables to avoid future upgrade problems. Be aware that if you have
custom tables in the GitLab database these tables and all data will be
removed.

Do you want to continue (yes/no)? tes
Do you want to continue (yes/no)? yes
Removing all tables. Press `Ctrl-C` within 5 seconds to abort
2020-10-12 18:03:16 +1000 -- Cleaning the database ... 
2020-10-12 18:03:20 +1000 -- done
2020-10-12 18:03:20 +1000 -- Restoring database ... 
Restoring PostgreSQL database gitlabhq_production ... ERROR:  must be owner of extension pg_trgm
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension btree_gist
ERROR:  must be owner of extension pg_trgm
SET
SET
SET
SET
SET
 set_config 
------------
 
(1 row)

SET
SET
SET
SET
ALTER TABLE

... (a little SQL) ...

ALTER TABLE
[DONE]
2020-10-12 18:05:17 +1000 -- done
2020-10-12 18:05:17 +1000 -- Restoring repositories ...
 * repo ... [DONE]
2020-10-12 18:05:18 +1000 -- done
2020-10-12 18:05:18 +1000 -- Restoring uploads ... 
2020-10-12 18:05:18 +1000 -- done
2020-10-12 18:05:18 +1000 -- Restoring builds ... 
2020-10-12 18:05:19 +1000 -- done
2020-10-12 18:05:19 +1000 -- Restoring artifacts ... 
2020-10-12 18:05:19 +1000 -- done
2020-10-12 18:05:19 +1000 -- Restoring pages ... 
2020-10-12 18:05:19 +1000 -- done
2020-10-12 18:05:19 +1000 -- Restoring lfs objects ... 
2020-10-12 18:05:19 +1000 -- done
This task will now rebuild the authorized_keys file.
You will lose any data stored in the authorized_keys file.
Do you want to continue (yes/no)? yes

Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data 
and are not included in this backup. You will need to restore these files manually.
Restore task is done.

What is the current bug behavior?

At the recovery base I get errors:

ERROR: must be owner of extension pg_trgm
ERROR: must be owner of extension btree_gist
ERROR: must be owner of extension btree_gist
ERROR: must be owner of extension pg_trgm

What is the expected correct behavior?

No errors.

Results of GitLab environment info

GitLab environment info

System information
System:		Ubuntu 20.04
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.9
Git Version:	2.28.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.4.0
Revision:	b0481767fe4
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	11.9
URL:		http://gitlab.example.com
HTTP Clone URL:	http://gitlab.example.com/some-group/some-project.git
SSH Clone URL:	git@gitlab.example.com:some-group/some-project.git
Using LDAP:	no
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.7.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

GitLab application check

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.7.0 ? ... OK (13.7.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... skipped (no tmp uploads folder yet) Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.6) Git version >= 2.24.0 ? ... yes (2.28.0) Git user has default SSH configuration? ... yes Active users: ... 2 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Edited by Kirill Kustov