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 1ubQtR-000kM3-EV for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Jul 2025 21:39:25 +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 1ubQtP-00EBsS-1x for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Jul 2025 21:39:23 +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.94.2) (envelope-from ) id 1ubQtO-00EBsK-KM for pgsql-hackers@lists.postgresql.org; Mon, 14 Jul 2025 21:39:23 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ubQtN-007Iiz-28 for pgsql-hackers@postgresql.org; Mon, 14 Jul 2025 21:39:22 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3d948ce7d9dso31452665ab.2 for ; Mon, 14 Jul 2025 14:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752529161; x=1753133961; 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=eR2nJn5zLWOMuV8zayAoIs/78wrpwbipbAicacJbZ6s=; b=l2iwskwbmhxJLmkqJSaFPf4ed9ATtae1HFdYUBcxuSH2YctNs1zvlSAj6965XQj+dG +2+WpBhCOSTyiw3yKcV/oIbGUm81gR5cGEroeqEIyk8Bti8/wbSlVQ01PicR+Fa3qmQF /cRBuBWzGHS4VaN+dtcQ9/vY7B/K15osT6cgCggK8k8Enz349LbFgXkLSuDonIe1CJB6 BaVYNjeU+zuJsPyV7/0T+6YdgihgzdJJQg30wz3S0zmWXze/IV59/7FiCQfQ8Hs5CHWr h5jJwNd30nkvbE+R+8/ilIvx39NgTK1nPhZFyPIAtnuujNfrgVWPgRcTuZeaium8RxlU JPLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752529161; x=1753133961; 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=eR2nJn5zLWOMuV8zayAoIs/78wrpwbipbAicacJbZ6s=; b=TR4JURk8Z/oKzG33ZUQ6FYU22VVD+6mKa8Id/uiy/QnuZ2baTlZyY0JY1pMOMzimE3 CnxKB6/23udiMnbJRCNl1XKaibUc/m/aYkqFvHGm/eueQLhoY22iF5A0AOCFegk4UKbk 9qPyUnXpZrLtKPsyYDDJC/v4RUJpDuk0ubF/u2+i7xjiCu0Nqn/Zf0A4FadAktWXkd0N iB9+6pI79S1h0u2s5yBcN+5yBWkMeXsAOrHo+/yrqTmVB9yHt8zXcJfqq6Isyz0STaXz 1tw0VqnxWdFPeDDc2wTsJwAko29IgiFgzY6Ac9OP3ijjFX4xXKSWWZ84TnsCzRYEnakl OxwQ== X-Forwarded-Encrypted: i=1; AJvYcCV+sB2YpKnpLo6d4amXbqAd+E8y+HH5rmgvukY0ORmdg0cTAyOnCz5SYQ9mtKNEHfSvVmquMK0weu08lJWt@postgresql.org X-Gm-Message-State: AOJu0YxSXrwVl+30AWBgbVVhocvK8dRwURm6eHowR4KMgqDZJPbX+WUm V1vWxV/QCzNiEjrgKcGJA8BYJwLYTKXXRIHcZTK9DpFxXs7sYH05akP9 X-Gm-Gg: ASbGnctEogrw6EpFDNmjWwtjjcpbYOQ8e1uFCyjqe+NYcjxHEICoopK5zbXbyIs6nRp rfJa7eLwcpi8kgvoNHW6zVums6IT4hyQA0e6VxZ4H8tgFQmILFdqbng9bhOyKt7bp2UHLAQHEY+ ONSmpPxzXsePvcCF4bczW2NbxTW5Bqh1iUhfqp+SmyEcf9WxOXia+boCg6fO8cqDP9T+Oi9qtt3 T46mgW/xXlm4HEYOpjRa7ZKSwE9FzqdscICJJpmMAoa2NbvifxJPOzpCexeat0t3DLzN4iM0quS +7gfOPizy7ba4SIw4sS7k8LlLpcC/F3wF1Ah3za61QFt6dVJS7zR8+fLEwGAXzO98w4nbVPnoik tyI2dOhC4Ftl/wbsbuMXeV3o+MwVfG8ynfJQCKm0WzwzvkuRnL/Q/ic7IQPAgCoqKkUo517uZ68 F5zP1tBe0eJ5Ht X-Google-Smtp-Source: AGHT+IGylLQrolXcwi5Yv2dYiTXP11KgG//qP2qyxhPzgqQE6p8ftXT2ozgTleMFn7ytUVyu9dPf1A== X-Received: by 2002:a05:6e02:398e:b0:3df:3598:7688 with SMTP id e9e14a558f8ab-3e25434f9bemr173107635ab.21.1752529160855; Mon, 14 Jul 2025 14:39:20 -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-3e24620aadbsm33332465ab.46.2025.07.14.14.39.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jul 2025 14:39:20 -0700 (PDT) Date: Mon, 14 Jul 2025 16:39:18 -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 Mon, Jul 14, 2025 at 03:45:02PM -0500, Sami Imseih wrote: >> Ah, I missed the problem with postmaster. Could we have the first backend >> that needs to access the table be responsible for creating it and >> populating it with the built-in/requested-at-startup entries? > > We can certainly maintain a flag in the shared state that is set once > the first backend loads all the tranches in shared memory. That did not > cross my mind, but it feels wrong to offload such responsibility to a > normal backend. Well, we already need each backend to either initialize or attach to the dshash table, and the initialization would only ever happen once on a running server. Adding a new initialization step to bootstrap the built-in and registered-at-startup tranche names doesn't seem like that much of a leap to me. Another random thought: I worry that the dshash approach might be quite a bit slower, and IIUC we just need to map an integer to a string. Maybe we should just use a DSA for LWLockTrancheNames. IOW we'd leave it as a char ** but put it in shared memory. -- nathan