@@ -1050,6 +1050,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
10501050volatile WalSnd * walsnd = & WalSndCtl -> walsnds [i ];
10511051char sent_location [MAXFNAMELEN ];
10521052XLogRecPtr sentPtr ;
1053+ WalSndState state ;
10531054Datum values [PG_STAT_GET_WAL_SENDERS_COLS ];
10541055bool nulls [PG_STAT_GET_WAL_SENDERS_COLS ];
10551056
@@ -1058,14 +1059,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
10581059
10591060SpinLockAcquire (& walsnd -> mutex );
10601061sentPtr = walsnd -> sentPtr ;
1062+ state = walsnd -> state ;
10611063SpinLockRelease (& walsnd -> mutex );
10621064
10631065snprintf (sent_location ,sizeof (sent_location ),"%X/%X" ,
10641066sentPtr .xlogid ,sentPtr .xrecoff );
10651067
10661068memset (nulls ,0 ,sizeof (nulls ));
10671069values [0 ]= Int32GetDatum (walsnd -> pid );
1068- values [1 ]= CStringGetTextDatum (WalSndGetStateString (walsnd -> state ));
1070+ values [1 ]= CStringGetTextDatum (WalSndGetStateString (state ));
10691071values [2 ]= CStringGetTextDatum (sent_location );
10701072
10711073tuplestore_putvalues (tupstore ,tupdesc ,values ,nulls );