mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Track walsender state in shared memory and expose in pg_stat_replication
This commit is contained in:
@@ -16,12 +16,22 @@
|
||||
#include "storage/latch.h"
|
||||
#include "storage/spin.h"
|
||||
|
||||
|
||||
typedef enum WalSndState
|
||||
{
|
||||
WALSNDSTATE_STARTUP = 0,
|
||||
WALSNDSTATE_BACKUP,
|
||||
WALSNDSTATE_CATCHUP,
|
||||
WALSNDSTATE_STREAMING
|
||||
} WalSndState;
|
||||
|
||||
/*
|
||||
* Each walsender has a WalSnd struct in shared memory.
|
||||
*/
|
||||
typedef struct WalSnd
|
||||
{
|
||||
pid_t pid; /* this walsender's process id, or 0 */
|
||||
WalSndState state; /* this walsender's state */
|
||||
XLogRecPtr sentPtr; /* WAL has been sent up to this point */
|
||||
|
||||
slock_t mutex; /* locks shared variables shown above */
|
||||
@@ -53,6 +63,7 @@ extern void WalSndSignals(void);
|
||||
extern Size WalSndShmemSize(void);
|
||||
extern void WalSndShmemInit(void);
|
||||
extern void WalSndWakeup(void);
|
||||
extern void WalSndSetState(WalSndState state);
|
||||
|
||||
extern Datum pg_stat_get_wal_senders(PG_FUNCTION_ARGS);
|
||||
|
||||
|
Reference in New Issue
Block a user