Ensure redundant Pipelines are cancelled in id ascending order
What does this MR do and why?
This MR switches the ORDER id
direction when we query cancellable redundant Pipelines.
Until now we've been cancelling the oldest first, and the CancelPipelineService also cancels the root first and downstream after.
But does the behavior change?
In practice, no, because Ci::Pipeline.id_in
returns Pipelines in the order determined by Postgres under the hood, which happens to be in id ascending order. But we shouldn't rely on this, so I added the logic and a test to ensure they stay that way.
If you want to see the test fail, the simplest way would be to change order_id_asc
to order_id_desc
to mimic a database that returns records in a different way.
Query Performance
is exactly the same!
Original: https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/31079/commands/96494
Updated: https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/31079/commands/96493
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.