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 1uqhKo-00BSPM-MA for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 00:14:48 +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 1uqhKn-00G2u3-Rd for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 00:14:46 +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 1uqhKn-00G2tu-I1 for pgsql-hackers@lists.postgresql.org; Tue, 26 Aug 2025 00:14:46 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uqhKl-001kSj-1q for pgsql-hackers@postgresql.org; Tue, 26 Aug 2025 00:14:44 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-88432e6ca05so407263839f.3 for ; Mon, 25 Aug 2025 17:14:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756167283; x=1756772083; 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=e2GtGhRLqtk8wN9Bxu29eoeTgWsaPAlxEf2z3Y4f9zc=; b=hKM5vYxNhlRSEN0dr4c0S7knyupzxwd2u6/SyHSEPZBMiOhr6VadPfO7FJq/jBFgUW KWBcU/LXHcIYiYBOfyz1A2SWfzFlNapsWSPgjlsmlwzYD7m4VR6LqnsRdH0/T/xVKQZl b95i3oW2qIkKfGhuz182wBxS8evRfW3R33JO+4Z0Zy8llV5HSJmHgr1aDQzIIre8dimb LL8J0t24xc6X2mN6LQbudKZS1MkCFAMf2xkA3gNAzXkCPKBxZaWoPg7KbNHt0epLrqOF oZrPqijrHcIndU3tgLxA3RovVToYFQ9jcSkQ4HTypUPPxc2NdZlqHjaDH2Lu8lpFaLQS Hgsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756167283; x=1756772083; 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=e2GtGhRLqtk8wN9Bxu29eoeTgWsaPAlxEf2z3Y4f9zc=; b=s9l22lmNo2zDia7+CY2NUDNP0hAlf5nKQHpUSVnn6gzURnXEhAp1zp504GbSPjbng5 nwdyqvCv7knXpHmS8d0aifCoSOYgZtIT9XCh9lhGu8t+e7DkpSuCsBlCIqTCwGI5orCE FJUtouo9ZnBUAsofXKU+tsJ3z1ChDkCHVwIj8ZKtyrRHdwL+Y/phyGxOsNMmIOBS7dGY JY0M/TZiZKlyjaZzI4SnYyyPPdhnJ7R5uIMu+EMUZde9mU2EOExOi5qLCWhJWSock/RO ndUjEG36G8NwVLbc6+npko0x1OMj2/3TBIvU2ypsUpjHMjpkxpD+6pgR/u/pxy99UaAO CkuQ== X-Forwarded-Encrypted: i=1; AJvYcCVN5QwwisXAdgCsFjiTN4wBU/JNiOsYamFHRR7Y+apX1mAKigZ++Sue7or5KkjzC/xH0pdL7yENF5pLr4Y0@postgresql.org X-Gm-Message-State: AOJu0YxQcztfY4925LcjsMPnkfw3SID2LHtLkArSPr2SZ9GP/huCvR7e Cn2E35xaHNFCY60RrTIp2ZtDzw4OwUEdsseSRWnr7gDDQig/78Hus6Y4 X-Gm-Gg: ASbGncsWFz9Yf3Sz9NCdQSl6SbahoWntSskXYupfOI5AdtnLx0JhJFwCbWxcts4g8w0 6IaOwyVzYwYpds1mZlihBay6seotuVw1nIH/WbCzREqN6Qg04GinsJmnkMn9IOjRRXMIyVTBf+K A7sxEtEZ0CFbBglbOelX747Effb7pIl2Kur0l0H271ZhVDJHL1bucyCSFkduiYUtPPT9XdX6tZV I9N16IvaNizOccl3BH4Zd/YdaDABau9uwnq49ZQlpisqXFPUfIEO0uskwjK0nsgDZ0j8PR+1a2X kEYuW7wQ0rVXOEzUU/pzW1IyaFWuHqgeM43SZ3uuElUs+bBqNUdLx7ZIIqmfXnIUIxlVvUKz7ni zqwjIBmTQ10vSmJVnQfsX4jPPRljHCb+Mw9b52CNL8BJpfYbj6QPDgzFghim6VO/WTQmgYSb9 X-Google-Smtp-Source: AGHT+IHvgkHeyISZwmzecp+PeZc0NyNMqosSCrSVDCPFiedZ2oeGQX0MG6qW9/AqSBl7arfDfDLXgA== X-Received: by 2002:a05:6602:150a:b0:886:b366:11de with SMTP id ca18e2360f4ac-886bd1176a4mr2167276539f.1.1756167283357; Mon, 25 Aug 2025 17:14:43 -0700 (PDT) Received: from nathan (syn-068-184-213-242.res.spectrum.com. [68.184.213.242]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-886dca274fesm284748839f.12.2025.08.25.17.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Aug 2025 17:14:42 -0700 (PDT) Date: Mon, 25 Aug 2025 19:14:40 -0500 From: Nathan Bossart To: Sami Imseih Cc: Tom Lane , Andres Freund , Bertrand Drouvot , Rahila Syed , pgsql-hackers Subject: Re: Improve LWLock tranche name visibility across backends Message-ID: References: <876523.1755635201@sss.pgh.pa.us> 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, Aug 25, 2025 at 04:59:41PM -0500, Sami Imseih wrote: > hmm, can we really avoid a shared lock when reading from shared memory? > considering access for both reads and writes can be concurrent to shared > memory. We are also taking an exclusive lock when writing a new tranche. We probably want to hold a lock while we 1) increment LWLockCounter and copy a new tranche name to memory and 2) while we copy the current value of LWLockCounter to our backend-local variable. Otherwise, AFAICT we don't need one. We could probably use ShmemLock for this. -- nathan