Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttLh-0000KS-PP for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Sep 2017 10:32:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dttLg-0007La-T4 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Sep 2017 10:32:20 +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 1dttLe-0007J4-OQ for pgsql-hackers@postgresql.org; Mon, 18 Sep 2017 10:32:18 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dttLb-0006pe-A3 for pgsql-hackers@postgresql.org; Mon, 18 Sep 2017 10:32:17 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 4BAB020D68; Mon, 18 Sep 2017 06:32:14 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 18 Sep 2017 06:32:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=aISwjpxWh6i8dL4vbU hH8RGYTtCl58bmAANOrTjBXdw=; b=dF38fdFbkEUapAEE0s3kdSkdFjM6vW9oea 6yhjhYEEdv6w/HIdPIuh+iRqJjVm8XbYpK9ZkUpFmj2oTYPEkDlm9+inRrngy+Ec k+68wN4jbBNoDSmjRL+iFS3J6iPO4tq6O16V8XlSVxrAia7DX66ciRDRBgoRyyLW cbkk9DseXEIdVrAHr5tQdtYhT2Up1YQtCac81J3RT4JdolqBKDx/ITJqdmJLXt3p QZ8tZB215U7omlyp18AAGwbbFuwlZTAnZYwPzJXnPVAu/Oh8h5zxsKila9CRqFx3 kDO831wAnq+xyBW4I84oZ1f2YLmH8gYquK59NmXdvOGtfWMMBxeA== X-ME-Sender: X-Sasl-enc: FEj97yBEextZmcDdTh98cEuQSQgTJJjwoXt5RXXecoAM 1505730733 Received: from intern.anarazel.de (unknown [136.24.76.72]) by mail.messagingengine.com (Postfix) with ESMTPA id E1BFC7FA7C; Mon, 18 Sep 2017 06:32:13 -0400 (EDT) Date: Mon, 18 Sep 2017 03:32:13 -0700 From: Andres Freund To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: Re: [COMMITTERS] pgsql: Perform only one ReadControlFile() during startup. Message-ID: <20170918103213.nhlmfh5v3qrgoskg@alap3.anarazel.de> References: <14134.1505572349@sss.pgh.pa.us> <20170916182634.blb7upixw7hosdhu@alap3.anarazel.de> <23456.1505586621@sss.pgh.pa.us> <20170916183849.kgqlyi3q2oy4qjkx@alap3.anarazel.de> <27204.1505591941@sss.pgh.pa.us> <20170916202705.lhszupzi3s4iaxy6@alap3.anarazel.de> <20170917080752.rcmihzfmgbeuqjk2@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="blnb5vfpnrw4guil" Content-Disposition: inline In-Reply-To: <20170917080752.rcmihzfmgbeuqjk2@alap3.anarazel.de> 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 --blnb5vfpnrw4guil Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On 2017-09-17 01:07:52 -0700, Andres Freund wrote: > On 2017-09-16 13:27:05 -0700, Andres Freund wrote: > > > This does not seem like a problem that justifies a system-wide change > > > that's much more delicate than you thought. > > > > We need one more initialization call during crash-restart - that doesn't > > seem particularly hard a fix. > > FWIW, attached is that simple fix. Not quite ready for commit - needs > more comments, thoughts and a glass of wine less to commit. > > I'll try to come up with a tap test that tests crash restarts tomorrow - > not sure if there's a decent way to trigger one on windows without > writing a C function. Will play around with that tomorrow. This took a bit longer than I anticipated. Attached. There's surprisingly many issues with timing that make this not as easy as I hoped. I think in later commits we should extend this to cover things like the autovacuum / stats process / ... being killed - but that seems like material for a separate commit. One thing that I've noticed for a while, but that I was reminded of again here. We very frequently allow psql to reconnect in case of crash, just for postmaster to notice a child has gone and kill that session. I don't recall that frequently happening, but these days it happens nearly every time. Regards, Andres --blnb5vfpnrw4guil Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Add-tests-for-postmaster-crash-restarts.patch"