Skip to content

Fixing SharedModel.connection_db_config when connection is changed

What does this MR do and why?

Simple solution to addressing: #386242 (closed)

Other possible solution as well

I was thinking of overriding connection_db_config instead of connection_pool, but then I saw this implementation of connection_db_config, and I thought we can change it on the source connection_pool

Other thoughts

I was thinking of solving it on the LoadBalancer::Setup somewhere here, so that it's also solved for any other classes. But I didn't want to complicate the solution, because we still have this bigger issue and this one

How to set up and validate locally

LooseForeignKeys::DeletedRecord.using_connection(Ci::ApplicationRecord.connection) do
  LooseForeignKeys::DeletedRecord.connection_db_config.name
end

Should return ci on this branch, which is what we expected. But it returns main on master

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #386242 (closed)

Edited by Omar Qunsul

Merge request reports