Files
PQS/dev/migrations/001-innodb.sql
T
CydandClaude Opus 4.8 df04ab4eb7 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>
2026-07-01 13:40:44 -05:00

13 lines
536 B
SQL

-- 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;