Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtyKr-0005St-3m for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Sep 2017 15:51:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dtyKq-0007B8-Ey for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Sep 2017 15:51:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtyJH-0004Kj-3d for pgsql-hackers@postgreSQL.org; Mon, 18 Sep 2017 15:50:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtyJD-0005F2-Lv for pgsql-hackers@postgreSQL.org; Mon, 18 Sep 2017 15:50:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v8IFo6XF027033 for ; Mon, 18 Sep 2017 11:50:06 -0400 From: Tom Lane To: pgsql-hackers@postgreSQL.org Subject: src/test/subscription/t/005_encoding.pl is broken MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27031.1505749806.1@sss.pgh.pa.us> Date: Mon, 18 Sep 2017 11:50:06 -0400 Message-ID: <27032.1505749806@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org To reproduce the subscription-startup hang that Thomas Munro observed, I changed src/backend/replication/logical/launcher.c like this: @@ -427,7 +427,8 @@ retry: bgw.bgw_notify_pid = MyProcPid; bgw.bgw_main_arg = Int32GetDatum(slot); - if (!RegisterDynamicBackgroundWorker(&bgw, &bgw_handle)) + if (random() < 1000000000 || + !RegisterDynamicBackgroundWorker(&bgw, &bgw_handle)) { /* Failed to start worker, so clean up the worker slot. */ LWLockAcquire(LogicalRepWorkerLock, LW_EXCLUSIVE); This causes about 50% of worker launch requests to fail. With the fix I just committed, 002_types.pl gets through fine, but 005_encoding.pl does not; it sometimes fails like this: t/005_encoding.pl ..... 1/1 # Failed test 'data replicated to subscriber' # at t/005_encoding.pl line 49. # got: '' # expected: '1' # Looks like you failed 1 test of 1. t/005_encoding.pl ..... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests The reason seems to be that its method of waiting for replication to happen is completely inapropos. It's watching for the master to say that the slave has received all the WAL, but that does not ensure that the logicalrep apply workers have caught up, does it? regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers