repl: replication from this node
Replication from this node: each standby’s lag and the synchronous settings on a primary; receive and replay on a standby.
Captured on 2026-10-07 (UTC+08) on a local KingbaseES V008R006C009B0014 primary and standby, database test, using ~/kbdiag built from Go source commit 96c874f (static linux/amd64 binary). This is lab evidence, not production validation. The WARN example was created by a fault-injection script that pauses the standby’s WAL receiver (SIGSTOP), the same one used on the slots page. Values belong to this capture only.
Usage
No options of its own. Connection options are the same as for sessions.
Primary
syncshowssynchronous_standby_namesand what it means (any 1 of node2 must confirm),synchronous_commit, and how many standbys the server currently counts as synchronous.quorumin thesynccolumn is the server’s ownsync_state; repmgr reportsquorumhere rather thansyncorasync, so kbdiag does not translate it.downstreamsis one row per standby: the position it has been sent, flushed and replayed, as bytes behind this node’s current WAL position, the replay lag in time (empty when the standby is caught up and idle), and how long ago it last replied.- Lag is shown, not judged. There is no objective line on the server for it.
Standby
upstreamis the same WAL receiver view askbdiag status(inst.upstream), withlast_msgthe time since the last message from the primary.replaycompares what was received with what was replayed.caught up with what was receivedmeans the two positions are equal.last replayed transaction 1m 0s agois not a delay: on an idle primary it can read hours while the positions are identical, so kbdiag does not use it as a lag.pausedis whether replay was paused withsys_wal_replay_pause().
A stuck WAL receiver
With the standby’s receiver paused, the standby reports:
- The finding is
inst.upstream, the same rulekbdiag statususes: the receiver saysstreaming, butlast_msgis older thanwal_receiver_timeout(30 s in the lab). A working receiver asks the primary for a reply at half that time and reconnects when it is full, so only a stuck one gets past it. Without a receiver, or in a state other thanstreaming, the same finding fires. - The
receivedandreplayedpositions stay equal: nothing arrived, so there is nothing to replay. It is the age of the last message that shows it. - Known edge: the receiver sets its receive time at connection start, so a slow connection (more than half the timeout) or a timeline switch can raise this finding once for a moment. There is no margin on purpose, because no objective value for one exists.
The primary at the same moment:
- The standby is gone from
downstreams(0), andsynchronous_standby_namesnow reads(none: asynchronous only); it wasANY 1( node2)before the injection. Sorepl.sync_shortdid not fire. kbdiag shows what the server has; the the setting changed during the injection because repmgr changed it: withsynchronous='quorum'in repmgr.conf, repmgrd clearssynchronous_standby_namesabout 2 seconds after the standby disconnects (falling back to asynchronous commits) and restores it when the standby reconnects (seen in the lab’s hamgr.log, 2026-09-28). It is repmgr, not KingbaseES itself. So on this kind of clusterrepl.sync_shortshows only in that short window; the usual state after a standby is lost is “already asynchronous”, whichreplshows as(none: asynchronous only). - Use
slotson the primary to see the slot turned inactive, andclusterfor repmgr’s view.
WARN findings not produced in the lab
Taken from the source, not captured:
repl.replay_paused(WARN): replay is paused on a standby (sys_wal_replay_pause()). Queries still run, but it falls further behind and a failover would have to replay everything received first. ThefixisSELECT sys_wal_replay_resume()unless it was paused on purpose. It has no injection in the lab: pausing replay there blocks every commit on the primary (synchronous_commitisremote_apply).repl.sync_short(WARN):synchronous_standby_namesneeds more standbys than the server counts as synchronous candidates (syncorquorum). The text says commits either wait or the server has stopped waiting, so the synchronous copy is not guaranteed. It is a WARN rather than FAIL because in the lab, commits went through after the standby disconnected (repmgr had switched to asynchronous, see above). kbdiag counts the server’s ownsync_stateinstead of redoing the candidate rules, and it judges only whensynchronous_commitmakes commits wait for a standby (this connection’s value; per-role or per-database settings are not visible).
Exit codes
| Code | Meaning |
|---|---|
| 0 | OK |
| 1 | WARN: no WAL being received, replay paused, or too few synchronous standbys |
| 3 | UNKNOWN: data not collected or not visible |
| 64 | Usage error |
| 69 | Cannot connect |