Skip to content

fix(cluster): CheckPrivileges looks up the replication user for ERR00007 (#2245) - #2302

Merged
svaroqui merged 1 commit into
signal18:developfrom
RyoKusnadi:fix/check-replication-user-privileges
Nov 4, 2026
Merged

svaroqui merged 1 commit into
signal18:developfrom
RyoKusnadi:fix/check-replication-user-privileges

Conversation

@RyoKusnadi

Copy link
Copy Markdown
Contributor

Linked issue (required)

Fixes #2245

Summary

Problem: repman raises a blocking ERR00007 ("User must have REPLICATION SLAVE privilege on ...") for a replica even though the replication user has the grant and replication works.

How it happens: db-servers-credential (monitor user) and replication-credential (repl user) are different accounts, and the monitor user has no account matching a replica's address, for example monitor@'10.1.1.%' but a replica in 10.2.2.0/24. With monitoring-check-grants on (the default path), the check asks the privileges of the monitor user for that replica, finds no match, and reports "N". repl@'10.2.2.%' is never looked at.

Cause: in ServerMonitor.CheckPrivileges (cluster/srv_chk.go), the loop under "Check replication user has correct privs" passed cluster.GetDbUser() to dbhelper.GetPrivileges. The comment and the ERR00015 message both name the replication user.

Fix: pass cluster.GetRplUser(). One word. No other change, since the first check in the function (monitor user on the repman host) is meant to use the monitor user.

Scope: I checked the other GetPrivileges call in the same function; it checks the monitor user for ERR00006/8/9 and is correct. If both credentials are the same user, nothing changes.

How it was tested

New test TestCheckPrivilegesLooksUpReplicationUser in cluster/srv_chk_privileges_test.go, using sqlmock with the issue's layout (monitor account only for the repman host, repl account for 10.2.2.%).

  • Before the fix: fails, the second mysql.user query is asked for the monitor user so the expected repl lookup is never made.
  • After the fix: passes.

Commands: GOTOOLCHAIN=local go test ./cluster -run TestCheckPrivilegesLooksUpReplicationUser, gofmt -l.
Not run: the full cluster package (it crashes on develop with a concurrent map write, unrelated) and a real Docker regtest with MariaDB/MySQL.

Checklist

  • Linked an issue above with Fixes #NNNN (or Refs #NNNN for partial) — T9/T10
  • Targets develop (or a topology branch for failover/rejoin/split-brain changes) — T10/T20
  • Synced from latest origin/develop and checked no in-flight branch/PR already does this — T20
  • New config is a TOML key with an off-switch where applicable — T14/T16 (n/a, no new config)
  • New API endpoint ships with its GUI surface (no API-only features) — T6 (n/a)
  • User doc (docs.signal18.io) + technical doc (doc/implementation/) updated — T8 (n/a, bug fix)
  • Real regtest / Docker coverage for the behavior — T13 (not run; unit test with sqlmock only)
  • No unbounded buffer/queue; producer→sink buffers are bounded + drops tracked as state — T18 (n/a)

…007 (#2245)

Signed-off-by: Ryo Kusnadi <ryokusnadi@gmail.com>
@svaroqui
svaroqui merged commit c6812b0 into signal18:develop Nov 4, 2026
1 check failed
@RyoKusnadi
RyoKusnadi deleted the fix/check-replication-user-privileges branch November 5, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CheckPrivileges: ERR00007 checks db-servers-credential user instead of replication-credential

2 participants