pgstat-coalesce-v1.patch
binary/octet-stream
Filename: pgstat-coalesce-v1.patch
Type: binary/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v1
| File | + | − |
|---|---|---|
| src/backend/postmaster/pgstat.c | 14 | 1 |
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index da768c6..e3d4e17 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -4706,6 +4706,20 @@ pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
}
/*
+ * Ignore requests that are already resolved by the last write.
+ *
+ * We discard the queue of requests at the end of pgstat_write_statsfiles(),
+ * so the requests already waiting on the UDP socket at that moment can't
+ * be discarded in the previous loop.
+ *
+ * XXX Maybe this should also care about the clock skew, just like the
+ * block a few lines down.
+ */
+ dbentry = pgstat_get_db_entry(msg->databaseid, false);
+ if ((dbentry != NULL) && (msg->cutoff_time > dbentry->stats_timestamp))
+ return;
+
+ /*
* There's no request for this DB yet, so create one.
*/
newreq = palloc(sizeof(DBWriteRequest));
@@ -4722,7 +4736,6 @@ pgstat_recv_inquiry(PgStat_MsgInquiry *msg, int len)
* retreat in the system clock reading could otherwise cause us to neglect
* to update the stats file for a long time.
*/
- dbentry = pgstat_get_db_entry(msg->databaseid, false);
if ((dbentry != NULL) && (msg->clock_time < dbentry->stats_timestamp))
{
TimestampTz cur_ts = GetCurrentTimestamp();