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 1w5nfX-003drh-0O for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 16:34:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w5nfV-003oxd-1f for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Mar 2026 16:34:49 +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.96) (envelope-from ) id 1w5nfV-003oxU-0D for pgsql-hackers@lists.postgresql.org; Thu, 26 Mar 2026 16:34:49 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w5nfS-00000001JX5-3fzw for pgsql-hackers@postgresql.org; Thu, 26 Mar 2026 16:34:49 +0000 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-b980c65b97aso187435566b.0 for ; Thu, 26 Mar 2026 09:34:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774542885; cv=none; d=google.com; s=arc-20240605; b=LvqrFYwEJlWdpYW3ERCSgRaxXt0Z2RGKFKnWEKLx6CRUx+2lAmurwgX92I4jCMUKLF QEhpc9T7lr048Pc10jOcV+YjYaicSi9hBZVpqwVxHviX5L/yJXUmHOQCRBm9N3ktbTDo 6sWLxpan3dFCcPOwvC0/SB2V/Befn4UlrtxSNuhx0IxrtjZNtmTAXOjC3Njr31QlNslA xNwI/R9m1i8I9Y83gGFHMMr/UTehoDZ442hC7W4RYf+lQpYuBzyXL39vOAmB4FoMI6Iu CM/5RDnS7HPSJMhHoP15uMo7NMPEHfTN+boPoTmvolEXK9jqGfsE0E4MfZR9l9MbvJ5W AJVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=2SfHkcwHikpjbqAiSYKEiqpOdpk9X9Tp/LlKPDXwYho=; fh=E9d4ls7PmnhLYju5DBya/XpBmjQofjmQ5Vjh2pqB/4c=; b=U2H/sj7ogoAz/zuAC4SAPTNbfe6QFHBp6K88c335qDfgIj4apHcaEnC868EA5vwamC ozCkbuh0T+0MdhxWIhSRIunM6kQKK5vORjepLP6thplSwwxU6ASZIG2Pb9ZNypUx5Qq/ +ngNNk0Vogr+w/W5oAmMNBhvo0iObeZmtgOb2d+WcwoNmvFo8MEO76spJ4MTil8leaCr XX0z9UYNeADqXTZpF1A+K9ol0Bn1CgJPmYFrRkibG/Z91U5yYLYvyqWCtqwpymyAVOcK pYSEmrKeja2Uc6wWBbAUmR1N3D9jwJue2yWBKQBx+3hzDN1Pw3mpKpe3aPeQWXGuIESi hANw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774542885; x=1775147685; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2SfHkcwHikpjbqAiSYKEiqpOdpk9X9Tp/LlKPDXwYho=; b=EKv7Wy2p440DRfkMEJ91rW/2W3ER5OOaOqfM28wlBlydTpkLXczriC3Uxmpo1iDpdm bjhWhtefk6SsvbT2KwM63wuZL/1wnCchVHBPw9fP/aQAepWsJqRmD3kpIzlVJD72IyEp aQrjo/zKx98ycvA/CgNcXQsI1r+a3ujfrPDAQIC7n8MW0KIeyEATG0fQSdwbiCj2d5dT FmFFt8SnbgYt+WOEUBKbla7WOUr9+1UXomEnV6yTcjFLJ9J757VSEBcM9gEMtahybnt1 4M8oX1/LFT4pNRqaG5buitJ2pwZiKQcnQ0Re6Y/pv4+IBqfWeXNBewia7hVV168Hrxyo 6Rjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774542885; x=1775147685; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2SfHkcwHikpjbqAiSYKEiqpOdpk9X9Tp/LlKPDXwYho=; b=kCKWqmaxT2T3S1wvUqMoAOjadCA6GMV4anoHcSyKu3klj9a36Jant98CR7aLe+X7UF LS+FYa8FOB1AST/5JNa/r78kj4ZFpyklOJDXhS4J4TJEej2QpKjgu8CVVOyngSc3RRSD 5hxuGGT4+kBW6a5h1Fh6rwTKnMiiYHOX3Mw1Q4y0L7/+u7Gb3anDHz80e/U1Eyfz7NW9 GOWxwCwjVtvx3vmKsJgnqHutOeIx7MPEUTyZUI03rA/E6+bgPge37/ec0YVGboL5RQ5G r+C8lty4PJD30EuyzKi0Fjo1mU/jY2xsTSq/lKI8Z37MsPQvLoLn2gfmwjQ4uRUHhdep 7r9A== X-Forwarded-Encrypted: i=1; AJvYcCVrF54S2a1TALoWUEz1+fkcM453ISSHcj5APEGNLc/EMKeLTllxU71wBp5CEGD3MXesbkYUh4SdWOIb3XGw@postgresql.org X-Gm-Message-State: AOJu0YyX4cNbZEUyZVRaa6E6KIfdiGZtitipZBXeugjR88N9ljAn0wqc zRhwL2ClzA0sYk68Na/BzXgutIvP8t5SmqSBDscPFZDliQVuHRLJJqugnUvPNXJI9iiM9c+J4uG 11rVK5KIw/lqh00Q7Ki0DnOiQuP6KprI= X-Gm-Gg: ATEYQzwExVtdy4krA9lng2PMjSaJscS06K0JvT0hmvDjNew0C0z2oyLkbIu34nmkaDF B7m6V746LT+iX+0aXmdTA7l34659qDQ6fiwuAypUcu8YNuRm3+xybFPG60Fq36RcY/Gdynm2Lm3 z+VUDgylgVeM2gmsNsXK3cPc6KaRiIXttR8lB3f6Ok9MPS6F3yENvElgyuIHmywJMHk3mUyoP2R cbQvG4KLH3XlYJeD3MUaHbF6aIWpk36IOg/HZUru7Octn6Gw/kPyIFsi1SfewM8cCqorHedq6yk 8ikZsQ== X-Received: by 2002:a17:906:1d53:b0:b98:8132:c81 with SMTP id a640c23a62f3a-b9a542a78cemr421336066b.47.1774542884501; Thu, 26 Mar 2026 09:34:44 -0700 (PDT) MIME-Version: 1.0 References: <47aaf57e-1b7b-4e12-bda2-0316081ff50e@iki.fi> In-Reply-To: From: Sami Imseih Date: Thu, 26 Mar 2026 11:34:32 -0500 X-Gm-Features: AQROBzDewPHSakwcJpq-Iz7YHrdJgh-UIbgcqM2PLcCON2N-z7Nu2bUy4j8pN3w Message-ID: Subject: Re: Clean up NamedLWLockTranche stuff To: Heikki Linnakangas Cc: Nathan Bossart , Robert Haas , "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Thanks for the patches! > I propose the attached refactorings to make this less confusing. See > commit messages for details. I only took a look at 0001 so far, and I do agree with this statement in the commit message: "The "user defined" term was already used in LWTRANCHE_FIRST_USER_DEFINED, so let's standardize on that to mean tranches allocated with either RequestNamedLWLockTranche() or LWLockNewTrancheId()." I do wonder if 0001 is going far enough though. Instead of just standardizing that "user defined" could mean tranches allocated with RequestNamedLWLockTranche() or LWLockNewTrancheId(), how about we also rename these APIs to reflect that as well? This way we remove all concept of "named tranche" which is what it sounds like to me you are proposing. rename RequestNamedLWLockTranche() to RequestUserDefinedLWLockTranche() and LWLockNewTrancheId() to RegisterUserDefinedLWLockTranche() RequestNamedLWLockTranche() requests the lwlock at shmem_request time, which is later registered via LWLockNewTrancheId() when lwlocks are initialized by the postmaster. Also, the name LWLockNewTrancheId() is selling what this function does too short. It does return a new tranche ID, but it also takes in a user-defined tranche name and copies ("registers") that name into LWLockTrancheNames. v19 is already changing the signature of LWLockNewTrancheId(), so maybe improving the names of these APIs makes sense to do. -- Sami Imseih Amazon Web Services (AWS)