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 1jlGNH-0007Zb-Jn for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2020 18:31:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jlGNF-0007Cq-96 for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2020 18:31:53 +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 1jlGNE-0007Cj-Tv for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2020 18:31:53 +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 1jlGNA-0000ma-9O for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2020 18:31:52 +0000 Received: by mail-qk1-x744.google.com with SMTP id w3so20154709qkb.6 for ; Tue, 16 Jun 2020 11:31:47 -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=CDLoCTPd5bs1MtO8rM20spW5NbOuBEIYpikDwJ6TggQ=; b=mk8xlCuGYbcomzIJwPjkRyqe4nEJWPSiyd0dkr//2UtTyGr14LU5NWbevS82aX54cc TXpf3dD09RhgEA0ZpEKjeTfrRTMHYVdB1cco5+zH1tLfGFMjaYYa/a3B7yPKAeUSr1Q7 N41v2syPkl63u5DHhkHb4krxtU/pRv6ippS6pmzvQJh2gsfdZPqcGoM+dPd/jqa+oKR/ 4bUomC3sDh4BhDNQUrQHKPittrtrbBtWgM7Sd9wu+FrGeEkNqt3GmK914sppA6RTTh4x 8E8FvraUuNF2EXkO4xSuj9ec+7UPwCW+9eToTgV3z05k+Jy6Ysgzz6nJMapjkiLTFOWJ sX5A== 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=CDLoCTPd5bs1MtO8rM20spW5NbOuBEIYpikDwJ6TggQ=; b=nIN9GwYR/PoYTReiOOp1lQjaoM4Ys2INnvAq4uMqVbEsV+i441Gob7inlFvCdtYEjW 9yXBb50hTjavO4BCxRCo38KOI8tBqsPpEQeD5gRkL7YDw8sHmbW9ALsYFQ11QlQbg39/ BLbQjB7lb82N1U2N12YCwJlhLXWezGWhN+/4+nPJwY/uBVKaLS2vtD+LLiXSYr7N/fxJ R6mlsoHZ6aB28uAofC5XHQou4FAVbz5bWXdexkEiABbcOnnm3BDevF9vUG/AtXSUu5uW ahbq66WMhgUJv2hKbHWYNb/KQW+EwLp8nzr9aWaoMRQRNaQeQ9ms+6JU6xhwEBNPZhL+ v8Xg== X-Gm-Message-State: AOAM530DKtdBYJyjnMKwIXX7Dqen6K/2r3wRuE5tPS2eA81r56gKIE+p wVvXwJk2Cja8TBYSMjFmy88ihg== X-Google-Smtp-Source: ABdhPJz8yTxVOhmLawXYjvPrYdRyzuMSo8QyxCO4Ue9YI76S1z0UxxQIaH2WDDiaF2KoQ/WCh5EFMA== X-Received: by 2002:a05:620a:12f8:: with SMTP id f24mr1294307qkl.18.1592332306283; Tue, 16 Jun 2020 11:31:46 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id n25sm14223274qkk.76.2020.06.16.11.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2020 11:31:45 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 6D3E42A3ACF; Tue, 16 Jun 2020 14:31:43 -0400 (-04) Date: Tue, 16 Jun 2020 14:31:43 -0400 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org Subject: Re: Review for GetWALAvailability() Message-ID: <20200616183143.GA18116@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200616.120236.1809496990963386593.horikyota.ntt@gmail.com> 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-Jun-16, Kyotaro Horiguchi wrote: > I noticed the another issue. If some required WALs are removed, the > slot will be "invalidated", that is, restart_lsn is set to invalid > value. As the result we hardly see the "lost" state. > > It can be "fixed" by remembering the validity of a slot separately > from restart_lsn. Is that worth doing? We discussed this before. I agree it would be better to do this in some way, but I fear that if we do it naively, some code might exist that reads the LSN without realizing that it needs to check the validity flag first. On the other hand, maybe this is not a problem in practice, because if such a bug occurs, what will happen is that trying to read WAL from such a slot will return the error message that the WAL file cannot be found. Maybe this is acceptable? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services