Files
core/bible-local/decisions/2026-03-01-mysql-tx-cursor-safety.md
Michael Chus c5d253a9df Add shared bible submodule, rename local bible to bible-local
- Add bible.git as submodule at bible/
- Rename bible/ → bible-local/ (project-specific architecture)
- Update CLAUDE.md to reference both bible/ and bible-local/
- Add AGENTS.md for Codex with same structure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 16:37:10 +03:00

1005 B

2026-03-01 - MySQL Tx Cursor Safety In Recompute/Rebuild Flows

  • Date: 2026-03-01
  • Decision:
    • In transactional MySQL/MariaDB code, prohibit nested SQL calls on the same tx while iterating an open cursor (for rows.Next()).
    • Use a mandatory two-phase approach: read all rows -> close cursor -> execute follow-up reads/writes.
  • Context:
    • History recompute/rebuild jobs produced persistent driver failures:
      • [mysql] invalid connection
      • unexpected EOF
      • driver: bad connection
    • DB logs showed repeated aborted client connections (Got an error reading communication packets).
    • Root cause pattern was SQL execution on the same transaction while a result cursor was still active.
  • Consequences:
    • Recompute/rebuild code paths must be audited and kept cursor-safe.
    • Future projection rebuild and repair flows must follow two-phase read/write design by default.
    • Runtime invariant documented in bible/architecture/runtime-flows.md.
  • Supersedes:
    • None.