Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1quq9B-001qO2-Qy for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Oct 2023 08:18:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1quq99-006tV9-2A for pgsql-bugs@arkaria.postgresql.org; Mon, 23 Oct 2023 08:18:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1quq97-006tV1-JM for pgsql-bugs@lists.postgresql.org; Mon, 23 Oct 2023 08:18:47 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1quq94-002Da1-3p for pgsql-bugs@lists.postgresql.org; Mon, 23 Oct 2023 08:18:45 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EFBF45C028C; Mon, 23 Oct 2023 04:18:38 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 23 Oct 2023 04:18:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1698049118; x=1698135518; bh=nO WCN4qmEEE8JHpvbPQ5+3X1kCfkbbiwA4cwAR2MH0k=; b=m0LLJgMU5nsJu56ska gAGDhuiN756qWpgD/aOpK6uxCOT2FPbTR3KP2jdiMvX6aHjjGwwEubF+lHeHnrp4 BddjJ5kel85JF++xYXhddPuLSsi+eUiJpMzGTyJk3kD9g5kO/ONuYKKFpRifsW5D lc1ZxozcUlQMOR5QdmVKl2ADYVoGrntJTeZBw9cw3aXk7H3Kx020MKX35w+IQJOT cL11LynjATziKlc784pJI46QZSgmvSy6zfMMq0Mm8ZERi96U9yGrEa33y4Wl4dc8 YfU0fxzT3CiAIvBCxjN/PrHdqZCak7Q9PzHQJFBvXhB1Jdc5oWrqhUJ9GaQkcadx E3pg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698049118; x=1698135518; bh=nOWCN4qmEEE8J HpvbPQ5+3X1kCfkbbiwA4cwAR2MH0k=; b=b6M1udVZ4pj+CxVLlL9gxjUcR0AHF anhqD6r45tkdEgVuOSEs3h5U3msg3QBjm41rPWi+mCaqXFLmX7aOD4OsuX095G5T I5Fea2NWdHGBAm0Oz/YUI6kHGGKa4KXKJupGyN6dUbwqeFUsnpuXf8vyxRCVaV3x O0em9vjAEQLqUoiffBRP2zpWysyFiww5jqKJvtCMm/ziI3Z52VBRDoFZOWNf3gpm QURnDqprYV6+oEH0np1Lyspyuuy98VRXxkq/eNjz7wu/Ct3SZJrWek+vDJqy0TFt Mb23dJ6Zm6afs/Y+8c7MxStkCXxIC/b33BlZ7ra8V4FbIKsblsNtIfV8w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeeigddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfg hrlhcuvffnffculdefhedmnecujfgurhepfffhvfevuffkfhggtggujgesghdtreertddt jeenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucggtffrrghtthgvrhhnpeevteejgfejveegudekheeiueei ueeiveeuiedugeehveeugffgudeuleegleeiteenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Oct 2023 04:18:36 -0400 (EDT) Date: Mon, 23 Oct 2023 17:18:32 +0900 From: Michael Paquier To: Amit Kapila Cc: "Callahan, Drew" , "pgsql-bugs@lists.postgresql.org" Subject: Re: BUG #18155: Logical Apply Worker Timeout During TableSync Causes Either Stuckness or Data Loss Message-ID: References: <18155-33f555bcc7e1105e@postgresql.org> <3AF2B908-D293-43F9-AE06-73C7797C96B0@amazon.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jzrtOIBOT8cGGaMe" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jzrtOIBOT8cGGaMe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 18, 2023 at 10:22:14AM +0900, Michael Paquier wrote: > On Tue, Oct 17, 2023 at 09:50:52AM +0530, Amit Kapila wrote: >> On Tue, Oct 17, 2023 at 4:46=E2=80=AFAM Callahan, Drew wrote: >>> On the server side, we did not see evidence of WALSenders being launche= d. As a result, the gap kept increasing further >>> and further since they workers would not transition to the catchup stat= e after several hours due to this. >>=20 >> One possibility is that the system has reached >> 'max_logical_replication_workers' limit due to which it is not >> allowing to launch the apply worker. If so, then consider increasing >> the value of 'max_logical_replication_workers'. You can query >> 'pg_stat_subscription' to know more information about workers. See the >> description of subscriber-side parameters [1]. >=20 > Hmm. So you basically mean that not being able to launch new workers > prevents the existing workers to move on with their individual sync, > freeing slots once their sync is done for other tables. Then, this > causes all all of the existing workers to remain in a syncwait state, > further increasing the gap in WAL replay. Am I getting that right? I was looking more at what we could do here, played with the apply and sync workers and I really doubt that just ERROR-ing in a sync worker is a good idea on v14~ just for the sake of freeing bgworker slots, which would have the effect of spawning more apply workers. I mean, if your system is under pressure because of a lack of bgworker slots, assuming that a set of N apply workers are gone, leaving M sync workers (M >=3D N) lying around without being able to get updates from an apply worker, ERRORs in sync workers would give more room to spawn apply workers, but then the launcher worker may fight for the free'd slots to attempt to spawn sync workers for the fresh apply workers, no? It also seems to make the reasoning around the table states harder to think about, as any future apply workers need to handle more error cases related to sync workers. I got a few extra questions about all that: - How did the apply worker stop? That can be said to be the origin of the issue. - Did logicalrep_worker_launch() provide some WARNINGs because the cluster is running out of slots, preventing the spawn of a new apply worker to replace the one that's down, so as the table sync workers are able to move on with their sync phases? I guess it did.. The frequency would offer hints about the pressure put on the system. -- Michael --jzrtOIBOT8cGGaMe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmU2LFgACgkQnvQgOdby QH2zlA//Z7dRwsz4JiPuDoty7nlf+C1PPdRqZlCJEomQv471Qw/8wyqv1D891RLd QaVW/dA1S4NUvACWD7R6uBQzdQ6xF8tcG7ZdkwnZo9vq8YA+uqDrovC3KSq5ycNi yFpz459LSlj4PocKCLwhNv/YXP0hveVOSfkEW4aglHGp3Asp9OT/mUEJjiIGMqcF TRZxkLuawQN0JiX/RmtcMvMg8QYEZr1cBqiv6DhViQLTZns2GBq1miZky+rYo2b7 6BAzngen30U9O59Cmm9SyYQhhWDhPQa9YDCaPJNaczr0knyYbIr7bOUobtThUCGM CC1lafI0yFYanGooRsT2QlE/TcAyIBtEBbYX615FpTLrHnbqmFiTIoxEIiZqdCzo RKVlgBEkfWGkWU2bXIjtxsCwkT/s0lBr96gzofDytZOCLATLkZePWF57w5b/R7jL NNSmZgHq/pgQe9WAfNDwHt+Lc8iFuXH4rkA+Z9W4euuo2kN6dTmgIIsSgNEn/dbt IAS+kiX5dqNJJ9waIuJavLNW/Gzjm5klfLWxwqOp1u+sSHS+9anvRiVb7enYMzwI pePD/P2WwrxvAT354UGFgqW0WBBZYSczvRCy4vL/R1bDQFDqa/ZXTtUDsAAjqUBZ cuvtL+YEn8BaIbOzlYjdMwNDVVJxKW2OQ+IKTPVKcNGHzQJO89A= =/ExH -----END PGP SIGNATURE----- --jzrtOIBOT8cGGaMe--