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 1jnsW5-0003Ks-8e for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jun 2020 23:39: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 1jnsW4-0005yE-3L for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Jun 2020 23:39:48 +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 1jnsW3-0005y7-SX for pgsql-hackers@lists.postgresql.org; Tue, 23 Jun 2020 23:39:47 +0000 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jnsVz-00081T-JT for pgsql-hackers@postgresql.org; Tue, 23 Jun 2020 23:39:47 +0000 Received: by mail-qv1-xf43.google.com with SMTP id d12so261322qvn.0 for ; Tue, 23 Jun 2020 16:39:43 -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=E9Uc+OGTwj9m1LxlBVpgAq2Dv8sFhaWE87+vLXDXCfA=; b=Mygmq/rgTblmuIQpbXmgf+dcYmgvFfW9a5UumSFRw0OXxR1mDnPHdUZLRO6DwRGbA+ SnFljYWu1UBetjnrGkcBAW/KNRfnvH0l7gbJH7Kug32ttZVB93THZjbKDEsinEUya1v4 dD8dx8BF51qlA+2WRxeN+9MPGLK3dWeoBzaBrylg1Scx9eNHIGYEdFjPu3xAncAzCjfJ Mf+hGs1LBE2B90+i8lXenHGF2Cs5ZIsVm5/Hd+AxNMAeCe/ByxwcCut/t6sx9M7ZIAcE pUXkdJJjoQntNrTMgtFAAZzceVFnVEQwdBtENQSVC8BOugOSZQAkcnwhVP0IPncYCHQB stJw== 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=E9Uc+OGTwj9m1LxlBVpgAq2Dv8sFhaWE87+vLXDXCfA=; b=GqmiTXJZOWG7BrdAHkWgaXQ3x8XJSC8XtV335tgwzoLTGTgC7hHrLCSm3g9JuRMW7U x7uNCQJ+vA4dr520Pq+4IyGO7gVkM33dlS8WjQ2ZSQGdLU7e8jFxDkfgvBmwZ5M+XeL9 50pxMQO0LNvrB6luqqbPyh6mYsYiVDqt+Kqh82ufh5aPq0pkKaq9Ttv3cF208WRZxYp4 TmNZUqWJmmzFIPKrxwXUq3BuFn66/Gp8nTY5qWkmersRpiiZGADMXS9+aAeMVwEpWL4n 4bxka2dcALOYO5St8ccoWlaSkxJtmweC+C9R7OPNPTCJ0FRmj39KRRhVxXV+cKbTi0Gc uCyA== X-Gm-Message-State: AOAM530bBMivQxMi45V02Egn0nOq9vWLvpuHr7O42ol8GjtEk0V/v/eK efG9HoGMyhzwSqUzbS6bVjhuBw== X-Google-Smtp-Source: ABdhPJzT9Xw6ucpkKdk5rQjf4/KsZFCPWd754p+NsX+oUMq6rd7pKD4xnLAy6QXbqZ+up/4oGO91oA== X-Received: by 2002:a05:6214:b23:: with SMTP id w3mr29020142qvj.63.1592955581289; Tue, 23 Jun 2020 16:39:41 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id c27sm2009759qka.23.2020.06.23.16.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 16:39:40 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 229AB2A3A10; Tue, 23 Jun 2020 19:39:38 -0400 (-04) Date: Tue, 23 Jun 2020 19:39:38 -0400 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: amit.kapila16@gmail.com, masao.fujii@oss.nttdata.com, michael@paquier.xyz, pgsql-hackers@postgresql.org Subject: Re: min_safe_lsn column in pg_replication_slots view Message-ID: <20200623233938.GA5975@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200623.170814.1011513743846543414.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-23, Kyotaro Horiguchi wrote: > At Tue, 23 Jun 2020 11:50:34 +0530, Amit Kapila wrote in > > On Mon, Jun 22, 2020 at 6:32 PM Fujii Masao wrote: > > > We should expose the LSN calculated from > > > "the current WAL LSN - max(wal_keep_segments * 16MB, max_slot_wal_keep_size)"? > > > This indicates the minimum LSN of WAL files that are guaraneed to be > > > currently retained by wal_keep_segments and max_slot_wal_keep_size. > > > That is, if checkpoint occurs when restart_lsn of replication slot is > > > smaller than that minimum LSN, some required WAL files may be removed. > > > > > > So DBAs can periodically monitor and compare restart_lsn and that minimum > > > LSN. If they see frequently that difference of those LSN is very small, > > > they can decide to increase wal_keep_segments or max_slot_wal_keep_size, > > > to prevent required WAL files from being removed. Thought? > > > > +1. This sounds like a good and useful stat for users. > > +1 for showing a number that is not involving lastRemovedSegNo. It is > like returning to the initial version of this patch. It showed a > number like ((the suggested above) minus restart_lsn). The number is > different for each slot so they fit in the view. > > The number is usable for the same purpose so I'm ok with it. I think we should publish the value from wal_keep_segments separately from max_slot_wal_keep_size. ISTM that the user might decide to change or remove wal_keep_segments and be suddenly at risk of losing slots because of overlooking that it was wal_keep_segments, not max_slot_wal_keep_size, that was protecting them. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services