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 1wSk16-0003yx-2s for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2026 23:19:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSk14-000qwA-0R for pgsql-hackers@arkaria.postgresql.org; Thu, 28 May 2026 23:19:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSk12-000qw2-2B for pgsql-hackers@lists.postgresql.org; Thu, 28 May 2026 23:19:54 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wSk10-000000002AX-2ykY for pgsql-hackers@lists.postgresql.org; Thu, 28 May 2026 23:19:52 +0000 Received: from phl-compute-09.internal (phl-compute-09.internal [10.202.2.49]) by mailfhigh.stl.internal (Postfix) with ESMTP id 7521D7A0104; Thu, 28 May 2026 19:19:49 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Thu, 28 May 2026 19:19:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1780010389; x=1780096789; bh=eu+bilgABq qmpATZmU3vHagOmdnYcImVkQlzHQ+sRdM=; b=Dfsxn0uLmTnyt6M5RB/AyqYubQ Mvko1AEra0fcrwJM1Sj/W3Y2YdmLDHuN55H1A1aJqLZyexlLEMK0s1Ua/6qjp77q 57L5j0fSPNB3eVNulNLR+9CVPhc1+1Zqr2Nsp6DEFYoFjKdQZAvXKniYORlW5ahq ZGy8FQQkdLOaf8nWxunJkuADihOlI0nGla5u8N6c9KrbWidiifRfqfbEbO7Tn3oS lLHkAtaMnBmdc/J2k91VBPF8EvvG6rDCLdVqSpxMAIugjQ3CrzYrSYK8Ct0V3oOU LbWQXjXlQPBsTiFdp4acD/XNzC2jpXsZEDwgEEvQVK2/jEifeTU0nnJaLMdg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1780010389; x=1780096789; bh=eu+bilgABqqmpATZmU3vHagOmdnYcImVkQl zHQ+sRdM=; b=bZbpHoaeijGNV7t8jVj7ubxo8KwQ1g+X7ysrLyLr7bzgG/w88F2 3P31dghc64Wo2ks2UH1ekcKIQg4ibmxtJkpRwV7LreGekvBK1+jWSv0XNFbxkZ1L SOBhql+qKm7oQF382Ztgjp4mhp79a4XyMGjG/KA2Gpnif8ZNEnt7rfVP+Xcxmafo ic8trULb/Rj9XJ5b1QFIqdOIfX5ECdxj4D4ITzyZ2wF0uhXLmx/eHnwKKoJLIGWY h/fqGu0dpxbvIWhh5TWn+LOQIUgq7tVbLPDJ9BQyj1DOwxTSf0pmgyud6HEsLUMN jthQ3BkYB5oHeCubUo2HRDTDOD92qrRmkWw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTEFAIZueLIYzM3CJBUvNjO5FZ8jZM5meyMBLk+vg5z+FGR5+4H533R2ULZaPYRd9U 585VUeuL+wTogVLpP30F00xUwZm+PPDZockpKNibttBxjiRpwlOpPqCxl1LpG8ZDV0KpCE 5Bi1b4saVv8JbDaQHmk7xqKpoz7U1IkNuagRjU99z7XGKWSLARODQTbgdhQQmFYNYJipFM 8DwCl70FYUoj4NeM2ajuNkycgHui2m1fFZQpUpRhY6KkKNkcneaAfWMk4FZq/Cl5vme9kI Wb97/58t8QZzw/bpKoc4He/isODMwnTd4fO8zccLq/W7Eb5gb9mOUR8X2LIBnougkIgEH6 pr1M5BIuYC6xGsod5Bg/KfyEYJD4VFcqyOLAlvNmSjnhtrkDMVhNqSPD79/JqmWaV8CyTd hdHGdJwvgv1b59ytuVxscrpiTo4FNlQ5rFklS5VSmnNTD6TE7hugRbVET1sdl8hAaXSY57 R42fp8Xl15PGGK1Yd+QKOmm7z/JuaTXbMoa92WK4uBOJEjTLn6sBGmBhqvs1Bp7INsRoht kYbxOINfmcWW5xIrK2NYvt+9qPte5JbGo8YL11w4oGWU0obBBQr4hXKBTV3KYK9MsduJDw IiJm6nhW201uyi03+f4CgTp1ko3cETAlHC4/gzML6gMqf4oTFXFeY67Vhtsw X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 28 May 2026 19:19:47 -0400 (EDT) Date: Fri, 29 May 2026 08:19:42 +0900 From: Michael Paquier To: Robert Haas Cc: Postgres hackers , Andrey Borodin Subject: Re: injection_points: Switch wait/wakeup to use atomics rather than latches Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="JQY+Zz8OzOiLi+Sk" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --JQY+Zz8OzOiLi+Sk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, May 28, 2026 at 08:40:39AM -0400, Robert Haas wrote: > After reading this email, the linked-to email, and the commit message > for the patch, I still don't have a clear understanding of what this > is intended to fix. It seems like it's going to make the > responsiveness worse. In general, we want to replace escalating wait > loops with things that wake up instantly at the right time, and this > is going in the opposite direction. This is an exchange between responsiveness of the system and flexibility. I have had two complaints in the past about the fact that the waits and wakeups were not doable due to the fact that we rely on condition variables and latches: - Postmaster context (lack of dsm access as one). Heikki has mentioned that to me once as annoying when hacking on tests there at protocol level, at least. - Second case as shown on the previous thread, which was a tricky scenario involving the termination of backends. One limitation is also related to wait event visibility, which may not be visible in pg_stat_activity. We could simply add a LOG entry in injection_wait() once the old count is read, and rely on a server log lookup in the TAP tests where we cannot use pg_stat_activity. Compared to redesigning all the facilities that injection_points relies on, this patch was striking me as having a good balance in terms of responsiveness (min 10us, max 100ms) vs portability. The minimum threshold does not really matter much in terms of runtime on fast machines. Does this explanation make sense? -- Michael --JQY+Zz8OzOiLi+Sk Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmoYzY4ACgkQnvQgOdby QH2wFg/+ODdm/q/KjGXcCJn84FKx/IhSEF7Q1TE2HgUZQG2di+uATOTH0d/kyW+R 9TndDiMYKTGurLPiyWOgaGQRCTNOcWrgd4gU/rIpkD1A9gSbDsa0KEIfCRekZLEo OvMLKghIew6GnSmxu6sg1T6+QKFMUBCNMvcbsKvdK3NaVDy+SHx4jWaInurhpkLE ohOYM4gQG+fljsCVU1srna7gvJR6IlO5QVldhJ8f8A5hLlzUyKN4CbEk9ZDdf93H ZlX3ZfE7J3BPJJHbqtUJaxYLlpAS4kfzUEODltj5O9rH1iEefD+XTuQ5Xba2seit POnHhUaFzzLQzX3wIhR5UPniytFGHbIAYeUhBOMpagF9EXEstiAvIXo+X/RHGd2a v+SmgjlkqIE5nHFPKhu3JR8wJgDESc9fkQMOp23U2SxONuO3AL1KxFRGcprzj5Bi TJuUgaHHa7L35X4I1UO8QKgPdbYIKaWngGiOz9tgRWB9Z/WJDN6F8crSS/gqBlsG 5uabwq6BqHIDBHtjCwzUPVgmBG3geAVoTXTOTGsniUdrAb6EFdOd99LLK4EGtOko SgPzc3gwYL7jRsES/dNcA6jaKt46+LoVEE65EtSAyluqEAekS/G1mPmkrTUdw11D Q6J/7H9Tamld7wJAJt5qsdf/NmCxRt2O3CxXBkY1lUlOCE0LYCs= =/cSQ -----END PGP SIGNATURE----- --JQY+Zz8OzOiLi+Sk--