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 1kNk1n-00042P-L1 for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Sep 2020 21:52:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNk1m-0001Cm-00 for pgsql-bugs@arkaria.postgresql.org; Wed, 30 Sep 2020 21:52:46 +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 1kNk1l-0001Cf-QE for pgsql-bugs@lists.postgresql.org; Wed, 30 Sep 2020 21:52:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNk1j-0001t4-LE for pgsql-bugs@lists.postgresql.org; Wed, 30 Sep 2020 21:52:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 08ULqcWE912615; Wed, 30 Sep 2020 17:52:38 -0400 From: Tom Lane To: Alvaro Herrera cc: Henry Hinze , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop In-reply-to: <20200930214216.GA5296@alvherre.pgsql> References: <20200930214216.GA5296@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 30 Sep 2020 18:42:16 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <912613.1601502758.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 30 Sep 2020 17:52:38 -0400 Message-ID: <912614.1601502758@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2020-Sep-30, Tom Lane wrote: >> The question that this raises is how the heck did that get past >> our test suites? It seems like the error should have been obvious >> to even the most minimal testing. > ... yeah, that's indeed an important question. I'm going to guess that > the TAP suites are too forgiving :-( One thing I noticed while trying to trace this down is that while the initial table sync is happening, we have *both* a regular walsender/walreceiver pair and a "sync" pair, eg postgres 905650 0.0 0.0 186052 11888 ? Ss 17:12 0:00 postgre= s: logical replication worker for subscription 16398 = postgres 905651 50.1 0.0 173704 13496 ? Ss 17:12 0:09 postgre= s: walsender postgres [local] idle postgres 905652 104 0.4 186832 148608 ? Rs 17:12 0:19 postgre= s: logical replication worker for subscription 16398 sync 16393 = postgres 905653 12.2 0.0 174380 15524 ? Ss 17:12 0:02 postgre= s: walsender postgres [local] COPY Is it supposed to be like that? Notice also that the regular walsender has consumed significant CPU time; it's not pinning a CPU like the sync walreceiver is, but it's eating maybe 20% of a CPU according to "top". I wonder whether in cases with only small tables (which is likely all that our tests test), the regular walreceiver manages to complete the table sync despite repeated(?) failures of the sync worker. regards, tom lane