public inbox for [email protected]
help / color / mirror / Atom feedFrom: Bertrand Drouvot <[email protected]>
To: [email protected]
Subject: Fix comments related to pending statistics
Date: Tue, 10 Dec 2024 14:16:14 +0000
Message-ID: <[email protected]> (raw)
Hi hackers,
while working on [1], I came across 2 comments in pgstat.h that I think are
not correct.
1. One linked to PgStat_TableCounts pending stats, mentioning the use of
memcmp() against zeroes to detect whether there are any stats updates to apply.
This is not true anymore as of 07e9e28b56.
2. One linked to PgStat_FunctionCounts pending stats, mentioning the use of
memcmp() against zeroes to detect whether there are any pending stats: I think
it has never been the case.
Please find attached a patch to fix those comments.
[1]: https://www.postgresql.org/message-id/flat/ZlGYokUIlERemvpB%40ip-10-97-1-34.eu-west-3.compute.intern...
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachments:
[text/x-diff] v1-0001-Fix-comments-related-to-pending-statistics.patch (1.9K, ../[email protected]/2-v1-0001-Fix-comments-related-to-pending-statistics.patch)
download | inline diff:
From a7a026fa0f183bf4d66d85ea05463b69422d20a8 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <[email protected]>
Date: Tue, 10 Dec 2024 12:11:35 +0000
Subject: [PATCH v1] Fix comments related to pending statistics
The comment linked to the PgStat_TableCounts pending stats mentioning the use of
memcmp() against zeroes to detect whether there are any stats updates to apply
is not true anymore as of 07e9e28b56.
The one linked to memcmp() usage for the PgStat_FunctionCounts pending stats has
probably never been correct.
---
src/include/pgstat.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
100.0% src/include/
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 59c28b4aca..795e45653e 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -128,8 +128,8 @@ typedef int64 PgStat_Counter;
/* ----------
* PgStat_FunctionCounts The actual per-function counts kept by a backend
*
- * This struct should contain only actual event counters, because we memcmp
- * it against zeroes to detect whether there are any pending stats.
+ * This struct should contain only actual event counters, because pending stats
+ * always has non-zero content.
*
* Note that the time counters are in instr_time format here. We convert to
* microseconds in PgStat_Counter format when flushing out pending statistics.
@@ -172,8 +172,9 @@ typedef struct PgStat_BackendSubEntry
/* ----------
* PgStat_TableCounts The actual per-table counts kept by a backend
*
- * This struct should contain only actual event counters, because we memcmp
- * it against zeroes to detect whether there are any stats updates to apply.
+ * This struct should contain only actual event counters, because we make use
+ * of pg_memory_is_all_zeros() to detect whether there are any stats updates to
+ * apply.
* It is a component of PgStat_TableStatus (within-backend state).
*
* Note: for a table, tuples_returned is the number of tuples successfully
--
2.34.1
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Fix comments related to pending statistics
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox