Skip to content

Extend invalid metadata deletion logic to repos existin on target

Sami Hiltunen requested to merge smh-extend-invalid-source-repository into master

Praefect contains logic to delete metadata record of a non-existent source repository during replication. Praefect checks for the ErrInvalidSourceRepository error, and if it receives it, it deletes the metadata record of the source repository. Right now, the error is only returned from ReplicateRepository if the source repository didn't exist when the target is creating the repository for the first time. This means Praefect's clean up logic doesn't run if the target already has the repository on the disk but the source repository doesn't exist. This can lead to reconciliation loops where Praefect keeps trying to replicate from the non-existent source repository over and over again as all of the replications fail. This commit changes ReplicateRepository to return the error when the source doesn't exist but the target repository does.

This logic was initially implemented to break the reonciliation loops that occurred due to Praefect creating invalid metadata records when a repository creation failed. As DeleteObjectPool RPC was not handled as a repository deleting RPC in Praefect, the metadata records were left in place which is currently causing reconciliation loops. Changing the error return allows for Praefect to clean up those invalid metadata records. In the long run, Praefect's background metadata verifier would capture such issues and this logic could be removed.

Closes #4083 (closed)

Merge request reports