Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services/horizon: Lock ingestion while applying DB migrations (#4587)
Acquire ingestion lock before applying DB migrations to stop ingestion. When applying `58_add_index_by_id_optimization.sql` migration file we experienced a deadlock. It can happen when ingestion is running because ingestion by inserting or updating certain rows can acquire `RowExclusiveLock` which conflicts with other locks (like `ShareLock` when creating a new index). We lock ingestion only for `up` migrations. `down` migrations can remove key-value table which can lead to deadlocks.
- Loading branch information