Advisory locking was added in Rails 5 to prevent unplanned concurrency errors during migration. The fix is to clear the DB lock that was left in place.
Review the locks by running this SQL against your DB:
SELECT DISTINCT age(now(), query_start) AS age, pg_stat_activity.pid,pg_locks.granted,pg_stat_activity.application_name,pg_stat_activity.backend_start, pg_stat_activity.xact_start, pg_stat_activity.state_change, pg_stat_activity.waiting, pg_stat_activity.state, pg_stat_activity.query_start, left(pg_stat_activity.query, 60)
FROM pg_stat_activity, pg_locks
WHERE pg_locks.pid = pg_stat_activity.pid
To clear a lock, run this SQL against your DB:
select pg_advisory_unlock({the pid of the lock you want to release})
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…