pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgbf@twiska.com, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masao.fujii@oss.nttdata.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: min_safe_lsn column in pg_replication_slots view
Date: Fri, 10 Jul 2020 19:40:37 -0400
Message-ID: <20200710234037.GA24580@alvherre.pgsql> (raw)
In-Reply-To: <20200709222004.GA10331@alvherre.pgsql>

On 2020-Jul-09, Alvaro Herrera wrote:

> I think we should define InvalidXLogSegNo to be ~((uint64)0) and add a
> macro to test for that.

That's overkill really.  I just used zero.  Running
contrib/test_decoding under valgrind, this now passes.

I think I'd rather do away with the compare to zero, and initialize to
something else in GetWALAvailability, though.  What we're doing seems
unclean and unclear.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

0001-fix-uninitialized-value.patch (text/x-diff, 1.0K) download From 07546b71190b27433e673ff7d248e0f98215abb1 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera <alvherre@alvh.no-ip.org> Date: Fri, 10 Jul 2020 11:27:55 -0400 Subject: [PATCH] fix uninitialized value --- src/backend/access/transam/xlog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 28daf72a50..3d828cc56f 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -9530,6 +9530,7 @@ GetWALAvailability(XLogRecPtr targetLSN) * considering wal_keep_segments and max_slot_wal_keep_size */ XLByteToSeg(targetLSN, targetSeg, wal_segment_size); + oldestSlotSeg = 0; KeepLogSeg(currpos, &oldestSlotSeg); /* @@ -9624,7 +9625,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo) } /* don't delete WAL segments newer than the calculated segment */ - if (XLogRecPtrIsInvalid(*logSegNo) || segno < *logSegNo) + if (*logSegNo == 0 || segno < *logSegNo) *logSegNo = segno; } -- 2.20.1

view thread (72+ messages)  latest in thread

Message-ID: <20200710234037.GA24580@alvherre.pgsql>
Permalink:  ../20200710234037.GA24580@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200710234037.GA24580@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, tgl@sss.pgh.pa.us, horikyota.ntt@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: min_safe_lsn column in pg_replication_slots view
  In-Reply-To: <20200710234037.GA24580@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox