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 1oucgT-0007AW-JY for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Nov 2022 16:51:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oucgS-0007Q7-1F for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Nov 2022 16:51:44 +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 1oucgR-0007Py-O3 for pgsql-bugs@lists.postgresql.org; Mon, 14 Nov 2022 16:51:43 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oucgP-0008GX-Nx for pgsql-bugs@postgresql.org; Mon, 14 Nov 2022 16:51:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rTuKStd3JVkZGKeQxQa82X3+oCdeNoyHeeU/ISNtZT4=; b=a7QYYp2n/w2uwLh+U3qlg1BwRL u/mXOchf4xtgQN1nBtKPYDYJ4RlVMq7+andE6ob0Iq2fwISjpGePclf1rja7bFG2WRCwKwyg3y757 6pwpqDNdWMnKAJe/5VI4Tv21F8yFBYQ6jPmVjdQM+jigRqUlAsWtm3zxbl6zexdk40rk=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1oucgO-0093Yj-9S; Mon, 14 Nov 2022 17:51:40 +0100 Date: Mon, 14 Nov 2022 17:51:40 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Amit Kapila Cc: pgsql-bugs mailing list Subject: Re: WAL segments removed from primary despite the fact that logical replication slot needs it. Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 14, 2022 at 09:52:05PM +0530, Amit Kapila wrote: > On Mon, Nov 14, 2022 at 7:03 PM hubert depesz lubaczewski > wrote: > > > > On Mon, Nov 14, 2022 at 06:30:57PM +0530, Amit Kapila wrote: > > > > There is something weird happening: > > > What exactly weird you are seeing in this? To me, it appears as if the > > > system due to some reason ignores an existing slot that has > > > restart_lsn as 1039D/83825958. > > > > The weird part for me is that it is trying to remove wal files older > > than the same "x" many times. > > > > I think that is okay because as per checkpointer's computation it > decides not to remove/replace any new WAL files. At this stage, I am > not getting any idea except for getting the value of > XLogGetReplicationSlotMinimumLSN() in one of the LOG prints. If you > can't add all the LOGs, I shared in the last patch, can you try to get > the value of XLogGetReplicationSlotMinimumLSN() by appending to the > existing LOG "attempting to remove WAL segments older than log file > .."? If I'll get *any* patch approved, and restart of client db, then it doesn't matter how many LOGs there will be :) Will get back to you as soon as I will have more info. Best regards, depesz