praefect: Support object pool disconnection in Praefect replicator
When a secondary repository replica in Praefect is out of sync with the
primary replica, Praefect creates a replication job that performs the
ReplicateRepository
RPC to replicate the up-to-date primary onto the
secondary. As part of this operation the replicator also checks if the
source repository is linked to an object pool and if so links the target
to the matching object pool on the secondary.
If the primary is not linked to an object pool and the secondary is
linked to an object pool, no change is made to the target repository
object pool relationship and the replication job continues normally.
This is problematic because it allows secondary repositories to diverge
from the primary. Also if the repository attempts to link to a new
object pool via the LinkRepositoryToObjectPool
RPC, the secondary
repositories will always fail due to already being linked to an object
pool.
To prevent this from occurring, the target repository should also
perform the DisconnectGitAlternates
RPC if it is determined that the
source repository is not linked to an object pool. This change updates
the Praefect replicator to perform object pool disconnects to ensure the
target repository remains consistent with the source.
Related: #5679 (closed)