Wrong variable type in KeepLogSeg

Started by Kyotaro Horiguchiover 9 years ago5 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36136
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 28, 2026 at 08:07 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t36136_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t36136_1 && git checkout t36136_1

Patchset v1 (message #1) is on t36136_1

Jump to latest
#1Kyotaro Horiguchi
horikyota.ntt@gmail.com

Hello, I found a variable definition with wrong type
specification in KeepLogSeg, which doesn't harm anything.

static void
KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
{
...
/* then check whether slots limit removal further */
if (max_replication_slots > 0 && keep != InvalidXLogRecPtr)
{
XLogRecPtr slotSegNo;

XLByteToSeg(keep, slotSegNo);

slotSegNo should be a XLogSegNo. Both types share the same
intrinsic type so it doesn't harm anything.

This is back-patchable upto 9.4.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

Attachments:

t36136_1
KeepLogSeg_wrongtype.patchtext/x-patch; charset=us-asciiDownload+1-1
#2Michael Paquier
michael@paquier.xyz
In reply to: Kyotaro Horiguchi (#1)
Re: Wrong variable type in KeepLogSeg

On Tue, Feb 28, 2017 at 11:17 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:

slotSegNo should be a XLogSegNo. Both types share the same
intrinsic type so it doesn't harm anything.

Nice catch!
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Michael Paquier (#2)
Re: Wrong variable type in KeepLogSeg

At Tue, 28 Feb 2017 12:17:07 +0900, Michael Paquier <michael.paquier@gmail.com> wrote in <CAB7nPqQvBPno0wJe1rK3tFB_m1VNEPX4fV6dOZmddAfMV+KB0Q@mail.gmail.com>

On Tue, Feb 28, 2017 at 11:17 AM, Kyotaro HORIGUCHI
<horiguchi.kyotaro@lab.ntt.co.jp> wrote:

slotSegNo should be a XLogSegNo. Both types share the same
intrinsic type so it doesn't harm anything.

Nice catch!

Thanks!

--
Kyotaro Horiguchi
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Magnus Hagander
magnus@hagander.net
In reply to: Kyotaro Horiguchi (#1)
Re: Wrong variable type in KeepLogSeg

On Tue, Feb 28, 2017 at 3:17 AM, Kyotaro HORIGUCHI <
horiguchi.kyotaro@lab.ntt.co.jp> wrote:

Hello, I found a variable definition with wrong type
specification in KeepLogSeg, which doesn't harm anything.

static void
KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
{
...
/* then check whether slots limit removal further */
if (max_replication_slots > 0 && keep != InvalidXLogRecPtr)
{
XLogRecPtr slotSegNo;

XLByteToSeg(keep, slotSegNo);

slotSegNo should be a XLogSegNo. Both types share the same
intrinsic type so it doesn't harm anything.

This is back-patchable upto 9.4.

Nice catch. Applied and backpatched.

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#5Kyotaro Horiguchi
horikyota.ntt@gmail.com
In reply to: Magnus Hagander (#4)
Re: Wrong variable type in KeepLogSeg

At Tue, 28 Feb 2017 12:21:01 +0100, Magnus Hagander <magnus@hagander.net> wrote in <CABUevExG87_5PsnB9cdg+LEkEUMC2_Gm6d_twrTmUbSnsFX+0A@mail.gmail.com>
magnus> > Hello, I found a variable definition with wrong type
magnus> > specification in KeepLogSeg, which doesn't harm anything.
magnus>
magnus> Nice catch. Applied and backpatched.

Thank you for committing.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers