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 1mFdIa-0007BJ-CW for pgsql-admin@arkaria.postgresql.org; Mon, 16 Aug 2021 14:09:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mFdIZ-00047o-BL for pgsql-admin@arkaria.postgresql.org; Mon, 16 Aug 2021 14:09:07 +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 1mFdIZ-00047f-2K for pgsql-admin@lists.postgresql.org; Mon, 16 Aug 2021 14:09:07 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mFdIT-00007z-U6 for pgsql-admin@lists.postgresql.org; Mon, 16 Aug 2021 14:09:06 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D5CF55C0118; Mon, 16 Aug 2021 10:08:59 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 16 Aug 2021 10:08:59 -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=fhI+xfDfLuq+QycWIEOF/4ShQbeai4DGdjoxvzeMRuc=; b=NIdjYsNL QHjkXDzz4uk1Mtal1ctmAsTwzhaztfSVATZiiX4QPj1lVqxftBF1DvM8M+Y3rZId gWnNpsziVXAG1/DCCkQ+v/w8eRSd51DHS1PatdK/+7u0v7Hj6YWwd/a15Crgb7v8 HUr/0/RlcN7b4B36xUHKAqifdjx4b36UPz5S4cWboaegpSSs5bO20XX8rBNZR1cr dfL2jTRYbQoCorKZyWG3rImhnxteI3RvcD36whdscrdkhCgoNvspI8QAj+HrOJPU 2CmIpfSKBGeS9Rdr/++ViptFHOiOXmLZyh4/hnr/trNn9EdvXmzlJ9eJ2iKm/nX3 MfscM3yl73rpvQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrledugdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepjeejveffueekjeeikeehheeludduheetiedugeetteekhfev lefhfedvuddvgfefnecuffhomhgrihhnpehpohhsthhgrhdrvghspdgvnhhtvghrphhrih hsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Aug 2021 10:08:59 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id B4BFB2A099B; Mon, 16 Aug 2021 10:08:56 -0400 (-04) Date: Mon, 16 Aug 2021 10:08:56 -0400 From: Alvaro Herrera To: Scott Ribe Cc: Pgsql-admin Subject: Re: max_slot_wal_keep_size Message-ID: <202108161408.bppauqdp4knj@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <58D79C5B-B9FE-403B-97C0-40B6DF1E00CF@elevated-dev.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Aug-16, Scott Ribe wrote: > If I use max_slot_wal_keep_size to limit disk impact of a down > replica, and subsequently a down replica causes PG to hit this limit, > is there a particular message that will be logged when the limit is > crossed and PG starts to purge WAL? > > Context is: trying to debug a failure to bring up a replica, where the > failure happened in the middle of a moderately complex chain of events > that likely started with a bad disk. (Patroni is involved, FWIW) Yes, you should see invalidating slot "..." because its restart_lsn ... exceeds max_slot_wal_keep_size However, there was a bug fixed recently in that area, whereby the slot would be invalidated but the space would not be freed; the fix was on July 16th and it was released together with last week's minors: Author: Alvaro Herrera Branch: master [ead9e51e8] 2021-07-16 12:07:30 -0400 Branch: REL_14_STABLE [e5bcbb107] 2021-07-16 12:07:30 -0400 Branch: REL_13_STABLE Release: REL_13_4 [866237a6f] 2021-07-16 12:07:30 -0400 Advance old-segment horizon properly after slot invalidation When some slots are invalidated due to the max_slot_wal_keep_size limit, the old segment horizon should move forward to stay within the limit. However, in commit c6550776394e we forgot to call KeepLogSeg again to recompute the horizon after invalidating replication slots. In cases where other slots remained, the limits would be recomputed eventually for other reasons, but if all slots were invalidated, the limits would not move at all afterwards. Repair. Backpatch to 13 where the feature was introduced. Author: Kyotaro Horiguchi Reported-by: Marcin Krupowicz Discussion: https://postgr.es/m/17103-004130e8f27782c9@postgresql.org -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/