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 1vIUim-003FVt-1t for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 16:26:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIUik-001SH8-15 for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 16:26:22 +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 1vIUik-001SGz-06 for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 16:26:22 +0000 Received: from mail-il1-x133.google.com ([2607:f8b0:4864:20::133]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIUii-006P22-1e for pgsql-hackers@postgresql.org; Mon, 10 Nov 2025 16:26:21 +0000 Received: by mail-il1-x133.google.com with SMTP id e9e14a558f8ab-4335726d0f2so12459825ab.1 for ; Mon, 10 Nov 2025 08:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762791980; x=1763396780; darn=postgresql.org; h=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=aewmkdbRKmKXhlIKuRa5YojG3IEUzJanNANWoTg9YJQ=; b=WOlm4063CeKGb1PZcHHUzqtVB4jtX0S22jfn0DXO6Rd7LfU/IFrOBce+La8llbyFcw IjCAG370r0BYML1l1tMVRjc+Qfs0bOWmjMBlOPM8rdua4Cv3QBurJnDCYNsVKDPbYuJn oCc74o/lJUShH1Hmq24Qb8w+QijXaeZF7jcVCpK9N9zUPvv2WPrD0kHcUBDLnk0yRm6D bOK+VuOVhyoYRPeJ1OWjN1Jk5ui6GikG1pWfBopnB1P7TkCdI/HF/05aL0vklNGwHura a4sZhdReWN8m/ZDo2H5KuNz0qGo2UznWJ6xexWxz67vj4CGC92DYWUNMdQMSxxKSRUoI x6yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762791980; x=1763396780; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aewmkdbRKmKXhlIKuRa5YojG3IEUzJanNANWoTg9YJQ=; b=bjeDUZrZnDJ/tmAKVHVzdrDVCs/ewamRsUj8cUKAHsFXjOP/NaarfliQErEgzXTnfs viNnrnuQTvwzDyAJblO5NSMKU+fMlGBtP18BTGSc1/UE2Pa0r0AXBDBzBBovjBmsI4hS pkfX6W1sKqLBORjQ61wQlOGxzITT74QJFsjh6g8uS9y92q/W+groFs7S5lWVEHdkc7xp 3cZPlKUNgGwxg17CJt4rLq8M5rBb+OAKhS1EHdpKG3k3KFJdNXuxIhQ52x9sOxHpOZ0z +whRaHqj9MzRVVsCLG1q7lnkJ/g9gNp4vZzBaiNjxO3Mqciz990s1qdVXK3lie8czKZP nuSg== X-Forwarded-Encrypted: i=1; AJvYcCXBB7YmGceyS/T35Jwvh8EKUYL7K0NFgRjhGlj8nAoiDgxR9iTK6iAUiqS5ON/dIrJcn+PQGkIlAizcEoEP@postgresql.org X-Gm-Message-State: AOJu0YyHEZxp8eJmUdt9fENmctq7VhGY4LraLHTDT9rdvBCK2lIU8yVP jUY/gFAUz2uS3MZY5FLIhG+yxOTh2mrP6WjwJ4tO/+v5fYTXXtEd+iTdN/RhSg== X-Gm-Gg: ASbGncsIhXhs5P/7UYlhEJCVGO0D67fWGzps1+kh9Y6eVqz32tHaKyfGukh/VThX3lO 0uYVIrKOFOUtNngzompUvjCppWhl+/LS0IgfA5NQ9eChr/Yzaxx0Q0BCyUscrGmqb3yIoyqe8js FZiGl8xdJFGPuI65pjB0oK1LjsqjsWJU2uSfAjFvXiTU9PhnkTb9kufdBhUHy1bWYqa6fELsPod ahOLeViMsgt4X+obhNhulW1RJZuPiquR7AILTW/jIej3JTYUhQK1dyN7WQERzJXkzNMZ3QDEdZU Hn6Jkg57rN0vnOZaTBvd1jKCG6WnCXtiu72bCMb7cZBbsMmHKP5sWhiXcUQLteYQ7sJ+nBMr4z5 EIVjpt/tBKHrIGt82hEJnxmVM3I9XAsTsI7Hv49w45hXXj1sNF91riomsdobkE41gs9vbSFYUlV KYwRp5U+rl1jnbmJF2RF3ADEcsjCV1PbO7H/9tJRc0XtF28pqLJ3b7GX8FEPsvwKfPTA== X-Google-Smtp-Source: AGHT+IGhG6+56KjrjSHy3yTt7qvs9AqtL/qUphbDPmv78F4DSCpixthg8Y99vrgFovQ7+Sic7BiKXA== X-Received: by 2002:a05:6e02:1747:b0:433:2072:9d2c with SMTP id e9e14a558f8ab-43367ddda84mr139575055ab.10.1762791979748; Mon, 10 Nov 2025 08:26:19 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-4334f4c8213sm57919065ab.21.2025.11.10.08.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Nov 2025 08:26:18 -0800 (PST) Date: Mon, 10 Nov 2025 10:26:17 -0600 From: Nathan Bossart To: Sami Imseih Cc: Alexander Lakhin , Rahila Syed , Bertrand Drouvot , Tom Lane , Andres Freund , pgsql-hackers Subject: Re: Improve LWLock tranche name visibility across backends Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Nov 03, 2025 at 11:50:48AM -0600, Sami Imseih wrote: >>> I am not sure we need to do anything about this. >> >> Or maybe we just avoid the tranche_id from leaking >> in test_dsa_resowners() by making it a static variable >> and checking if we have a valid tranche id before calling >> LWLockNewTrancheId()? That is the proper pattern. > > Like the attached. It's probably a good idea to avoid tranche leaks, but IMHO there's room for improvement in the DSM registry, too. IIUC the problem is that the DSM segment is still being added to the registry and found by other backends despite the initialization callback failing. My first instinct is that we should keep track of whether the DSM segments/DSAs/dshash tables in the registry have been fully initialized and to just ERROR in other backends when attaching if they aren't. That shouldn't really happen in practice, but it'd be good to avoid the strange errors, anyway. -- nathan