Files
unleash/src
Gastón Fournier 1bebbafece fix: make client registration writes resilient to deadlocks (#12619)
## About the changes

Concurrent registration flushes can acquire overlapping application and
instance row locks in different orders, causing deadlocks. A failed
flush also discards its buffered registrations.

Sort bulk writes by their conflict keys and coalesce application
observations by `app_name`, keeping the greatest `seen_at` within each
batch. Keep the original applications-first order: commit applications
and their usage rows together, then persist instance heartbeats
separately. Sorting addresses lock ordering; swapping these calls has no
demonstrated deadlock-prevention benefit.

Restore failed batches while preserving newer registrations received
during persistence. Correct application `lastSeen` mapping to the
persisted `seen_at` column and type the database row mappings.

Fixes #11390. Consistent ordering addresses opposite-order batch
deadlocks; it does not eliminate ordinary lock waits or reduce write
volume.

## OSS PR checklist

- [x] I have read and agree to the [Unleash Contributor License
Agreement](https://github.com/Unleash/unleash/blob/main/CLA.md).
- [x] I have added tests or explained why tests are not needed.
- [x] I have updated documentation where relevant. No configuration or
schema changes require documentation updates.
2026-09-09 12:01:42 +02:00
..