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 1m46kN-0003cZ-37 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jul 2021 19:10:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m46kM-0003Dq-1z for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jul 2021 19:10:10 +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 1m46kL-0003DZ-1z for pgsql-bugs@lists.postgresql.org; Thu, 15 Jul 2021 19:10:09 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m46kH-0008Nc-6n for pgsql-bugs@lists.postgresql.org; Thu, 15 Jul 2021 19:10:08 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 4FCB33200941; Thu, 15 Jul 2021 15:10:00 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Thu, 15 Jul 2021 15:10:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=nkZ54o7IYEaKN84oE8v0dE0CpFmjB3Q2+1KTU5XIbbA=; b=mgMgNMIm 1sbtD/y5vsu2c8LyLd3z7wPa4IuR6nEPYSSx+uxKWA7JT0E2+VTA2t53bQ/irW4E xVms1ttn+/XiWAMmWGQ/g+VWzZGLXp3ifAdW5oG8IW64iRyxrJt9kDmskiSJJWAm fmpjGmCVNe5AA96tQ/FU+1ygsWqR4E1euejG8VtQnHhlezQX7NMTNrhjPZrJYEd3 8ipEgiwzuafieUqrU6E9+2ciM2HX1j705o1kR+Ar5g+4Wf1rWaR5zwlQaGFPTowg Zgc6g1pp3/2uI0U2k/SScdU3X0cwLxhQyfjfEGNZlMc+6U7s4XADjPStLnnWIKwk yToVNY8ItwVxuQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtgdelfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgjsehmkeerre dttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvges rghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpeetvdfhteeuueekfe fhfedugeffhfehhfdvleffleetkeeggeefhffggeekjedtudenucffohhmrghinhepvghn thgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 15 Jul 2021 15:09:59 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id EB3092A099B; Thu, 15 Jul 2021 15:09:55 -0400 (-04) Date: Thu, 15 Jul 2021 15:09:55 -0400 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: jeff.janes@gmail.com, mk@071.ovh, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17103: WAL segments are not removed after exceeding max_slot_wal_keep_size Message-ID: <202107151909.q26rrvd3ius7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="uz6scf5drfqcsq6l" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210715.163348.2298778826242193015.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --uz6scf5drfqcsq6l Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2021-Jul-15, Kyotaro Horiguchi wrote: > This is it. It is for the master branch but also applicable to 14 as > is. Not needed for earlier version. > I believe the test works for Windows but haven't checked. I looked at it. I think it is better to make the calls to ReplicationSlotsComputeRequiredLSN() in slot.c (which is where most other calls to that function are). Also we should recompute the minimum required Xmin at that point. Another change I did was move the "*invalidated=true" assignment to the block where we actually invalidate the slot; in your patch you were doing it possibly too early if the slot was in use by some other process. (For end effect it probably doesn't matter much, but it's better to have it right.) -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ --uz6scf5drfqcsq6l Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v2-0001-Advance-old-segment-horizon-properly-after-slot-i.patch"