Skip to content

Ignore jh database in db rake task like embedding database

What does this MR do and why?

This is a minor patch for MR: !133566 (merged)

We just found it needs ignore the jh database in db rake task like embedding, otherwise JH pipeline job will failed(here: https://jihulab.com/gitlab-cn/gitlab/-/jobs/11349642).

The error is like below:

jh: == [advisory_lock_connection] object_id: 42044740, pg_backend_pid: 1847
jh: == [advisory_lock_connection] object_id: 42044740, pg_backend_pid: 1847
rake aborted!
Cannot set `SharedModel` to connection from `jh` since this connection does not include `:gitlab_shared` schema.
/builds/gitlab-cn/gitlab/lib/gitlab/database/shared_model.rb:28:in `using_connection'
/builds/gitlab-cn/gitlab/lib/gitlab/database/each_database.rb:74:in `with_shared_connection'
/builds/gitlab-cn/gitlab/lib/gitlab/database/each_database.rb:68:in `with_model_connection'
/builds/gitlab-cn/gitlab/lib/gitlab/database/each_database.rb:31:in `block in each_model_connection'
/builds/gitlab-cn/gitlab/vendor/ruby/3.0.0/gems/set-1.0.2/lib/set.rb:511:in `each_key'
/builds/gitlab-cn/gitlab/vendor/ruby/3.0.0/gems/set-1.0.2/lib/set.rb:511:in `each'
/builds/gitlab-cn/gitlab/lib/gitlab/database/each_database.rb:25:in `each_model_connection'
/builds/gitlab-cn/gitlab/lib/gitlab/database/partitioning.rb:36:in `sync_partitions'
/builds/gitlab-cn/gitlab/lib/tasks/gitlab/db.rake:182:in `block (5 levels) in <main>'
/builds/gitlab-cn/gitlab/vendor/ruby/3.0.0/gems/sentry-ruby-5.12.0/lib/sentry/rake.rb:26:in `execute'
/builds/gitlab-cn/gitlab/lib/tasks/gitlab/db.rake:199:in `block (4 levels) in <main>'
/builds/gitlab-cn/gitlab/vendor/ruby/3.0.0/gems/sentry-ruby-5.12.0/lib/sentry/rake.rb:26:in `execute'
/builds/gitlab-cn/gitlab/lib/tasks/gitlab/db.rake:462:in `block (4 levels) in <main>'
/builds/gitlab-cn/gitlab/lib/tasks/gitlab/db.rake:451:in `each'
/builds/gitlab-cn/gitlab/lib/tasks/gitlab/db.rake:451:in `block (3 levels) in <main>'

Merge request reports