Skip to content

serverinfo "Replica lag" check (Slave_running) always fails on standalone (non-replica) MySQL/MariaDB servers #1170

Closed as duplicate

Description

@uthaler

Describe the bug

The database health check introduced in serverinfo (Settings → Administration → Overview → Database checks) always reports the "Replica lag" rule (Slave_lag, formula Slave_running, test value == 0) as failed on a standalone database server that was never configured for replication.

Slave_running is a MySQL/MariaDB global status variable that is OFF on ANY server not acting as a replica — this is the normal, expected state, not an error. The rule doesn't check whether the server is actually configured as a replica (e.g. via SHOW REPLICA STATUS returning a row, or read_only/gtid_slave_pos being set) before evaluating.

Source: apps/serverinfo/lib/Database/RuleSet/Mysql.php

$rules[] = new Rule(
    id: 'Slave_lag',
    name: 'Replica lag',
    category: 'Replication',
    severity: Rule::SEVERITY_ALERT,
    formula: 'Slave_running',
    test: 'value == 0',
    issue: 'A configured replica is not running.',
    recommendation: 'Check the replica with SHOW REPLICA STATUS; resolve any IO/SQL errors and restart replication.',
    justification: 'Slave_running is reporting OFF.',
    justificationFormula: '',
    requires: ['Slave_running'],
);

To Reproduce

  1. Run any standalone Nextcloud instance with a single, non-replicated MySQL/MariaDB server.
  2. Open Settings → Administration → Overview → Database checks.
  3. "Replica lag" is listed under "Failed" with "A configured replica is not running." — even though no replica was ever configured.

Expected behavior

The rule should first verify that the instance is actually configured as a replica (e.g. SHOW REPLICA STATUS returns a row) before evaluating Slave_running, and be skipped entirely otherwise — consistent with how other inapplicable rules in the same rule set are already skipped ("Skipped").

Environment

  • Nextcloud 35.0.1 (serverinfo 7.0.0) — first observed immediately after upgrading 33.0.9 → 34.0.4 → 35.0.1, so likely introduced in serverinfo 6.0.0 or 7.0.0
  • MariaDB 10.11.14
  • Confirmed via SHOW REPLICA STATUS returning zero rows (no replica configured at all)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions