Skip to content

replication: Cleanup replication queue

Pavlo Strokov requested to merge ps-rm-cancelled-state-enum into master

When replication job processing is completed, we acknowledge the event. If processing is successful the state of the event is changed to 'completed', for failed processing attempts the state becomes 'failed' and if event processing failed max amount of attempts it changes to 'dead'. In current implementation to reduce amount of rows in the replication_queue table the events that are going to be moved into 'completed' or 'dead' state not updated but removed from the table. This change aligns this behaviour to AcknowledgeStale method that was not removing 'dead' events from the table, but only updated their status.

The change also drops state 'cancelled'. The state 'cancelled' is not used in the production code and the database should not contain any replication jobs with 'cancelled' state in the replication_queue table. As the state is not used it makes no sense to support it. This change removes it from the code and deletes rows in the replication_queue in that state (it is safe as praefect has no use case for them). We can't drop it from the REPLICATION_JOB_STATE type as we should support compatibility between versions. The REPLICATION_JOB_STATE type should be cleaned up in the next release version.

Part of: #3859 (closed)

Edited by Pavlo Strokov

Merge request reports