mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
By default, `SELECT FOR UPDATE` will also lock any rows which are `JOIN`ed into the selected rows; in the case of UserMessage rows, this can mean arbitrary Message rows. Since the messages themselves are not being changed, it is not necessary to lock them -- and doing so may lead to deadlocks, in the case that the UserMessage row is locked for update before the Message, and some other request has already taken a read lock on the Message and is blocked on the UserMessage write lock. Change `select_for_update_query` to explicitly only lock UserMessage.
28 KiB
28 KiB