Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSBzi-0000GW-DK for pgsql-docs@arkaria.postgresql.org; Thu, 29 Nov 2018 02:23:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gSBzg-0001J3-U2 for pgsql-docs@arkaria.postgresql.org; Thu, 29 Nov 2018 02:23:56 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSBzg-0001Iw-Nx for pgsql-docs@lists.postgresql.org; Thu, 29 Nov 2018 02:23:56 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gSBze-0007ML-QF for pgsql-docs@lists.postgresql.org; Thu, 29 Nov 2018 02:23:56 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 91A3621C86; Wed, 28 Nov 2018 21:23:53 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 28 Nov 2018 21:23:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=tp2s8GlU676dsKKfS8E4YCDd1Lj oPtoerJTn/HlQGbg=; b=hGqJxbDrsKH/rnbQsJAQaV+hU119l6N3yTfxDZ4SiXa Ng3NymV4lQZbyaYlHaKWy8/O3YpFBzZSwvtlDmtKSo+uc3XmkMxdeFc+Iv/iJrd7 aaBYxpb2LzfZT4jrD9uuMMTgMXbpIU2BeSaQ7FgAK6Anhwev3nZV1blrgSh6m9N6 +g3a0BXg0scK+d7r0MXpqn3rn04X/G3FWNSz+yayPmhW5P/pvRnyqdk7sbiYxBr6 0/IOMhVQPL4SLzRnCVWvJn71Ojf0VsiybzWSRvhNmQhD6GASx0/UtqrOedbN3Nkb kaFxUl2F0CfufDyOXV+0jIr2+/D0QaC/kcCOjgZO02A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=tp2s8G lU676dsKKfS8E4YCDd1LjoPtoerJTn/HlQGbg=; b=UeViy2hEFmRpPFrG0OR7mk zGPReOQte/Df36iwdn91TACNiYSMgWzNu+Wj291PDGBMhdC0LcGoaKZw8ugehqm7 iukuf8hN2WIGO60XrOCs8+G+2l7eh90v/zUiC58B5wkxPvF9VgZCU7xWMFoYL3Q8 HHd2UnfBhyvd3y+a4nzPEpuVXE93pM0JH8ib3Hgi3nqz94cVePI0Ly18NbKOqyBH +uKJO3aQ/rcS1GJM6ERQAfzBw2r2NX8EPeSQSj3vDwMzmaEB4hsyHa+7axXbA+xQ UW1hevOB1VREIQalwOd2BN7ZA6bTzCgrzRRR3utQRk+Y7z5aLy90TGdWh0nsh8cw == X-ME-Sender: X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id CF2B510406; Wed, 28 Nov 2018 21:23:50 -0500 (EST) Date: Thu, 29 Nov 2018 11:23:47 +0900 From: Michael Paquier To: splarv@ya.ru, pgsql-docs@lists.postgresql.org Subject: Re: Return codes for archive and restore commands Message-ID: <20181129022347.GH626@paquier.xyz> References: <154340283171.1324.10549444217937216132@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Rmm1Stw9KgbdL9/H" Content-Disposition: inline In-Reply-To: <154340283171.1324.10549444217937216132@wrigleys.postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Rmm1Stw9KgbdL9/H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 28, 2018 at 11:00:31AM +0000, PG Doc comments form wrote: > For the archive command: > <=3D128 There are not errors in the PostgreSQL log (messages with severity > equal or higher than ERROR). Firstly 3 messages of type LOG about fault, > then WARNING about this and pause for 1 minute, then repeated. > >=3D129 FATAL error in the PostgeSQL log. The message about stoping an ar= chive > process, but not the database. Repeated after roughly 16 seconds. This code is around for some time, and comes from this commit: commit: 3ad0728c817bf8abd2c76bd11d856967509b307c author: Tom Lane date: Tue, 21 Nov 2006 20:59:53 +0000 committer: Tom Lane date: Tue, 21 Nov 2006 20:59:53 +0000 On systems that have setsid(2) (which should be just about everything except Windows), arrange for each postmaster child process to be its own process group leader, and deliver signals SIGINT, SIGTERM, SIGQUIT to the whole process group not only the direct child process. This provides saner behav= ior for archive and recovery scripts; in particular, it's possible to shut down= a warm-standby recovery server using "pg_ctl stop -m immediate", since delive= ry of SIGQUIT to the startup subprocess will result in killing the waiting recovery_command. Also, this makes Query Cancel and statement_timeout apply to scripts being run from backends via system(). (There is no support in t= he core backend for that, but it's widely done using untrusted PLs.) Per gripe =66rom Stephen Harris and subsequent discussion. The relevant part if pgarch_archiveXlog() in pgarch.c, and this part is most relevant: * Per the Single Unix Spec, shells report exit status > 128 when a * called command died on a signal. > In this case PostgreSQL tries confirm rules for return codes of a unix > shell. A unix shell return 126 in the case of "command not executable", 1= 27 > in the case "command not found", 128+# of signal in the case if applicati= on > interrupted by uncatched signal. If you were to rewrite those paragraphs or make them more precise, how would you actually shape your suggestions? I personally quite like the current formulations, but I am rather used to it to be honest. -- Michael --Rmm1Stw9KgbdL9/H Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlv/TbMACgkQnvQgOdby QH2NCQ//RjeuW8J6ok4Ng0jqoHYIg//qr8zpg2Y1dKzxrRKadCVr1JECMtx4U1Rp MBdCqaJPxLkU0acNQN2SlKkIlA4Dd3uAj1JPo+hKNJ09WS8iGGS3VLJTD6cK5t5o sNktwcZOEC5339qhreiW6J/mzYuZ3BDa9NapHTB4/oHJSr7M8IhwL99hxuwOAgLI WwZPPdNHPfVB1KZaK35YOzKi8czrdpYusyKL5sFXWKqP8rx9w8MKo+mZT2dCmqe4 6ffQeX4snVvVxZKMJFtQ7VkN9AV5KICwTLLH7X7yyQzhQm8dTHFevTnCpXYueGlQ flZ9+QM3bDXZH9l9BkslrCDYUqxS7q2uSqGU9wFP6loAGqnR9nt/Dx+tmb0M7Et0 856Wrr6FZvU5JriVqRbNoBUzkl0qVx1PqkeR8wtymVMhqZ+WogG9coWlGGTdlIOw uO9OGx9jwtBnNldKSapEJUR1VmrC9vQjD2fDX3fqsmEmXq1MN5QJYiegyIUEJ4qa lShNrtf6pAKNlLhhhEWNTlG9fE8MNK/Di9eDRG/MKILHa7Ekjl62TdDu9bOMWn92 HX5X6PSmqqwQWwdw5f0Q0NeyxGHvDryuCm4Vgnq2NRhCy1kz6t5VwJKRa3VKihqk W3LeReTTauwjL63IKlSCjnXh8qWk2YIJv/q96Day9vmDgXAXIoc= =EFZU -----END PGP SIGNATURE----- --Rmm1Stw9KgbdL9/H--