Skip to content

Commit 7d88bb7

Browse files
committed
Add some temporary instrumentation to pgstat.c.
Log main-loop blocking events and the results of inquiry messages. This is to get some clarity as to what's happening on those Windows buildfarm members that still don't like the latch-ified stats collector. This bulks up the postmaster log a tad, so I won't leave it in place for long.
1 parent b834713 commit 7d88bb7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,7 +3107,12 @@ PgstatCollectorMain(int argc, char *argv[])
31073107
* satisfied by existing file.
31083108
*/
31093109
if (last_statwrite < last_statrequest)
3110+
{
3111+
elog(LOG, "pgstat: writing new stats file");
31103112
pgstat_write_statsfile(false);
3113+
}
3114+
3115+
elog(LOG, "pgstat: attempting recv()");
31113116

31123117
/*
31133118
* Try to receive and process a message. This will not block,
@@ -3124,6 +3129,9 @@ PgstatCollectorMain(int argc, char *argv[])
31243129
errmsg("could not read statistics message: %m")));
31253130
}
31263131

3132+
elog(LOG, "pgstat: received msg type %d len %d",
3133+
msg.msg_hdr.m_type, len);
3134+
31273135
/*
31283136
* We ignore messages that are smaller than our common header
31293137
*/
@@ -3218,12 +3226,16 @@ PgstatCollectorMain(int argc, char *argv[])
32183226
}
32193227
} /* end of inner message-processing loop */
32203228

3229+
elog(LOG, "pgstat: waiting");
3230+
32213231
/* Sleep until there's something to do */
32223232
wr = WaitLatchOrSocket(&pgStatLatch,
32233233
WL_LATCH_SET | WL_POSTMASTER_DEATH | WL_SOCKET_READABLE,
32243234
pgStatSock,
32253235
-1L);
32263236

3237+
elog(LOG, "pgstat: wait result 0x%x", wr);
3238+
32273239
/*
32283240
* Emergency bailout if postmaster has died. This is to avoid the
32293241
* necessity for manual cleanup of all postmaster children.
@@ -4006,7 +4018,15 @@ static void
40064018
pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
40074019
{
40084020
if (msg->inquiry_time > last_statrequest)
4021+
{
40094022
last_statrequest = msg->inquiry_time;
4023+
if (last_statwrite < last_statrequest)
4024+
elog(LOG, "pgstat: received new inquiry message");
4025+
else
4026+
elog(LOG, "pgstat: received stale inquiry message");
4027+
}
4028+
else
4029+
elog(LOG, "pgstat: received out-of-order inquiry message");
40104030
}
40114031

40124032

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy