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 1jtfvu-0003rk-QJ for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2020 23:26:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jtfvt-0000GZ-PH for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jul 2020 23:26:25 +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 1jtfuv-0004wS-4t for pgsql-hackers@lists.postgresql.org; Thu, 09 Jul 2020 23:25:25 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jtfur-0001Vm-Qp for pgsql-hackers@lists.postgresql.org; Thu, 09 Jul 2020 23:25:24 +0000 Received: by mail-qk1-x744.google.com with SMTP id 80so3578916qko.7 for ; Thu, 09 Jul 2020 16:25:21 -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=OOM1Y/BPCl30wtO8dnW+TE59Exkh26rWiZRzPUUtJxg=; b=kZXCVmxJjXpbYvuEpcTBjmqkLTNaSZXBOlCpcJWzZE8px05WESzHFw+kTAMLfbQ70b e1UZGcMMaolVu6Sy+T+tXrDu/xctiCmf52O3LbJUhCDYMMalO46QDnJgUivC4vciFotO HoYIfIaH4G/7D4+EHoEEImkTQ+bmvXaSCkTeGgCu7uUyuLPQ8KlzmrgJ46XGZWTJkNJq sLK5MRPv0i5AsjmoyqKS6RUZNxGT5OCVrFcgo2SBVNzDYH2BHtFkStQXL14f3uNMGuJ1 Gmb0r7UKeO1x60I/4hdL3U3ti9M3JHhcrwujrWymh+E2xvr+2uR33z2p3epMFKmgngKo DBlw== 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=OOM1Y/BPCl30wtO8dnW+TE59Exkh26rWiZRzPUUtJxg=; b=OwIug6oAIhstmgCktkgkygVfiuUr8tjI4Ykdval2VPpkXvIsCnbjtn8AiWY0qrFq2K Lot718r+C+w3ks0qdkpWrNB5J5P0Jatns+IyIlvhvZlYAj5zSTfDchCAwKpAIMgQdY8X wjfBY9ikTCKV3GVGatIF3Oo1+FpeJ+VNZkgKRYLmu/qHdrcgNJk2JzjXrHqh0x2IKwtv nuksGypm3TfgK/wHdSJ0R+YQmgWJS7PCB//meqGe2V27cmKzzlnNr/PIO45R6MV4sZVZ yLdw/uNtzTr0x4MGhBz0MnoaSVaDez/4t3g3aRYT+c++PdfxZCG5YJicQS18B2FhsR38 1A5g== X-Gm-Message-State: AOAM530EE54jrXWBYHOyB/Lrlsy1w+hYek1gjrhsLXa8rDMQQBbcBo3g H1dXafOxAsXIkJGlr5Mm2ukQgA== X-Google-Smtp-Source: ABdhPJzoMNFAx1eTy7XwTMTTO0qrF3sY+yzrdCjSQupxCChD2E+9VrBHm1xZglwTVZie8hnR9EWLUg== X-Received: by 2002:a37:8905:: with SMTP id l5mr62775403qkd.302.1594337119836; Thu, 09 Jul 2020 16:25:19 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id u22sm5712308qtb.23.2020.07.09.16.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 16:25:17 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C5BD12A2496; Thu, 9 Jul 2020 18:20:04 -0400 (-04) Date: Thu, 9 Jul 2020 18:20:04 -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: <20200709222004.GA10331@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2008607.1594331766@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jul-09, Tom Lane wrote: > and even the most cursory look at the code confirms that there's a > real bug here. KeepLogSeg expects *logSegNo to be defined on entry, > but GetWALAvailability hasn't bothered to initialize oldestSlotSeg. > It is not clear to me which one is in the wrong; the comment for > KeepLogSeg isn't particularly clear on this. Oh, so I introduced the bug when I removed the initialization in this fix. That one was using the wrong datatype, but evidently it achieved the right effect. And KeepLogSeg is using the wrong datatype Invalid macro also. I think we should define InvalidXLogSegNo to be ~((uint64)0) and add a macro to test for that. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services