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 1uaLlO-0048xg-9v for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Jul 2025 21:58:38 +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 1uaLlM-007NnX-Cb for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Jul 2025 21:58:37 +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 1uaLlM-007NnP-3C for pgsql-hackers@lists.postgresql.org; Fri, 11 Jul 2025 21:58:36 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uaLlK-0075or-29 for pgsql-hackers@postgresql.org; Fri, 11 Jul 2025 21:58:36 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3df2fb6378cso8621875ab.0 for ; Fri, 11 Jul 2025 14:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752271113; x=1752875913; 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=2IMZtQx5ALTktB8YApZueIf9BQ/0zB5F6eZ+9r0Oti0=; b=Ec8KyZlvMMK2tygkkrrbXmlSY4HC3xHk72lISeHfSvCFiCvzjzAg+PXcuqR3nyjxfT dVSj8QREB24nTqysyPA5NxnUYikVzJwhmVdWeqUR0BCOwWDbvvo5VvJFARfeP1J/ZXWK Pr6Ou8+Su/jU0p88Fji3jz08vsfuuIHNkESOwYkil/YyAo2zd8Ocpy0+xKCsiiiW0zq1 WaKLo9ve23QOkRfosTPBpXGqDnLucFNSYAunlQ3/bskV+Unt3Zcw8lQy8wSEbLd1mfcD jAimmMa29qXbhBl8CMCbX6tuOqNcluvXKE7F58Og18O/6Mhv6C+NkYsnpddlbvJasSVI UNFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752271113; x=1752875913; 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=2IMZtQx5ALTktB8YApZueIf9BQ/0zB5F6eZ+9r0Oti0=; b=M2fd1e2VvA4fITCxOJHIwSxvqJwRTgOcI0uRQtz4I4E9+NtyuiLHjnWD3Hbxm0f/9q MZWxIb6BzZG7zq0pNuByru2BaMJE7V8uA+XJIcmQNIvhJOw6KjzdD3trKKVrFBOkD+dQ WlbPZEdbOaA86EObMPeCv9IYVOVtUyi7suzo+Hz7qahdY8VJYGIftiKuwwFw1ifGxFPS Wzjh2etuAN09fa4FkJ9kcFJcJA1wukInJ7nEskZXht6+qH5gZz3E3D/XrkVKoZAuGiNG 63wYtLWOdN6PlFcyXn2wj2IZoN2RzBFQUCGge07Ena7svZCxhzOxHeu7rOEXecOgWr2J Kx+w== X-Forwarded-Encrypted: i=1; AJvYcCUJfupTsr+nL13SiPqgnjQuoAzTj0Zrt+ZGnGTAGJEbm9jNcVhfToBSSqfzn+iHrsndWjEXhuElKdrM4bUL@postgresql.org X-Gm-Message-State: AOJu0Yx/qtT4l0z3dW8b2CPZxC9EqrUWBm5T0DK4vZlbPPqXPomp6bQi +2h8tCPaINNBu8LT0MTEuCYyI2VmuqI6L6VWe0HctjnD+3LaM3JbGaQy X-Gm-Gg: ASbGncv1oLHT8/JHhtt49xdA55+UJ6k8N/xrs6Fkol0aQtHhy+oD7INLw99xHRAASlj cibEfQ3sV5bBgwQxP/ZnHI3Sf3uAlfzrkuSb10WlVtM9xAuesmids83pc33K/4EMlxpgeZy8+ms G7GZYWw27sL8LdmOhhJdDDpbq8mENjr2LcU/UpTMlUJEn2P+fTwnL66QWpP2e3okHUgfNRFxBfu aJe6xk7mpoP/04iDLwqdj9jM5O4UO8vnWEsxmeDd75XDXDxOL2zsy8qGyUvcu1sPwyA0+hru3dp JNNJ2Zv5sQTV2stI1MB5pZvlVYYMNdwk9c366Zr/t8Z+h9A0taVV4+h8XfsORSfk2wVUNnxYaHH 0pnnFz8oQu0rmU6W6HEPbTICrVlX7WDRfe1KkI6HtvHKdgmB0ng9Nhcw/gYGLtMDxpPJFduK4uL MF0IByF3xnmK4W X-Google-Smtp-Source: AGHT+IGduPZcSYAtXXdzqe7KveRSIkbRwqm4FiSX8MzOjnMKf+HgBDl6gflPicXfswLDPXGHHJSQlA== X-Received: by 2002:a05:6e02:12eb:b0:3dd:bb7e:ca89 with SMTP id e9e14a558f8ab-3e253607283mr63400535ab.10.1752271112762; Fri, 11 Jul 2025 14:58:32 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3e2461344c9sm14554715ab.16.2025.07.11.14.58.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jul 2025 14:58:32 -0700 (PDT) Date: Fri, 11 Jul 2025 16:58:30 -0500 From: Nathan Bossart To: Sami Imseih Cc: Bertrand Drouvot , 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 Fri, Jul 11, 2025 at 04:32:13PM -0500, Sami Imseih wrote: > Now, what I think will be a good API is to provide an alternative to > LWLockRegisterTranche, > which now takes in both a tranche ID and tranche_name. The new API I propose is > LWLockRegisterTrancheWaitEventCustom which takes only a tranche_name > and internally > calls WaitEventCustomNew to add a new wait_event_info to the hash > table. The wait_event_info > is made up of classId = PG_WAIT_LWLOCK and LWLockNewTrancheId(). > > I prefer we implement a new API for this to make it explicit that this > API will both register > a tranche and create a custom wait event. I do not think we should get > rid of LWLockRegisterTranche > because it is used by CreateLWLocks during startup and I don't see a > reason to change that. > See the attached v1. Hm. I was thinking we could have LWLockNewTrancheId() take care of registering the name. The CreateLWLocks() case strikes me as a special path. IMHO LWLockRegisterTranche() should go away. > Is there a concern with a custom wait event to be created implicitly > via the GetNamed* APIs? I'm not sure I see any particular advantage to using custom wait events versus a dedicated LWLock tranche name table. If anything, the limits on the number of tranches and the lengths of the names gives me pause. -- nathan