fix(backup): make read-only quiesce work on MySQL/older-MariaDB containers (+ --db-check)#2
Merged
Conversation
db_exec captured stderr to /dev/null, so a failed `SET GLOBAL read_only=ON` only logged "did not take effect" with no cause. Capture stderr into _DB_LAST_ERR and log it in db_lock_mysql's fallback branch so the actual MariaDB error (privilege, auth, etc.) is visible for diagnosis. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reports DB detection + whether the read-only quiesce engages (current user, version, prior/after read_only, SET errors), then exits without imaging. Briefly toggles read_only and restores it. Zero downtime; reusable for diagnosing why a backup falls back to STOP_DOCKER. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The container branch of db_exec hardcoded the `mariadb` client. MySQL and older MariaDB images ship only `mysql`, so `docker exec ... mariadb` failed with 'executable not found' and the read-only quiesce silently no-op'd — causing a fallback to STOP_DOCKER (downtime). Now tries mariadb then mysql, mirroring the native branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Document the container mysql-client fallback fix and the new --db-check diagnostic mode across CHANGELOG (1.10.0 Fixed/Added), README options, AGENTS.md troubleshooting, and pi2s3.com/llms.txt. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #1. The new zero-downtime read-only quiesce silently failed on a live MySQL 8 container and fell back to
STOP_DOCKER, causing real site downtime. Root-caused and fixed, with a diagnostic to prevent recurrence.Root cause
db_exec's Docker path hardcoded themariadbclient. MySQL images (and MariaDB < 10.5) ship onlymysql, sodocker exec … mariadbfailed with "executable not found", the quiesce silently no-op'd, verification sawread_only=0, and the backup fell back to stopping all containers.Fixes
db_execnow triesmariadbthenmysqlfor the Docker path, mirroring the native branch.db_execcaptures stderr into_DB_LAST_ERR(was/dev/null);db_lock_mysqllogs the real error on fallback.--db-checkmode — reports engine/location, connecting user, version, and whetherread_onlyactually engages (toggles + restores it, no imaging, zero downtime).Verified on the live Pi (MySQL 8.0.46 container)
--db-check→mariadb: executable file not found→ RESULT FAILED.read_only 0 → 1 → restored→ RESULT OK.--forcebackup: loggedREAD-ONLY — SET GLOBAL read_only=ON active, no STOP_DOCKER fallback, all 11 containers stayed up, site responding throughout.shellcheck -xclean;bash -npasses.🤖 Generated with Claude Code