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 1kHqH3-00034f-Ql for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2020 15:20:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kHqH2-0000a3-O6 for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Sep 2020 15:20:08 +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 1kHqH2-0000Zv-HN for pgsql-hackers@lists.postgresql.org; Mon, 14 Sep 2020 15:20:08 +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 1kHqH0-0006B8-1V for pgsql-hackers@lists.postgresql.org; Mon, 14 Sep 2020 15:20:08 +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 08EFK3VY1032728 for ; Mon, 14 Sep 2020 11:20:03 -0400 From: Tom Lane To: pgsql-hackers@lists.postgresql.org Subject: Subscription test 013_partition.pl fails under CLOBBER_CACHE_ALWAYS MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1032726.1600096803.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 14 Sep 2020 11:20:03 -0400 Message-ID: <1032727.1600096803@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk In connection with a nearby thread, I tried to run the subscription test suite in a CLOBBER_CACHE_ALWAYS build. I soon found that I had to increase wal_receiver_timeout, but after doing this: diff --git a/src/test/perl/PostgresNode.pm b/src/test/perl/PostgresNode.pm index 1488bff..5fe6810 100644 *** a/src/test/perl/PostgresNode.pm --- b/src/test/perl/PostgresNode.pm *************** sub init *** 447,452 **** --- 447,453 ---- print $conf "log_statement =3D all\n"; print $conf "log_replication_commands =3D on\n"; print $conf "wal_retrieve_retry_interval =3D '500ms'\n"; + print $conf "wal_receiver_timeout =3D '10min'\n"; = # If a setting tends to affect whether tests pass or fail, print it af= ter # TEMP_CONFIG. Otherwise, print it before TEMP_CONFIG, thereby permit= ting I let it run overnight, and came back to find that it was stuck at [03:02:15] t/013_partition.pl ................. 19/51 and had been for circa eight hours, where extrapolation from other tests said it shouldn't take much over half an hour. Investigation found that the subscriber was repeatedly failing like this: 2020-09-14 11:05:26.483 EDT [1030506] LOG: logical replication apply work= er for subscription "sub1" has started 2020-09-14 11:05:27.139 EDT [1030506] ERROR: cache lookup failed for rela= tion 0 2020-09-14 11:05:27.140 EDT [947156] LOG: background worker "logical repl= ication worker" (PID 1030506) exited with exit code 1 2020-09-14 11:05:27.571 EDT [1030509] LOG: logical replication apply work= er for subscription "sub1" has started 2020-09-14 11:05:28.227 EDT [1030509] ERROR: cache lookup failed for rela= tion 0 2020-09-14 11:05:28.228 EDT [947156] LOG: background worker "logical repl= ication worker" (PID 1030509) exited with exit code 1 The publisher's log shows no sign of distress: 2020-09-14 11:06:09.380 EDT [1030619] sub1 LOG: statement: SELECT pg_cata= log.set_config('search_path', '', false); 2020-09-14 11:06:09.446 EDT [1030619] sub1 LOG: received replication comm= and: IDENTIFY_SYSTEM 2020-09-14 11:06:09.446 EDT [1030619] sub1 LOG: received replication comm= and: START_REPLICATION SLOT "sub1" LOGICAL 0/163CF08 (proto_version '2', p= ublication_names '"pub1"') 2020-09-14 11:06:09.447 EDT [1030619] sub1 LOG: starting logical decoding= for slot "sub1" 2020-09-14 11:06:09.447 EDT [1030619] sub1 DETAIL: Streaming transactions= committing after 0/163D848, reading WAL from 0/163CF08. 2020-09-14 11:06:09.447 EDT [1030619] sub1 LOG: logical decoding found co= nsistent point at 0/163CF08 2020-09-14 11:06:09.447 EDT [1030619] sub1 DETAIL: There are no running t= ransactions. 2020-09-14 11:06:10.468 EDT [1030621] sub1 LOG: statement: SELECT pg_cata= log.set_config('search_path', '', false); 2020-09-14 11:06:10.533 EDT [1030621] sub1 LOG: received replication comm= and: IDENTIFY_SYSTEM 2020-09-14 11:06:10.534 EDT [1030621] sub1 LOG: received replication comm= and: START_REPLICATION SLOT "sub1" LOGICAL 0/163CF08 (proto_version '2', p= ublication_names '"pub1"') 2020-09-14 11:06:10.534 EDT [1030621] sub1 LOG: starting logical decoding= for slot "sub1" 2020-09-14 11:06:10.534 EDT [1030621] sub1 DETAIL: Streaming transactions= committing after 0/163D848, reading WAL from 0/163CF08. 2020-09-14 11:06:10.534 EDT [1030621] sub1 LOG: logical decoding found co= nsistent point at 0/163CF08 2020-09-14 11:06:10.534 EDT [1030621] sub1 DETAIL: There are no running t= ransactions. I do not have time today to chase this further, but somebody should. More generally, this seems like good evidence that we really oughta have a buildfarm member that's running *all* the tests under CLOBBER_CACHE_ALWAYS not just the core tests. That seems impossibly expensive, but I realized while watching these tests that a ridiculous fraction of the runtime is being spent in repeated initdb calls. On my machine, initdb takes about 12 minutes under CCA, so doing it separately for publisher and subscriber means 24 minutes, which compares not at all favorably to the circa-half-an-hour total runtime of each of the subscription test scripts. We're surely not learning anything after the first CCA run of initdb, so if we could find a way to skip that overhead for later runs, it'd make a huge difference in the practicality of running these tests under CCA. I recall having worked on a patch to make the regression tests run initdb just once, creating a template directory tree, and then "cp -a" that into place for each test. I did not finish it, because it wasn't showing a lot of advantage in a normal test run, but maybe the idea could be resurrected for CCA and other slow builds. Another idea is to make CCA a little more dynamic, say allow it to be suppressed through an environment variable setting, and then use that to speed up per-test initdbs. regards, tom lane