Restore advisory lock to prevent deadlock in hive_posts updates
The previous commit removed the advisory lock (777) between votes and posts flush operations, reasoning that they update disjoint columns. However, CI testing revealed this causes deadlocks: psycopg2.errors.DeadlockDetected: deadlock detected DETAIL: Process 581 waits for ShareLock on transaction 71798; blocked by process 579. Process 579 waits for ShareLock on transaction 71796; blocked by process 581. CONTEXT: while updating tuple (74,28) in relation "hive_posts" While the columns are disjoint, both operations acquire row-level locks on the same rows in hive_posts. When the same post receives both a vote and a payout operation in the same batch, the two parallel transactions can acquire locks in different orders, causing deadlock. The advisory lock ensures serialization and prevents this deadlock scenario.🤖 Generated with [Claude Code](https://claude.com/claude-code ) Co-Authored-By:Claude <noreply@anthropic.com>
Loading
Please sign in to comment