fix(database): correct statement timeout to MariaDB seconds (10s) - #26
Conversation
Review summaryThe core fix is correct. I independently confirmed the units: MariaDB's I left one non-blocking inline note on The PR description's "Note (not in this PR)" about updating the live git-ignored Nice, well-documented catch. 👍 |
c7df7fb to
471441c
Compare
Review summaryThe core units fix is correct. I re-verified independently: MariaDB's I also confirmed the scope claim in the description: MySQL's Prior thread resolved: my earlier review flagged that a 1 s fallback default was risky for a DELETE-heavy tool. That was addressed here by raising the default to Remaining, non-blocking:
Nice, well-documented catch. 👍 |
`init_command` was ported from MySQL's `MAX_EXECUTION_TIME` (milliseconds) to MariaDB's `max_statement_time` (seconds) in #16, but the numeric values were carried over unchanged, leaving the guard off by 1000x (a 1000s default and 10000s / ~2.8h in `.env.template`). MariaDB's `max_statement_time` also differs from MySQL in scope: it applies to all statements including DELETE, whereas MySQL's `max_execution_time` governed read-only SELECTs only. So this is the first time the purge DELETE batches are actually subject to the timeout. A 1s cap would abort 1000-row batch deletes on the large multi-index tables (`co_block`, `co_container`), so use 10s — headroom for the DELETE workload while still catching runaway queries: - config/database.yml default: 1000 -> 10 - .env.template TIMEOUT: 10000 -> 10 Also annotate the unit inline in both files so the ms/seconds confusion that caused this cannot silently recur. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
471441c to
42a7ec5
Compare
Review summaryThe fix is correct and I have nothing new worth changing in the diff.
Prior threads resolved: the 1 s fallback-default concern (addressed by raising the default Non-blocking, operational (already acknowledged in the description):
Nice, well-documented catch. 👍 |
Problem
config/database.ymlsets a per-connection statement timeout:In #16 this was ported from MySQL's
MAX_EXECUTION_TIME(milliseconds) to MariaDB'smax_statement_time(seconds), but the numeric values were carried over unchanged. The target DB is MariaDB 10.11.x, so the units are wrong by 1000×:config/database.ymldefault1000.env.templateTIMEOUT10000Confirmed via
git log: commit2689aa6(#16) changedSET MAX_EXECUTION_TIME→SET max_statement_timewhile keepingENV.fetch('TIMEOUT', 1000). Per the MariaDB docs,max_statement_timeis in seconds (adouble); MySQL'smax_execution_timeis the millisecond one.Scope difference (why not 1 s)
MariaDB's
max_statement_timeapplies to all statements including DELETE; MySQL'smax_execution_timeonly governed read-only SELECTs. So this fix makes the purgedelete_all/destroy_allbatches subject to the timeout for the first time — previously they were never timed out (SELECT-only on MySQL, then masked by the 1000× units on MariaDB).Because the tool's core workload is 1000-row batched deletes on large multi-index tables (
co_block,co_container~60GB), a 1 s cap could abort batches mid-purge. So both values are set to 10 s (headroom for the DELETE workload, while still catching runaway queries).Fix
config/database.ymldefault:1000→10.env.templateTIMEOUT:10000→10Follow-up (not in this PR)
The live
.envon the host is git-ignored and still hasTIMEOUT=10000(~2.8 h effective cap). Update it to10and reconnect for the guard to take effect in production. Worth confirming empirically that a batch delete comfortably fits within 10 s on the production tables before relying on it.Testing
Config-only change; no Ruby touched (Rubocop/tests N/A). YAML/ERB still renders — trivial numeric edit.
🤖 Generated with Claude Code