Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] /src/backend/access/transam/xlog.c, tiny improvements
Date: 2020-01-27 02:47:57
Message-ID: CB1EC25A-A595-420C-8DF9-A7DDB02C0470@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Jan 24, 2020, at 12:48 PM, Ranier Vilela <ranier(dot)vf(at)gmail(dot)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 replication slots 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 changes to the XLogSegNo typedef. I’m betting it was defensive programming, given the context. As such, I don’t think it would be appropriate to remove this defense in your patch.


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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2020-01-27 04:20:09 Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Previous Message Michael Paquier 2020-01-27 02:28:50 Re: Add MAIN_RELATION_CLEANUP and SECONDARY_RELATION_CLEANUP options to VACUUM