Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju2dN-00013p-HZ for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2020 23:40:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ju2dJ-0006Y2-RB for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2020 23:40:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ju2dJ-0006Xq-Ju for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2020 23:40:45 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ju2dF-0008Vd-SH for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2020 23:40:44 +0000 Received: by mail-qk1-x743.google.com with SMTP id e13so6984959qkg.5 for ; Fri, 10 Jul 2020 16:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hkpMO83AeACAkAZVMM11vyDsN9pUl1sStSimpZrtlkQ=; b=w7/E2RBDzlWK4FYjeqXZfQYy9fmBTDUjqU65o9fsPS1N/+LWCNYqie78qwJqrv8uhF B47O5rfMMLMms4xn7Qj79pc+PO/F/zizOchZeWUyfQB8/A+KNG9yNl4KIqgPHgHnD203 Noa0aRsE6XUiefWjOVI7a0IfHZvTOwEysavgkCNq4PVCNVZSph88U7tVmoHf28VVs/eq rUHduT9i3FZPaiTF1lzBmuro3cGLDUB43iGXMhtpNx4fkPB8SBWokVK3fG6Sifb2wLmN wdf1QSKwLMxx/VxszGFB1CfabgwIVz1rpGaibvZ4aTGNHYoPu3naZIUG7DfBjFWRF3IY W2Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hkpMO83AeACAkAZVMM11vyDsN9pUl1sStSimpZrtlkQ=; b=Ityi0teeGObeAb0u/HjgwEsEn0s4BjwXUbjmvmP7FATm6ckE2IAyM5gFI7BPE2QQSb 2t2JcgJEVu7hmGRRAekq4ce9o3N1b2/5CvFcuM8ePcujlkfeK46BhHhZhBYDgtwNy4mJ Y/ZTny5OU5JaTuNQ9HtsvdKFECI2dDZwl+yHc5pkDXh6WQoIi/hd4RT2nK+9SvbcbHSx 7xmTUukV0IGTJ1xX15S63l/UbmLjhs8VT/oYaNxEnhcwHVPEN3kyyJ0KFB3mmwr1DVeG 7SYGJLY//NuJZxBO063nmXKMJYRhFKc8nOy1X7ZFCyvj+PFmf5z3IECnzse5TkItnyas 6dDA== X-Gm-Message-State: AOAM533JAXof40t5k3ijWSSGe3mDIDZs1TbXkou49qz315KYZ8AGE4Ll 8ZiXPNSWgnKaOhdOh0fEMEHBQQ== X-Google-Smtp-Source: ABdhPJyRisBlyyVY2WRqzPoxreXt+vH1Pf+B0ZlGvra4jDaH3ToC5EMS6SA41MEAh0/kHCExBCHAlg== X-Received: by 2002:a37:c40a:: with SMTP id d10mr46523483qki.110.1594424440265; Fri, 10 Jul 2020 16:40:40 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id e23sm9009557qkl.55.2020.07.10.16.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 16:40:39 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id CEE3B2A18A6; Fri, 10 Jul 2020 19:40:37 -0400 (-04) Date: Fri, 10 Jul 2020 19:40:37 -0400 From: Alvaro Herrera To: Tom Lane Cc: pgbf@twiska.com, Kyotaro Horiguchi , masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org Subject: Re: min_safe_lsn column in pg_replication_slots view Message-ID: <20200710234037.GA24580@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="VS++wcV0S1rZb1Fb" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200709222004.GA10331@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --VS++wcV0S1rZb1Fb Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --VS++wcV0S1rZb1Fb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-fix-uninitialized-value.patch" From 07546b71190b27433e673ff7d248e0f98215abb1 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera 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 --VS++wcV0S1rZb1Fb--