Code review for commit 05a7be935.
commit24ff700f6aee2e8b915399e03934c6fe9b593d3f
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 26 Jan 2023 17:51:00 +0000 (26 12:51 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 26 Jan 2023 17:51:00 +0000 (26 12:51 -0500)
tree5fd5773096417c1c51487dc3fd5120cf23b023c7
parente35bb9f1582d3c2885de65a60d6b296877c7ed0e
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
src/backend/replication/walreceiver.c
src/include/datatype/timestamp.h
src/include/utils/timestamp.h