Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d27XY-0003yM-MC for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Apr 2017 02:46:20 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d27XX-00076t-2R for pgsql-hackers@arkaria.postgresql.org; Sun, 23 Apr 2017 02:46:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d27W1-0004QH-Bj for pgsql-hackers@postgresql.org; Sun, 23 Apr 2017 02:44:45 +0000 Received: from mail-it0-x22f.google.com ([2607:f8b0:4001:c0b::22f]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1d27Vt-0006Au-0w for pgsql-hackers@postgresql.org; Sun, 23 Apr 2017 02:44:44 +0000 Received: by mail-it0-x22f.google.com with SMTP id x188so18967308itb.0 for ; Sat, 22 Apr 2017 19:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=W6wI8Tdv2KgAlqKck/oBRNGDxajVTg3vkh+Hbt9H4E0=; b=RHlNJEIh79ibQfUZOMyC0W9uVGncX4FHC5ZpOek8OqtILxxSgRJNlomkARxUY3DowG QSFy5RuhvmpaNGdHSa5Ck70auotbSDl00PWi8LnrolNXDXYApgqyBvLZGl6YGM9dC8vT iOQ6ZpMqgRPiY2HX8/kKMwxBU2Ofqq3Xk5Euk8PaDw0gKw81BvdLpIGGXR+19aS1R/9l Asl+TbjWFemknj38+0n6ddNwqf2IZHNKFmsqjewxf8+r0zFCXl3uy8zLB5hKRbkDqIs7 AyTJJ4CWn46eTqXQ54clAze45dIiQiRYRihPRPY0u0B8HQuX4Hd1gS+Ddm9/oKujJfTr 8IVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=W6wI8Tdv2KgAlqKck/oBRNGDxajVTg3vkh+Hbt9H4E0=; b=rhbFOPhRAa5cMe2hBUFPo1OfxrPw1Vo7I8aL30N6cvJpj+ZIHvYeDqTIr/l3PAi3GF DQO9Go4fPyX7IaWlJpX2eumg2xIATjprEGGff8WwsdNFXp3513cGX8K3nhpmnzfOMnXk 1srjxZhTKF031Tusqwx57phrc7XCWxG11ms0eKljye3Rg3A3Zpwjl2kBahYAXoCwr1rg NvKx6UyE8ATjQqKFUNc0fVJRjRCMcnFR3NQ/6NF8y1ktX/mZQK/u7K7xFA2+NylIgAo4 CPxB93tDMnTFC6GhdfpfSSHalT2jH1ElH5MS1BGfixrMuGi4ZvhG5VixuAcvcu4cDT0M GgAQ== X-Gm-Message-State: AN3rC/4YrnGpy7O6OKy/9tkWGRtAuiKOtoaA7pkEKrCX9xXhMxYXixbd MH6EO5EKI+V8Ow== X-Received: by 10.36.65.68 with SMTP id x65mr6295868ita.117.1492915474982; Sat, 22 Apr 2017 19:44:34 -0700 (PDT) Received: from [192.168.2.121] (24-113-198-113.wavecable.com. [24.113.198.113]) by smtp.gmail.com with ESMTPSA id 141sm6040795ioe.47.2017.04.22.19.44.33 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 22 Apr 2017 19:44:34 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [COMMITTERS] pgsql: Replication lag tracking for walsenders From: Mark Dilger In-Reply-To: <21432.1492886428@sss.pgh.pa.us> Date: Sat, 22 Apr 2017 19:44:28 -0700 Cc: Thomas Munro , Simon Riggs , Alvaro Herrera , Pg Hackers Content-Transfer-Encoding: quoted-printable Message-Id: <3177FAD5-3600-4C8B-B338-FB108F60455F@gmail.com> References: <20170421190629.3srqyohjocgdvhhr@alvherre.pgsql> <27895.1492808648@sss.pgh.pa.us> <4219.1492875661@sss.pgh.pa.us> <21432.1492886428@sss.pgh.pa.us> To: Tom Lane X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.7 (--) 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 > On Apr 22, 2017, at 11:40 AM, Tom Lane wrote: >=20 > I wrote: >> Whoa. This just turned into a much larger can of worms than I expected. >> How can it be that processes are getting assertion crashes and yet the >> test framework reports success anyway? That's impossibly >> broken/unacceptable. >=20 > I poked into this on my laptop, where I'm able to reproduce both assertion > failures. The reason the one in subtrans.c is not being detected by the > test framework is that it happens late in the run and the test doesn't > do anything more with that server than shut it down. "pg_ctl stop" > actually notices there's a problem; for instance, the log on tern for > this step shows >=20 > ### Stopping node "master" using mode immediate > # Running: pg_ctl -D /home/nm/farm/gcc32/HEAD/pgsql.build/src/test/recove= ry/tmp_check/data_master_xHGA/pgdata -m immediate stop > pg_ctl: PID file "/home/nm/farm/gcc32/HEAD/pgsql.build/src/test/recovery/= tmp_check/data_master_xHGA/pgdata/postmaster.pid" does not exist > Is server running? > # No postmaster PID >=20 > However, PostgresNode::stop blithely ignores the failure exit from > pg_ctl. I think it should use system_or_bail() not just system_log(), > so that we'll notice if the server is not running when we expect it > to be. It's conceivable that there should also be a "stop_if_running" > method that allows the case where the server is not running, but so > far as I can find, no existing TAP test needs such a behavior --- and > it certainly shouldn't be the default. >=20 > The walsender.c crash is harder to detect because the postmaster very > nicely recovers and restarts its children. That's great for robustness, > but it sucks for testing. I think that we ought to disable that in > TAP tests, which we can do by having PostgresNode::init include > "restart_after_crash =3D off" in the postgresql.conf modifications it > applies. Again, it's conceivable that some tests would not want that, > but there is no existing test that seems to need crash recovery on, > and I don't see a good argument for it being default for test purposes. >=20 > As best I've been able to tell, the reason why the walsender.c crash > is detected when it's detected is that the TAP script chances to try > to connect while the recovery is happening: >=20 > connection error: 'psql: FATAL: the database system is in recovery mode' > while running 'psql -XAtq -d port=3D57718 host=3D/tmp/_uP8FKEynq dbname= =3D'postgres' -f - -v ON_ERROR_STOP=3D1' at /home/nm/farm/gcc32/HEAD/pgsql.= build/src/test/recovery/../../../src/test/perl/PostgresNode.pm line 1173. >=20 > The window for that is not terribly wide, explaining why the detection > is unreliable even when the crash does occur. >=20 > In short then, I propose the attached patch to make these cases fail > more reliably. We might extend this later to allow the old behaviors > to be explicitly opted-into, but we don't seem to need that today. >=20 > regards, tom lane I pulled fresh sources with your latest commit, 7d68f2281a4b56834c8e5648fc7= da0b73b674c45, and the tests consistently fail (5 out of 5 attempts) for me on my laptop w= ith: /Applications/Xcode.app/Contents/Developer/usr/bin/make -C recovery check for extra in contrib/test_decoding; do /Applications/Xcode.app/Contents/Dev= eloper/usr/bin/make -C '../../..'/$extra DESTDIR=3D'/Users/mark/vanilla/bit= octetlength'/tmp_install install >>'/Users/mark/vanilla/bitoctetlength'/tmp= _install/log/install.log || exit; done rm -rf /Users/mark/vanilla/bitoctetlength/src/test/recovery/tmp_check/log cd . && TESTDIR=3D'/Users/mark/vanilla/bitoctetlength/src/test/recovery' PA= TH=3D"/Users/mark/vanilla/bitoctetlength/tmp_install/usr/local/pgsql/bin:$P= ATH" DYLD_LIBRARY_PATH=3D"/Users/mark/vanilla/bitoctetlength/tmp_install/us= r/local/pgsql/lib" PGPORT=3D'65432' PG_REGRESS=3D'/Users/mark/vanilla/bitoc= tetlength/src/test/recovery/../../../src/test/regress/pg_regress' prove -I = ../../../src/test/perl/ -I . t/*.pl t/001_stream_rep.pl .................. ok=20=20=20=20=20 t/002_archiving.pl ................... ok=20=20=20 t/003_recovery_targets.pl ............ ok=20=20=20 t/004_timeline_switch.pl ............. Bailout called. Further testing sto= pped: system pg_ctl failed FAILED--Further testing stopped: system pg_ctl failed make[2]: *** [check] Error 255 make[1]: *** [check-recovery-recurse] Error 2 make: *** [check-world-src/test-recurse] Error 2 The first time, I had some local changes, but I've stashed them and am stil= l getting the error each of these next four times. I'm compiling as follows: make distclean; make clean; ./configure --enable-cassert --enable-tap-tests= --enable-depend && make -j4 && make check-world Are the errors expected now? mark --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers