Error executing action `run` on resource 'rails_migration[gitlab-rails]'

Hi

The upgrade from gitlab-ee amd64 17.1.1-ee.0 to gitlab-ee amd64 17.2.1-ee.0 failed with
an error running gitlab-ctl reconfigure

rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash_hide_env[migrat
e gitlab-rails database] (gitlab::database_migrations line 20) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit
with [0], but received 1

Somewhere I have read that 17.3.1 will address this. Now I cannot upgrade to 17.3.1 because apt gives the error: Please run sudo gitlab-ctl reconfigure to fix it and try again.

Then I tried: gitlab-rake db:migrate
Which gave:
main: == [advisory_lock_connection] object_id: 57140, pg_backend_pid: 3668939
main: == 20240709014000 FixSequenceOwnersForCiBuilds: migrating =====================
main: – select_all(" SELECT s.relname AS seq_name,\n t.relname AS table_name,\n a.attname AS column_name\n FROM pg_class s\n JOIN pg_depend d ON d.objid = s.oid\n AND d.classid = ‘pg_class’::regclass\n AND d.refclassid = ‘pg_class’::regclass\n JOIN pg_catalog.pg_class t ON t.oid = d.refobjid\n JOIN pg_catalog.pg_namespace n ON n.oid = t.relnamespace\n JOIN pg_catalog.pg_attribute a ON a.attrelid = t.oid\n AND a.attnum = d.refobjsubid\n WHERE s.relkind = ‘S’\n AND (t.relname = ‘ci_builds’\n OR t.relname = ‘p_ci_builds’);\n")
main: → 0.0908s
main: == [advisory_lock_connection] object_id: 57140, pg_backend_pid: 3668939
rake aborted!

My questions:

  • Can I run sudo gitlab-ctl reconfigure but without migration?
  • What is the issue with the db:migration? Is it related to this KeyError: key not found: “geo_repository_created_events_id_seq”
  • Can I undo the failed upgrade to 17.2.1 and restore the clean 17.1.1?

Thank you for your help
Stefan

I could manage to do the following sql command on the db:
SELECT s.relname AS seq_name,t.relname AS table_name,a.attname AS column_name FROM pg_class s
JOIN pg_depend d ON d.objid = s.oid AND d.classid = ‘pg_class’::regclass AND d.refclassid = ‘pg_class’::regclass
JOIN pg_catalog.pg_class t ON t.oid = d.refobjid
JOIN pg_catalog.pg_namespace n ON n.oid = t.relnamespace
JOIN pg_catalog.pg_attribute a ON a.attrelid = t.oid AND a.attnum = d.refobjsubid
WHERE s.relkind = ‘S’ AND (t.relname = ‘ci_builds’ OR t.relname = ‘p_ci_builds’)

which gives:
seq_name | table_name | comumn_name
--------------------------------------±------------±--------------
geo_repository_created_events_id_seq | p_ci_builds | allow_failure
ci_builds_id_seq | p_ci_builds | id
(2 rows)

Why should this sql give the error?