New to Kestra?
Use blueprints to kickstart your first workflows.
Detect a MySQL server running with InnoDB redo logging off, re-enable it behind a dry-run and approval gate, then re-read the status variable to prove it.
ALTER INSTANCE DISABLE INNODB REDO_LOG exists to make a bulk load faster. It is meant to be switched back on the moment the load finishes. Left off, the server runs with no crash recovery at all. An unclean shutdown loses committed transactions. The server will not even restart cleanly in that state. Nothing warns you, because every query and every commit behaves normally right up until the power cuts. This guard reads the Innodb_redo_log_enabled status variable, turns redo logging back on behind a gate, then proves crash recovery is really back.
This blueprint was created by zkasuran.
ALTER INSTANCE ENABLE INNODB REDO_LOG is the only write it can issue, so it has no path to disabling redo logging on a healthy server. That is why it is safe to leave on a schedule.dry_run is true and auto_remediate is false, so a plain run reports what it found.auto_remediate is true and dry_run is false. Even then it waits for a human to resume the Pause with approved set true. An unanswered gate reads as not approved.ON.detect (io.kestra.plugin.jdbc.mysql.Query) reads Innodb_redo_log_enabled from performance_schema.global_status. OFF means redo logging is disabled.compute (io.kestra.plugin.core.output.OutputValues) turns that into a finding count. A server with no such status variable predates MySQL 8.0.21, cannot disable redo logging at all, so it reports zero findings rather than a false positive.log_status (io.kestra.plugin.core.log.Log) records the observed value, the finding count and the mode.have_finding (io.kestra.plugin.core.flow.If) ends with a clean log when redo logging is on. Otherwise alert_redo_disabled posts to Slack in every mode, including dry run.mode (io.kestra.plugin.core.flow.If) enters remediation only when auto_remediate is true and dry_run is false. Otherwise report_only logs what would run.approval_gate (io.kestra.plugin.core.flow.Pause) holds the run for a human. Re-enabling redo logging makes the next checkpoint flush pages that were never logged, so an operator picks the moment.remediate_enable runs ALTER INSTANCE ENABLE INNODB REDO_LOG with allowFailure: true, so a refused statement does not short circuit the gate.reverify re-reads the same status variable. verify_result fails the run through io.kestra.plugin.core.execution.Fail when it is not ON, then report_unprotected_window posts the fix plus the window that stays unprotected.ON after the change.INNODB_REDO_LOG_ENABLE has its ALTER INSTANCE refused, which the re-read catches instead of the run reporting success.MySQL will not tell you that redo logging is off. There is no warning in the error log after the initial statement, no alert, nothing in a normal health check. Kestra adds what is missing. It reads the status variable on a schedule, gates the fix behind dry run and human approval, re-reads the variable so a hopeful fix becomes a verified one, raises the finding in Slack even after the fix because the unprotected window is itself the news.
Run on Kestra 2.0.5 against MySQL 8.0.46, with ALTER INSTANCE DISABLE INNODB REDO_LOG used to create the degraded state and the mysql client used to confirm the status variable before and after every run.
SHOW GLOBAL STATUS LIKE 'Innodb_redo_log_enabled' taken from the mysql client at the same moment.OFF before and after.ON and the mysql client agreed.SELECT on performance_schema but not INNODB_REDO_LOG_ENABLE, the ALTER INSTANCE was refused, allowFailure let the run continue, the re-read still said OFF and the run failed rather than reporting success.errors block.MySQL 8.0.21 or newer reachable over JDBC. The connecting user needs SELECT on performance_schema to read the status variable, plus the INNODB_REDO_LOG_ENABLE privilege to turn redo logging back on. A read-only user still runs the detector.
MYSQL_USERNAME: MySQL user, read when use_secret_auth is true.MYSQL_PASSWORD: password for that user.SLACK_WEBHOOK_URL: used by the alerts and the errors block.SECRET_.| Name | Type | Default | Description |
|---|---|---|---|
mysql_url |
STRING | jdbc:mysql://localhost:3306/ |
JDBC URL of the MySQL server to guard. |
use_secret_auth |
BOOL | true |
Read credentials from secrets. Set false only for inline test credentials. |
mysql_username |
STRING | root |
Username used only when use_secret_auth is false. |
mysql_password |
STRING | `` | Password used only when use_secret_auth is false. |
dry_run |
BOOL | true |
Report without turning redo logging back on. |
auto_remediate |
BOOL | false |
Run the ALTER INSTANCE behind the approval gate when dry_run is false. |
MYSQL_USERNAME, MYSQL_PASSWORD and SLACK_WEBHOOK_URL as namespace secrets.mysql_url pointed at the server. The default dry run tells you whether crash recovery is on.OFF, run again with dry_run false and auto_remediate true, then resume the paused execution with approved true.Pause for a staging server where the checkpoint flush cost does not matter, keeping the dry-run gate.Innodb_redo_log_read_only to catch a server that came up in a read-only redo state.ALTER INSTANCE.