sapling/eden/mononoke/mercurial
Mark Thomas 080f455000 mutationstore: insert mutation info in a stable order
Summary:
When inserting multiple rows using `INSERT IGNORE`, it's possible to hit
deadlocks if two competing transactions insert the same rows in a different
order.

This can be triggered in the mutation store if two clients are pushing
overlapping sets of commits, and the arbitrary changeset order from the
`HashSet` gives the commits in a different order.  For example the first
transaction might be inserting "A, B, C", be holding the lock on row A, and be
waiting for the lock on row C, meanwhile another transaction is inserting "C,
D, A", holding the lock on row C, and waiting for the lock on row A.

To avoid these deadlocks, always insert the mutation changesets in a stable
order (sorted by changeset hash or successor hash).

Reviewed By: krallin

Differential Revision: D22067338

fbshipit-source-id: aa54c8a9c0cac4e4ae35855b44e759f8b6cb4f59
2020-06-16 10:33:41 -07:00
..
bundles rustfmt: Use use_try_shorthand default 2020-06-10 19:29:15 -07:00
mutation mutationstore: insert mutation info in a stable order 2020-06-16 10:33:41 -07:00
revlog autocargo: regenerate 2020-05-19 16:08:40 -07:00
types mononoke: rename comments() to message() 2020-06-11 01:24:47 -07:00