Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements - Mailing list pgsql-hackers

From Mark Dilger
Subject Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements
Date
Msg-id CB1EC25A-A595-420C-8DF9-A7DDB02C0470@enterprisedb.com
Whole thread Raw
In response to [PATCH] /src/backend/access/transam/xlog.c, tiny improvements  (Ranier Vilela <ranier.vf@gmail.com>)
Responses Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements  (Michael Paquier <michael@paquier.xyz>)
Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements  (Ranier Vilela <ranier.vf@gmail.com>)
List pgsql-hackers

> On Jan 24, 2020, at 12:48 PM, Ranier Vilela <ranier.vf@gmail.com> wrote:
>
> 3. At function KeepLogSeg (line 9357)  the test if (slotSegNo <= 0), the var slotSegNo is uint64 and not can be < 0.

There is something unusual about comparing a XLogSegNo variable in this way, but it seems to go back to 2014 when the
replicationslots were introduced in commit 858ec11858a914d4c380971985709b6d6b7dd6fc, and XLogSegNo was unsigned then,
too. Depending on how you look at it, this could be a thinko, or it could be defensive programming against future
changesto the XLogSegNo typedef.  I’m betting it was defensive programming, given the context.  As such, I don’t think
itwould be appropriate to remove this defense in your patch. 

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company






pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Add MAIN_RELATION_CLEANUP and SECONDARY_RELATION_CLEANUP optionsto VACUUM
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (andmore?)