Skip to content

Link created records with repository ID in SetAuthoritativeReplica

SetAuthoritativeReplica marks a given replica of a repository as the latest version. This enables an administrator to accept data loss and make the repository available again if all of the up to date replicas are gone. 14.3 is introducing repository IDs to Praefect. In order to allow us to make a migration to link all existing records in 14.4 via the repository ID, 14.3 should create all records with repository ID in place to avoid any issues with concurrent creations running with the migration. SetAuthoritativeReplica is currently not doing that and would cause problems if it was ran concurrently with the migration. This commit updates the method to link the 'storage_repositories' entries it may create via the repository ID to the corresponding 'repositories' table record. This was missed earlier as there was no test case that exercised the part of the code that created new records. This commit includes a test for the functionality.

Related to #3485 (closed)

Merge request reports