Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3fOj-001RFr-2J for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 19:20:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3fOi-007vLB-0u for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 19:20:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3fOh-007vL3-2w for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 19:20:40 +0000 Received: from relay8-d.mail.gandi.net ([217.70.183.201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w3fOf-00000000EFt-0Zdd for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 19:20:39 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1892B3ED64; Fri, 20 Mar 2026 19:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vondra.me; s=gm1; t=1774034436; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GW6PtX8mMv1h4T2BtnB4sz9For/asAsjtZajGToUZ8g=; b=lNAqFqqaNy28sLokuKNd+hgkvHFiPk/gphpjkDDBWZlD9BPUaJAz2cQCfo/25crkc5+YzG HZUxLR3Q0pAmqd363saL7Z+Zm03uYKmAghTdOml61K30Dm5Qp/rE8i0t8b+IuSiiTlMEu9 Ihs3DWfrLXmTiuxspYRwLtNCL5GvjwFiG5sOEBhEHFF/kJb6jho3NQr/uYFuQfOAIczdFf szEzIw85zY90J6qZe5VaqZ6s3Xzc6NGL9kUn/ElB6PYDiWebrvlPwp+AJpdOas50F0g2vq 3WqpVv2AQYTlOTAlZXp3LjU1tTI5rYpUR5buPBZM+AfutThVAKkw3D1/aXna3Q== Message-ID: Date: Fri, 20 Mar 2026 20:20:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Add GoAway protocol message for graceful but fast server shutdown/switchover To: Jelte Fennema-Nio , Zsolt Parragi Cc: PostgreSQL Hackers , Dave Cramer , Jacob Champion , Heikki Linnakangas References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: tomas@vondra.me X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefuddtjeefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomhepvfhomhgrshcugghonhgurhgruceothhomhgrshesvhhonhgurhgrrdhmvgeqnecuggftrfgrthhtvghrnhepledugeeikefglefhgfffuedvleetteevgefhvdeikeefudduuddvhfevudefhfevnecukfhppeekiedrgeelrddvfedtrddvtdeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeeirdegledrvdeftddrvddtiedphhgvlhhopegluddtrddufeejrddtrddvngdpmhgrihhlfhhrohhmpehtohhmrghssehvohhnughrrgdrmhgvpdhqihgupedukeelvdeufefgffeigedpmhhouggvpehsmhhtphhouhhtpdhnsggprhgtphhtthhopeeipdhrtghpthhtohepphhoshhtghhrvghssehjvghlthgvfhdrnhhlpdhrtghpthhtohepiihsohhlthdrphgrrhhrrghgihesphgvrhgtohhnrgdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopegurghvvggtrhgrmhgvrhesghhmrghilhdrtghomhdprhgtphhtthhopehjrggto hgsrdgthhgrmhhpihhonhesvghnthgvrhhprhhishgvuggsrdgtohhmpdhrtghpthhtohephhhlihhnnhgrkhgrsehikhhirdhfih X-GND-State: clean X-GND-Score: -100 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I've looked at this patch today, to check if there's something we could get done in PG19. I find it a bit we didn't get much feedback from people working on the client/downstream stuff - clients, connection poolers/middleware, that sort of stuff. OK, we did hear from Kiril, and he seems to like it. I'm not very involved in the protocol stuff, so I'm sure there's a lot details I'm missing. It'd be very helpful if there was some sort of PoC support on the pooler/client side, so that I can experiment with it and see how helpful the new protocol message is. But I realize that's a bit too much to ask for. A couple thoughts about this (some of this may be missing what the patch aims to do). * Does it make sense to tie this to smart shutdowns? I realize it's just an example, and it probably makes sense to send the GoAway message before a shutdown. But isn't this a bit similar to cancel/terminate of a backend? Why not to have a pg_goaway_backend() function, that'd send the message to a single backend? It might be useful for load-balancing, if we could pick a "heavy" backend and ask it to reconnect / move to a different replica. (Could that be handled by a middleware?) * In fact, does it improve the smart shutdown case in practice? Let's say we have a single instance, and we're restarting it. It'll send GoAway to all the clients, the good clients will try to reconnect. But if there's even a single "bad" client ignoring the GoAway, all the well-behaved clients will get stuck. Ofc, that can happen without the GoAway message too - a client may disconnect because of timeout etc. But it makes it more likely, and it'll affect the well-behaved clients. * Would it make sense to have some payload in the GoAway message? I'm thinking about (a) some deadline by which the client should disconnect, e.g. time of planned restart / shutdown, (b) priority, expressing how much the client should try to disconnect (and maybe take more drastic actions). Also, two minor comments: * The sgml docs say the function is defined as int PQgoAwayReceived(const PGconn *conn); but in the .h file it's defined without the "const". * The new entry in protocol.sgml (in the "Supported Protocol Extensions" table) says goaway but the following table includes "_pq_" in the entry name. Should the new entry do the same? regards -- Tomas Vondra