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.94.2) (envelope-from ) id 1r2PoH-00GaDX-42 for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Nov 2023 05:48:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r2PoF-00D8W9-LU for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Nov 2023 05:48:31 +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.94.2) (envelope-from ) id 1r2PoE-00D8VP-4w for pgsql-hackers@lists.postgresql.org; Mon, 13 Nov 2023 05:48:31 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r2PoB-005JdZ-3F for pgsql-hackers@lists.postgresql.org; Mon, 13 Nov 2023 05:48:28 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 666075C00DC; Mon, 13 Nov 2023 00:48:26 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 13 Nov 2023 00:48:26 -0500 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:sender :subject:subject:to:to; s=fm3; t=1699854506; x=1699940906; bh=OD 7cqbKtGMrZOVSMpsX6Xxf9rttpT6ttC99euBm0GoU=; b=H/Mraw1kaA3Wh5erWq rgmtIBE8CPWJlu4bA0mjhDqVCCrg+As4z8bwRhdZkGfOmkm05YN+44W6g9I5/WCI b6ouCIvCYoWZkUs+dyrIkT1l5OIwsiHvFvBkkeDCH9NLX7J2OBV8QcPyY1cNp70Z zl7OwLqEqcEGSC0Z8ormtFuMiy3k9ws+M9NB4RPO9/9GY7A+xyeCc6hJsR8Kj4yo VkEqvCL33n0EUX7deASFTeOWMADldf20FS6xw928GiE10AH2Npu29miRhc4kHH1Y XB4KezaZyleyBcMb6ZU3LLewUTp4sD82gxe7pVRxvYXsWusG+sMdOZlwJCeGn/5W vRag== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1699854506; x=1699940906; bh=OD7cqbKtGMrZO VSMpsX6Xxf9rttpT6ttC99euBm0GoU=; b=LcvllrT0hmxMNziFo+Du7kHnkfTzZ 09HtQq9cACPBujUe6bMbV1uIAwwaeG/vCtnQqj+tTn4hnl+rEdg9YLVlsoADoegt N+0dGVUaHa0HJLi7vBVZW4w+pQJDbf830iovs2eUU9Fc/+DmIMBD0H5FCFiuwqVm sQoTqvAxR8RudYlZ8qkgvfW7fASaARzp+eeMeN5DmBNQ+QK/sPK2M09FcIuTRnpV xuWXY7e3lCMYgIMstHyFw/J1Qe4p95TenhaqWSU57FrZfAJsWDkSTWTwRuDTXHr5 0YbzS0KBI9UT446F5Ozn+XBKDHiEkHHLUn6tY98njW4nmnFNakEZ3GfNg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddvledgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 13 Nov 2023 00:48:24 -0500 (EST) Date: Mon, 13 Nov 2023 14:48:13 +0900 From: Michael Paquier To: Nathan Bossart Cc: Nazir Bilal Yavuz , Postgres hackers Subject: Re: Adding facility for injection points (or probe points?) for more advanced tests Message-ID: References: <20231110204425.GA1315705@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TzHCXRGPYc1YFMjQ" Content-Disposition: inline In-Reply-To: <20231110204425.GA1315705@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TzHCXRGPYc1YFMjQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Nov 10, 2023 at 02:44:25PM -0600, Nathan Bossart wrote: > On Tue, Nov 07, 2023 at 05:01:16PM +0900, Michael Paquier wrote: >> +#ifdef USE_INJECTION_POINTS >> +#define INJECTION_POINT_RUN(name) InjectionPointRun(name) >> +#else >> +#define INJECTION_POINT_RUN(name) ((void) name) >> +#endif >=20 > nitpick: Why is the non-injection-point version "(void) name"? I see > "(void) true" used elsewhere for this purpose. Or (void) 0. >> + >> + Here is an example of callback for >> + InjectionPointCallback: >> + >> +static void >> +custom_injection_callback(const char *name) >> +{ >> + elog(NOTICE, "%s: executed custom callback", name); >> +} >> + >=20 > Why do we provide the name to the callback functions? This is for the use of the same callback across multiple points, and tracking the name of the event happening was making sense to me to know which code path is being taken when a callback is called. One thing that I got in mind as well here is to be able to register custom wait events based on the name of the callback taken, for example on a=20 condition variable, a latch or a named LWLock. > Overall, the design looks pretty good to me. I think it's a good idea to > keep it simple to start with. Since this is really only intended for > special tests that run in special builds, it seems like we ought to be ab= le > to change it easily in the future as needed. Yes, my first idea is to keep the initial design minimal and take the temperature. As far as I can see, there seem to not be any strong objection with this basic design, still I agree that I need to show a bit more code about its usability. I have some SQL and recovery cases where this is handy and these have piled over time, including at least two/three of them with more basic APIs in the test module may make sense in the initial batch of what I am proposing here. -- Michael --TzHCXRGPYc1YFMjQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmVRuJ0ACgkQnvQgOdby QH3s1A/8CJ7XPGhzCMnl6w/AyYt7Vlt7Iat6IvVDG6FT5rvHTmD33MK/eI/z6B0Z zSvqkMfM0D3t2YrDMxl5eGWLJsgnqyFzM5Ythbm07RjTX1NAbY0OIFPQyI8fv039 eRum57oGYHpHbDJ8dK2PJId4NcEJhoBYviuuKNfnYlJL7yF4k3zR/kOsDQlHV72U e2v7+ap7OtDVdGHkknX+cASAM03eGOz+poQgYnUTRs0aJZoHQRDQ2Ir8kL+3sYED j04rknPjBt6d6Z0oIu0+WQTz5s3hLipHW8LqTig7mye6EbzYL9089DQ+e/x7GUb2 jL/4kTUYRBEcaTEGPquOUMUgs//IGEqQGnZpR/hTAb9KpHmaBUZViFIJh/e7AqOg GvBPU2Wvu3Hdv7pTseY1bEJsE1QeDKdbkzP7IzauUoP5yhaDX+3OEgAS3UKRFnyM LVCP2fjggYsET3LUXVxwa59/fEmDux6MtH6tZcxLuySE28YSKS9fHwxufxbJJ5aj 07anbCXOL3PEtvEZS3u2HG/FdqeKVqTotgYTIWXi3nVFX3CG7KOf2xPUhqOG29as R+I0YjyCX1lNpLdYpV4BnfUTF5u2vE6Q4AvOYypw9fvIK1Tj5YltboF+FwQkakJm dn1ChPZvGsndjLi/c5bEumn25p+odI3571rPsayzjENFJIqg1P4= =ebQ6 -----END PGP SIGNATURE----- --TzHCXRGPYc1YFMjQ--