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 1n5d8k-0004LZ-Bi for pgsql-docs@arkaria.postgresql.org; Fri, 07 Jan 2022 00:29:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n5d8h-0005G7-JZ for pgsql-docs@arkaria.postgresql.org; Fri, 07 Jan 2022 00:29:51 +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 1n5d8f-0005Em-Kp for pgsql-docs@lists.postgresql.org; Fri, 07 Jan 2022 00:29:51 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n5d8a-0008Ok-5U for pgsql-docs@lists.postgresql.org; Fri, 07 Jan 2022 00:29:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 8F842320342D; Thu, 6 Jan 2022 19:29:41 -0500 (EST) Received: from imap49 ([10.202.2.99]) by compute5.internal (MEProxy); Thu, 06 Jan 2022 19:29:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm3; bh=CFWAzNFGQ2GsmxU8KZ9Acc1AC82Zi6L rOSwKQyza2qM=; b=JIS9fxsOEQIvLOebmfRZ/cAIuof8y13+7KfijePt9ipjp+9 eDrw1cPNEw2d2NpS02Y88W6ZM38PYANl3kBY3yCV7FkjnGiDjihBzUhM+pAZpTxJ uEeLkPq0gP0lwdCpQwKKGW2+r6ynEgPcOyXA+aB92Kc3ZoKkIN9QPD8cZdhvPxKt ro79jccg8yf+e55clK17LpbtSegDJCuyQGDgulEe5YZ38Mt0uiaGFFSzx+pAwrPx Hq1IQrj8g/HnI7zUgXUfS91XlyhJgxPU4SidZ0ZVgur20lgZkZgT4Ku47iSwju9/ wUV97tWzwDTJcHn26/7saiAQw9+/OL47pE+Rv3A== 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=CFWAzN FGQ2GsmxU8KZ9Acc1AC82Zi6LrOSwKQyza2qM=; b=UIL1ldl0/agJXGKPMiZT8Z GtkBCIu0f11IPXtkNtD+Ug4646iZzO8noYaRQkmpEnvlV7nImdrJCiEKhBG1OwfP bwEJk5KQtejpTjJ08PjMm1aetiOKTxtidCs+8QR9c0pTLiY7Kbog9ZRaQSMa/9eS hO6/XrSFmhvYz+jcQSjBaBV1ZkFArcOZdVB8M/dPYeuS9Q0axTbKU6fG8ON6gFSw /1iANO6JoKMRypYdecx2I1EZaH7fXgvl1TcbH5q5KSAf/USXh2ho7Q1Nitrq7x82 SNG1ZqpIFX9fGjDUDmM2tdBA7tvQnlBOzkd2kjpf2cu+9dPKU0Wuo2gtWxj/zg7Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrudegtddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsegrtd erreerredtnecuhfhrohhmpedfgfhulhgvrhcuvfgrvhgvihhrrgdfuceovghulhgvrhes vghulhgvrhhtohdrtghomheqnecuggftrfgrthhtvghrnhepkeegfeehhfdufedtfeejke evvedvhfejjefghfegiedtjeeftddtteefleejleegnecuffhomhgrihhnpehgihhthhhu sgdrtghomhdpphhoshhtghhrvghsqhhlrdhorhhgpdgvnhhtvghrphhrihhsvggusgdrtg homhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegv uhhlvghrsegvuhhlvghrthhordgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 417E6F60080; Thu, 6 Jan 2022 19:29:40 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-4526-gbc24f4957e-fm-20220105.001-gbc24f495 Mime-Version: 1.0 Message-Id: In-Reply-To: <164131990826.21661.14675569223855830732@wrigleys.postgresql.org> References: <164131990826.21661.14675569223855830732@wrigleys.postgresql.org> Date: Thu, 06 Jan 2022 21:29:16 -0300 From: "Euler Taveira" To: anatoli@rainforce.org, pgsql-docs@lists.postgresql.org Subject: Re: pg_isready docs doesn't specify what exactly it is checking Content-Type: multipart/alternative; boundary=23ab28e74d16448996dc344f83abe7e6 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --23ab28e74d16448996dc344f83abe7e6 Content-Type: text/plain On Tue, Jan 4, 2022, at 3:11 PM, PG Doc comments form wrote: > `pg_isready` docs don't specify how its different from a port probe - what > does on top of checking that a port is open? Does it send some handshake > message that a server responds to when initialization is finished? pg_isready uses a PQping function that reports the current Postgres status. The main advantage of pg_isready is that it uses the Postgres protocol to report the server status. A port probe is not a sufficient step to determine if the server is running and accepting connections. Why? A Postgres server can be running but in a state that disallows connections such as during a startup or crash recovery phase. pg_isready is capable of reporting such state (PQPING_REJECT -- 1) [1]. We could include a sentence explaining that a port probe is not a sufficient condition to successfully connect to a Postgres server because the state machine has more than 2 states. PQping [1] already states "reports the status of the server" and describe each state it provides. Feel free to suggest an improvement to documentation. > People here are telling that `pg_isready` is not reliable and that > `pg_isready` may return when database is not actually ready > https://github.com/docker-library/postgres/issues/880#issuecomment-1004251102 > Without further info about `pg_isready` it is not clear if it should be > filled as a bug. Or if it should be filled as a bug only when an > initialization script is involved. There is no known issues with pg_isready and that report isn't clear. He says "database and/or user wasn't available". What's the exact error message? If there is a reproducible test case, share it here. [1] https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQPINGPARAMS -- Euler Taveira EDB https://www.enterprisedb.com/ --23ab28e74d16448996dc344f83abe7e6 Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Tue, Jan 4, = 2022, at 3:11 PM, PG Doc comments form wrote:
`pg_isready` docs don't specify how its= different from a port probe - what
does on top of checkin= g that a port is open? Does it send some handshake
message= that a server responds to when initialization is finished?
pg_isready uses a PQping function that reports the curren= t Postgres status. The
main advantage of pg_isready is tha= t it uses the Postgres protocol to report
the server statu= s. A port probe is not a sufficient step to determine if the
server is running and accepting connections. Why? A Postgres server c= an be
running but in a state that disallows connections su= ch as during a startup or
crash recovery phase. pg_isready= is capable of reporting such state
(PQPING_REJECT -- 1) [= 1].

We could include a sentence explaining = that a port probe is not a sufficient
condition to success= fully connect to a Postgres server because the state
machi= ne has more than 2 states. PQping [1] already states "reports the status=
of the server" and describe each state it provides. Feel = free to suggest an
improvement to documentation.
=

Peopl= e here are telling that `pg_isready` is not reliable and that
<= div>`pg_isready` may return when database is not actually ready
Without further info abo= ut `pg_isready` it is not clear if it should be
filled as = a bug. Or if it should be filled as a bug only when an
ini= tialization script is involved.
There is no k= nown issues with pg_isready and that report isn't clear. He says
"database and/or user wasn't available". What's the exact error m= essage? If
there is a reproducible test case, share it her= e.




<= div class=3D"signature">--
Euler Tavei= ra
=

--23ab28e74d16448996dc344f83abe7e6--