DB load balancing/configuration code needs to be able to support sharing a primary (write) connection while separate read connection configured
From our rollout plan &6160 (closed) in "Phase 3: Serve CI reads from CI standby cluster" we need to be able to configure an extra ci
connection in our config/database.yml
. The problem is that once you configure a separate ci
section it will create new write connections as well as read connections. We want the write connections to continue going to the same main
host as we will not have finished the migration by this point.
It's not enough to simply use the same host
for ci
as main
because this will still instantiate a separate DB connection. Even though this connection is writing to the same place there are still problems that could arise if there are transactions that write across those 2 different connections.
In order to ship less risky changes to production and make smaller iterations we want to be able to ship a change that only impacts our read connections and not solve all the possible transaction related problems at the same time.
As such we need our DB connection for main
and ci
to be shared when they point to the same host. This could be an extension of the DB configuration logic that can detect you are using the same host and therefore provide you with a shared connection or there may be some other hacky way to accomplish this.
This is likely blocked by the rest of the load balancing changes to support multiple databases.