Skip to content

Removal of the replication events

Pavlo Strokov requested to merge ps-clean-queue-on-repo-removal into master

To make replication_queue, replication_queue_lock and replication_queue_job_lock tables more consistent and self-managed we create a foreign key constraints with cascade removal once repository is removed from the repositories table. As we can't create foreign keys on the fields of the JSONB column we flatten JSONB schema and add a corresponding set on new columns to the replication_queue. The migration populates those with the data from the job column and also we remove any inconsistent data that might disallow constraints creation. The trigger is used to populate new columns with data on insert operation if the old version of praefect inserts any new rows.
We also create a trigger on repository removal to remove row from the replication_queue_lock table otherwise it will remain in place without any reason.
Because of all those new limitations some of the tests were fixed or refactored to respect new constraints.
The remove-repository sub-command was also changed as we don't need to explicitly remove rows from the replication_queue table anymore.
And finally a new set of columns is now used to work with replication events instead of old job column.

Closes: #3974 (closed)

Edited by Pavlo Strokov

Merge request reports