pgsql: Code review for commit 05a7be935. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Code review for commit 05a7be935.
Date
Msg-id E1pL6Ow-0003Cj-GJ@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Code review for commit 05a7be935.

Avoid having walreceiver code know explicitly about the precision
and underlying datatype of TimestampTz.  (There is still one
calculation that knows that, which should be replaced with use of
TimestampDifferenceMilliseconds; but we need to figure out what to do
about overflow cases first.)

In support of this, provide a TimestampTzPlusSeconds macro, as well
as TIMESTAMP_INFINITY and TIMESTAMP_MINUS_INFINITY macros.  (We could
have used the existing DT_NOEND and DT_NOBEGIN symbols, but I judged
those too opaque and confusing.)

Move GetCurrentTimestamp calls so that it's more obvious that we
are not using stale values of "now" anyplace.  This doesn't result
in net more calls, and might indeed make for net fewer.

Avoid having a dummy value in the WalRcvWakeupReason enum, so that
we can hope for the compiler to catch overlooked switch cases.

Nathan Bossart and Tom Lane

Discussion: https://postgr.es/m/20230125235004.GA1327755@nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/24ff700f6aee2e8b915399e03934c6fe9b593d3f

Modified Files
--------------
src/backend/replication/walreceiver.c | 47 ++++++++++++++++++-----------------
src/include/datatype/timestamp.h      | 13 +++++++---
src/include/utils/timestamp.h         |  2 ++
3 files changed, 36 insertions(+), 26 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Doc: use less-awkward phrasing.
Next
From: Justin Pryzby
Date:
Subject: Re: pgsql: Adjust interaction of CREATEROLE with role properties.