wal: WAL position and what keeps it
Where WAL is, how much sys_wal holds, and what keeps it: settings, slots, archiving.
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. Nothing was injected. Values belong to this capture only.
Usage
No options of its own. Connection options are the same as for sessions.
Primary
positionis the current write position and its WAL file.sys_walis the same size as onspace: same probe, same columns.what keeps WAL hereputs on one screen what you would otherwise assemble from three commands: the parameters (max_wal_size,wal_keep_segmentsas its size), each replication slot with the WAL it retains and whether it is active, and the archive backlog. Here the slot retains 0 bytes and is active, but 38.readyfiles wait for archiving (the lab’s archiving is failing, seearchive).- It shows and does not repeat the judgment. An inactive slot is reported by
kbdiag slotsand a failing archive bykbdiag archive; this screen only points there. The same problem reported in three commands would look like three problems. - The WAL generation rate needs two samples over time; a single query cannot give it, so this version does not.
Standby
On a standby position is the replay position (there is no write position, and no WAL file name). This standby has no slots of its own, and nothing waits for archiving.
Exit codes
| Code | Meaning |
|---|---|
| 0 | OK |
| 3 | UNKNOWN: data not collected or not visible |
| 64 | Usage error |
| 69 | Cannot connect |