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 1kcRad-0005Ry-63 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Nov 2020 11:13:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kcRac-0006k5-4b for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Nov 2020 11:13:30 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcRab-0006jw-Or for pgsql-hackers@lists.postgresql.org; Tue, 10 Nov 2020 11:13:29 +0000 Received: from forward500p.mail.yandex.net ([77.88.28.110]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kcRaU-00073v-2H for pgsql-hackers@postgresql.org; Tue, 10 Nov 2020 11:13:28 +0000 Received: from mxback7q.mail.yandex.net (mxback7q.mail.yandex.net [IPv6:2a02:6b8:c0e:41:0:640:cbbf:d618]) by forward500p.mail.yandex.net (Yandex) with ESMTP id E974194067B; Tue, 10 Nov 2020 14:13:18 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback7q.mail.yandex.net (mxback/Yandex) with ESMTP id 4iV0tlgJgC-DHPKvHqY; Tue, 10 Nov 2020 14:13:18 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zsrv.org; s=mail; t=1605006798; bh=eIRZxI/0XOUu70Vph3qVbPAy2+Y4zxaTM0+MKV7TUAo=; h=Message-Id:Cc:Subject:In-Reply-To:Date:References:To:From; b=MeERsI9TMcVCgsxTN1ilDDqzvbI+O8EDEjHf8pQpaEpRjMxfBslhH8v4O5Y2WtEw+ Vfi2ktyB5jzGsDkUlGqfi7fZjzoxndqnWvPCY1VIY+kcCd+YoiHgH/0dtZD3GH1IA4 VZ8Jb86xUZy34OBW+C6pGEnh9z+4akwWQDyDxY1A= Authentication-Results: mxback7q.mail.yandex.net; dkim=pass header.i=@zsrv.org Received: by vla5-8300199a0c8b.qloud-c.yandex.net with HTTP; Tue, 10 Nov 2020 14:13:17 +0300 From: Sergei Kornilov To: Kyotaro Horiguchi Cc: "masao.fujii@oss.nttdata.com" , "a.lubennikova@postgrespro.ru" , "robertmhaas@gmail.com" , "michael@paquier.xyz" , "andres@anarazel.de" , "peter.eisentraut@2ndquadrant.com" , "pgsql-hackers@postgresql.org" In-Reply-To: <20201110.135420.826057682358861616.horikyota.ntt@gmail.com> References: <56311604665173@mail.yandex.ru> <108021604695421@mail.yandex.ru> <20201110.135420.826057682358861616.horikyota.ntt@gmail.com> Subject: Re: Allow some recovery parameters to be changed with reload MIME-Version: 1.0 X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Tue, 10 Nov 2020 14:13:17 +0300 Message-Id: <4363101605003835@mail.yandex.ru> Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hello > If someone changes restore_command to '' then reload while crash > recovery is running, the server stops for no valid reason. While *crash* recovery is running? It's possible only during Point-in-Time Recovery, no? At the beginning of validateRecoveryParameters we check ArchiveRecoveryRequested, which can be set in two cases: * if recovery.signal found - same check on recovery start. Otherwise it is possible to early end recovery because of empty restore_command. So we want to protect the user from such misconfiguration? I am fine if we decide that no additional handling is needed. * if standby.signal found - this FATAL is not reachable because StandbyModeRequested is also set. During crash recovery validateRecoveryParameters does nothing. > If restore_command is set to 'hoge' (literally:p, that is, anything > unexecutable) and send SIGHUP while archive recovery is running, the > server stops. I think we need to handle these cases more gracefully, I think we can not perform such check reliable. As in my example earlier: > restore_command = '. /etc/wal-g/WALG_AWS_ENV; wal-g wal-fetch "%f" "%p"' How do we find the commands first? For any shell? And even: we learned that the binary is unexecutable. But what to do next? > If someone changes restore_command by mistake to something executable > but fails to offer the specfied file even if it exists, the running > archive recovery finishes then switches timeline unexpectedly. Or executable file was just removed. Which is clearly a pilot error. Is this differs from changing restore_command? >>  I do not know the history of this fatal ereport. It looks like "must specify restore_command when standby mode is not enabled" check is only intended to protect the user from misconfiguration and the rest code will treat empty restore_command correctly, just like /bin/false. Did not notice anything around StandbyMode conditions. > > If restore_command is not changable after server-start, it would be > valid for startup to stop for inexecutable content for the variable > since there's no way to proceed recovery. Why not use local pg_wal? There may be already enough WAL. regards, Sergei