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 1uoRKA-003yZp-Hr for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2025 18:44:47 +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 1uoRK9-00GNh9-Hj for pgsql-hackers@arkaria.postgresql.org; Tue, 19 Aug 2025 18:44:46 +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 1uoRK9-00GNh0-8F for pgsql-hackers@lists.postgresql.org; Tue, 19 Aug 2025 18:44:45 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uoRK7-000lYx-2R for pgsql-hackers@postgresql.org; Tue, 19 Aug 2025 18:44:45 +0000 Received: by mail-il1-x135.google.com with SMTP id e9e14a558f8ab-3e57376f5abso49301415ab.0 for ; Tue, 19 Aug 2025 11:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755629082; x=1756233882; 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=WzGt/ofWSR/oCBzKSL74RIEoiOhUydTcClpDmGIw4Bk=; b=INdI20GrI6E8XcCC7BjC1TYbX4u7GgIioMYwULBji1NpPnhCcclBJS6b6hGAypEAyN P4PCrIsCKB8GPal/Mthu56hlNMPx1WbxgcUaMDfgrAn39Jr+qvmZzOeG3g3rND+82ZhD Mr4ls4/v5/WUI/xYZ/gtPFe9Pm9I191votXcYDJuqnf1aZNzVRD4A6SUVILHQOXvU9o3 qqzbzIZWGWcSsm6qyORBwP1UUnNwMzfk5z/PZjLiYu0y+Z6g3Y5gNibvj4/v/biHyy4Q 8MgybgDPTGGb5XMwrVGBzsDNTK3afdUhuPFlTNtkcYfvetyHG/QT/XtvQZTNzcE73trM U3xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755629082; x=1756233882; h=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=WzGt/ofWSR/oCBzKSL74RIEoiOhUydTcClpDmGIw4Bk=; b=SrcSi+/LWTRXlQ+94RxDG/Q/hEWW3t8UQkXruWBQYOEENZrUr4INKkkKlUqrdvoKr5 3/E+WKfxl/5jYj2HXLONehhxjkaxDE2pgEXhAzMPiY6ElgSouKRHB+3k/DHADRlpvdPY PNJp6lN69A+lmYTq9ym69De1rga+B6wsgUjnl5b/lnJOSorRZTJY5J127Vg8A9Shz5CN kv2nQnR8wELkjnsOFMU16LRBmCHJHzdiWrcSgIu4HZiRr2jME9LrY5Znx5e5xdp2Lybs 3a/GMKzKwqL2Zd2t/ItUUbC8D+1v76gnmsa6FzqfELY/xKRYrfQxSB+xUNf8q6/heYSa VWxA== X-Forwarded-Encrypted: i=1; AJvYcCV04HmgQQGIy5hgVJqZI9tb+yn4UA23saStlEy+F4ZCHf5nldpoe5t8LRlepXYyzmZGz1vXHs1GFryamTmp@postgresql.org X-Gm-Message-State: AOJu0YzvUO3fk8bFW3+2qmnU4ptmq+dryhr37nldEXB7wnhvuB46Ylug ah1gKFgNkj3D/SP2nzEUv40HkR7HE9l3GG09qSe009GciueWHUeCB+1Y X-Gm-Gg: ASbGncuMm3JlZA82T29FXR08ectKnfqzbnG3wRpCT/2UOEzhh3xX31+75pbjUVRKiRK Xg2FNUOVhVz2cQRkumcNhGUr1L7YwdEZKvHOCXPxVRi3BiHqWKrOFuKWUYzTH8uiJPZPbVlDnjp w0QYyxNijHHB5ICKH15UMcRApJYkBtNcNb/aDcKaMss42NtD6ykSf0iwHb6fzm1YAKAlJMEH5bS LwF3Nv9j9IWXNFJPAPYAjVO9stoqbVZ74ZYU8yfgeChV+lW4edO5qhkyfC6PmI9NwGXMzc7MQ2X 2ejSQne+BHW+mtz01xL5PK97aYr2/yHlHdbe4skeRQg9zDlIqW9x+o1vyuCIR7FfjtL0MHCyLBZ /p6eVQYfk1caKb/q305JGOzvC8IFUK/rtbTzw2zFvL/J5EYjGbnKhdFtSQMFNtxiluEt2VN8pS5 Iyuf0xVBUqwqjc X-Google-Smtp-Source: AGHT+IHQ1pPZnRQ9fEOvzhDIcoSNwFYQfkEA2NZSxv08UK9ZZ2LWuLVCMz3teGGtZ6gm5H938tZqdQ== X-Received: by 2002:a05:6e02:218d:b0:3e5:6a2e:e3cf with SMTP id e9e14a558f8ab-3e67ca08a6dmr2669655ab.10.1755629081967; Tue, 19 Aug 2025 11:44:41 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-50c947f547bsm3691538173.43.2025.08.19.11.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Aug 2025 11:44:41 -0700 (PDT) Date: Tue, 19 Aug 2025 13:44:39 -0500 From: Nathan Bossart To: Andres Freund Cc: Bertrand Drouvot , Sami Imseih , Rahila Syed , pgsql-hackers Subject: Re: Improve LWLock tranche name visibility across backends Message-ID: References: <34drxi6kshtzu5aerftjflrm6wfxxw54emyvy4gqemdpxxuhvm@gymw6its72o7> <5to6tftuml6nkas4jaaljfzecasvslxq3mumeslh74wsol4mzw@rgxpxxlqqwtf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5to6tftuml6nkas4jaaljfzecasvslxq3mumeslh74wsol4mzw@rgxpxxlqqwtf> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Aug 19, 2025 at 02:37:19PM -0400, Andres Freund wrote: > On 2025-08-19 13:31:35 -0500, Nathan Bossart wrote: >> On Tue, Aug 19, 2025 at 02:06:50PM -0400, Andres Freund wrote: >> > Possibly stupid question - is it really worth having a dynamic structure here? >> > The number of tranches is strictly bound, it seems like it'd be simpler to >> > have an array of tranch nmes in shared memory. >> >> Tranches can be allocated post-startup with LWLockNewTrancheId() (e.g., >> autoprewarm). > > Sure, but we don't need to support a large number of tranches. Just make it, > idk, 128 entries long. Adding a dynamically allocated dsm to every server > seems like a waste - ever shared mapping makes fork / exit slower... The other issue is that there's presently no limit on the length of a tranche name registered via LWLockRegisterTranche(). Life would become much simpler if we're willing to put a limit on both that and the number of tranches, but thus far we've been trying to avoid it. -- nathan