walsender states

The different states reported by the walsender

The walsender reports five different walsender states:

  • startup
  • backup
  • catchup
  • streaming
  • stopping

which are displayed in e.g. pg_stat_replication.

See src/backend/replication/walsender.c:

/*
 * Return a string constant representing the state. This is used
 * in system views, and should *not* be translated.
 */
static const char *
WalSndGetStateString(WalSndState state)
{
	switch (state)
	{
		case WALSNDSTATE_STARTUP:
			return "startup";
		case WALSNDSTATE_BACKUP:
			return "backup";
		case WALSNDSTATE_CATCHUP:
			return "catchup";
		case WALSNDSTATE_STREAMING:
			return "streaming";
		case WALSNDSTATE_STOPPING:
			return "stopping";
	}
	return "UNKNOWN";
}

Change history

WALSNDSTATE_STOPPING was added to PostgreSQL 9.4 and later as part of bugfix commit 1cdc0ab9.

Categories

PostgreSQL internals, Replication