Ensure ClickHouse migration locks are cleared after migration failures

GitLab Infrastructure Service - incident.io
2026-03-26T10:48:46Z

When a ClickHouse migration fails due to an error (such as a network timeout), the exclusive lease is not cleared, causing subsequent migration attempts to be blocked until the lease expires. Update the migration and lease handling logic to ensure the lock is released if a migration fails, so that future migrations are not unnecessarily delayed.

_This ticket was created from_ [_INC-8725_](https://app.incident.io/gitlab/incidents/8725) _using_ [_incident.io_](https://app.incident.io) 🔥