Atomic mission-fill for kiosk registration (fixes overfill race)
- dev/migrations/001-innodb.sql: convert pqs_queue + pqs_mission to InnoDB. - includes/queue.php: pqs_enqueue_player() seats a player in the next open mission (creating one if needed), serialized with GET_LOCK and wrapped in a transaction; capacity judged by real COUNT(*), numplayers rewritten from it so the counter self-heals and can't drift. - callsign.php: normal registration path now calls pqs_enqueue_player instead of the non-atomic read-check-insert. Verified on the local stack: 140 concurrent registrations -> 24 missions, zero overfill, zero counter drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- Migration 001: convert the two mission-fill tables to InnoDB.
|
||||
--
|
||||
-- Why: the atomic enqueue (see includes/queue.php) wraps the capacity-check +
|
||||
-- seat-take in a transaction so the two writes commit or roll back as a unit.
|
||||
-- MyISAM silently ignores transactions, so these must be InnoDB. The rest of
|
||||
-- the schema is left as-is.
|
||||
--
|
||||
-- Safe and reversible; run once against the pqs database:
|
||||
-- mysql -u pqs -ppqs pqs < dev/migrations/001-innodb.sql
|
||||
|
||||
ALTER TABLE pqs_mission ENGINE=InnoDB;
|
||||
ALTER TABLE pqs_queue ENGINE=InnoDB;
|
||||
Reference in New Issue
Block a user