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 1s5DM0-003zVT-9E for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2024 23:39:12 +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 1s5DLy-00BWdV-0n for pgsql-hackers@arkaria.postgresql.org; Thu, 09 May 2024 23:39:10 +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.94.2) (envelope-from ) id 1s5DLx-00BWdN-Ga for pgsql-hackers@lists.postgresql.org; Thu, 09 May 2024 23:39:10 +0000 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s5DLs-000GAI-My for pgsql-hackers@postgresql.org; Thu, 09 May 2024 23:39:08 +0000 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-debaa161ae3so1541866276.1 for ; Thu, 09 May 2024 16:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1715297943; x=1715902743; darn=postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=RhJkO4NIjGFO8OkgfvG6lYE1hf6BUcXSN3pItu66eHQ=; b=PhoFSCw0VqwTqTzc7kWFQJMX1N9wsrXcpSLyRefx4TA54MRsQzEDNqD/PepLNQ13iZ KwbhJm2LmCtF3JyywYRoAiJl4ofMAZTwmWGvogkM54YCoWMdyGnA6+z1r/n7gGd5aHpw yNQNZcLijWCTKYwPgyNuTkNXjLcB2yLAMhrto= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715297943; x=1715902743; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RhJkO4NIjGFO8OkgfvG6lYE1hf6BUcXSN3pItu66eHQ=; b=a85ET9jTD2jUlZEgbVINhwq53fgS9isSnuDc9vn3jySKYUHo3QjMiPSa9fJIanLes5 Q3NIdwLoP3PCxboYVu55leoOhJmo6dW/cG3jPwouCJ8jHClQB3C6fkhVTbAbmZfScaBI UeHTLBHjP3n/gscO1z42wA2ahsLzt1WAxWJMBwJNyrDwe4L8Q0IDE8WyvD+nYmH4X4bX NGbIjhHKexryXJqrucCNFfrHcBCuBMhjNGlcyM98SdYOvKRNpGQKFKRV6sjKbit1AT+x CrjPmLRVAjn2lexzN7zW7SuMQKW4+KsnLT8g/LS7Q3tnc+n9h4y30sfP8wHKRsOj4Fwb VtpQ== X-Forwarded-Encrypted: i=1; AJvYcCWm1eCCvRQhMHDUOQGQuA3YvFG8mAXlgL/9iRc0n9E9ZwoiyGX3xaNVrZ0EjrQhc/PWXI73IUDR3oMK2mHXFdkoSYFzPDC1j/fxlAqX X-Gm-Message-State: AOJu0YzysGbW2rRwfIbZKmM17Y0F+uvf+nhToMmcetw1XrYm7AzhzKHK ApCj4P4vyW9dZwHQgGLWzq8aIgzlTCW2o1XxEEJwjjn8Pv22KaE/bTAF9L/nkA== X-Google-Smtp-Source: AGHT+IFzR+6TNg/L9fRALmkvj67eLaw37/uNRXzznl1hhN1ji/xgnjoxK27RA0oj8MzEP1zEfCRBbg== X-Received: by 2002:a5b:985:0:b0:de4:680c:1a16 with SMTP id 3f1490d57ef6-dee4f4c3109mr1169663276.50.1715297943601; Thu, 09 May 2024 16:39:03 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-debd3744081sm526356276.32.2024.05.09.16.39.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 May 2024 16:39:02 -0700 (PDT) Date: Thu, 9 May 2024 16:39:00 -0700 From: Noah Misch To: Michael Paquier Cc: Heikki Linnakangas , Tom Lane , pgsql-hackers Subject: Re: Weird test mixup Message-ID: <20240509233900.4e.nmisch@google.com> References: <20240502193555.a1.nmisch@google.com> <20240506212324.2e.nmisch@google.com> <20240507185310.d3@rfd.leadboat.com> <20240509031553.47@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, May 09, 2024 at 04:40:43PM +0900, Michael Paquier wrote: > So I like your suggestion. This version closes the race window > between the shmem exit detach in backend A and a concurrent backend B > running a point local to A so as B will never run the local point of > A. However, it can cause a failure in the shmem exit callback of > backend A if backend B does a detach of a point local to A because A > tracks its local points with a static list in its TopMemoryContext, at > least in the attached. The second case could be solved by tracking > the list of local points in the module's InjectionPointSharedState, > but is this case really worth the complications it adds in the module > knowing that the first case would be solid enough? Perhaps not. > > Another idea I have for the second case is to make > InjectionPointDetach() a bit "softer", by returning a boolean status > rather than fail if the detach cannot be done, so as the shmem exit > callback can still loop through the entries it has in store. The return-bool approach sounds fine. Up to you whether to do in this patch, else I'll do it when I add the test. > It could > always be possible that a concurrent backend does a detach followed by > an attach with the same name, causing the shmem exit callback to drop > a point it should not, but that's not really a plausible case IMO :) Agreed. It's reasonable to expect test cases to serialize backend exits, attach calls, and detach calls. If we need to fix that later, we can use attachment serial numbers. > --- a/src/test/modules/injection_points/injection_points.c > +++ b/src/test/modules/injection_points/injection_points.c > +typedef enum InjectionPointConditionType > +{ > + INJ_CONDITION_INVALID = 0, I'd name this INJ_CONDITION_UNCONDITIONAL or INJ_CONDITION_ALWAYS. INVALID sounds like a can't-happen event or an injection point that never runs. Otherwise, the patch looks good and makes src/test/modules/gin safe for installcheck. Thanks.