Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bb9Mi-0002Ul-Ce for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Aug 2016 16:43:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bb9Mh-0007hU-QQ for pgsql-hackers@arkaria.postgresql.org; Sat, 20 Aug 2016 16:43:23 +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 1bb9LL-00069R-9S for pgsql-hackers@postgresql.org; Sat, 20 Aug 2016 16:41:59 +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 1bb9LE-0007Th-E7 for pgsql-hackers@postgresql.org; Sat, 20 Aug 2016 16:41:58 +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 u7KGfmGk002087; Sat, 20 Aug 2016 12:41:49 -0400 From: Tom Lane To: Bernd Helmle cc: Alvaro Herrera , Simon Riggs , pgsql-hackers@postgresql.org Subject: Re: standalone backend PANICs during recovery In-reply-to: <12838.1471639801@sss.pgh.pa.us> References: <20160402215748.GA136801@alvherre.pgsql> <12838.1471639801@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 19 Aug 2016 16:50:01 -0400" Date: Sat, 20 Aug 2016 12:41:48 -0400 Message-ID: <2086.1471711308@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) 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 I wrote: > In short, I don't think control should have been here at all. My proposal > for a fix is to force EnableHotStandby to remain false in a standalone > backend. I tried to reproduce Bernd's problem by starting a standalone backend in a data directory that was configured as a hot standby slave, and soon found that there are much bigger issues than this. The startup sequence soon tries to wait for WAL to arrive, which in HEAD uses WaitLatch(&XLogCtl->recoveryWakeupLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, 5000L); which immediately elog(FATAL)s because a standalone backend has no parent postmaster and so postmaster_alive_fds[] isn't set. But if it didn't do that, it'd wait forever because of course there is no active WAL receiver process that would ever provide more WAL. The only way that you'd ever get to a command prompt is if somebody made a promotion trigger file, which would cause the startup code to promote the cluster into master status, which does not really seem like something that would be a good idea in Bernd's proposed use case of "investigating a problem". Alternatively, if we were to force standby_mode off in a standalone backend, it would come to the command prompt right away but again it would have effectively promoted the cluster to master. That is certainly not something we should ever do automatically. So at this point I'm pretty baffled as to what the actual use-case is here. I am tempted to say that a standalone backend should refuse to start at all if a recovery.conf file is present. If we do want to allow the case, we need some careful thought about what it should do. 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