Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1GRr-0007Wk-Kz for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Dec 2022 00:32:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p1GRp-0000XV-Nb for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Dec 2022 00:32:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p1GRp-0000XL-Cv for pgsql-hackers@lists.postgresql.org; Sat, 03 Dec 2022 00:32:05 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p1GRm-0005A3-CW for pgsql-hackers@lists.postgresql.org; Sat, 03 Dec 2022 00:32:03 +0000 Received: by mail-pf1-x42c.google.com with SMTP id 124so6421346pfy.0 for ; Fri, 02 Dec 2022 16:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=V6QqATRCtEzTu+gKJ+yQSS/EBClbi9e7zJV9w2blIxQ=; b=N6Kv6GL4EYjJWpwDikNQJg8/45g9f8zlgCdGD7z1Xv7xd3c2x4RJoHiQ0AeVmyqrYQ ikUCL9AD/aYTNkiJY12mpFYtVhO8InASszLhyMAdsmYwkueymOSKANzDBADTz5GFmgVd CqjrHrYUhL4GYvn6zU4JwqnGiGBqaSm5pzSqxf6wYWvR6zZ+sW73UtSxqHlSD7cCPZFe jTqK2eD6lRZJX3bl/L6sxxxSD+J++fulGVQaECb7tp3tMDwD1OGTF6kb0Al17DvAjEz+ I14sydqOXaK2NSL4WC+DsiipcI3AnQ2B3mzHLA/SYze/mtKH1MhZEFFQC7q/30uYBB5q amyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=V6QqATRCtEzTu+gKJ+yQSS/EBClbi9e7zJV9w2blIxQ=; b=YqSVxwpA7Hn6omlNObidFPTG8iCOjBbvRE/n39ATT4oOH/VFPcyf7aSFFR+dNjcy05 xZ3fLORXxVDrZlTNKka9/qxsAcSVRa0sWh5R46Np7CZPLttPpKPWPrvPY4q6bhZwhO7S CfsrztK4Kljq16oP7ksRC07ouwYRxiiFJC2s58vq48+pY0Ki/S0ulOyK9apqtxRZEg8N 9Cri3mOn8n8dZtD9/5cGOcepLl5GruKrx7n+jGEABVg0mB88FyxT183ccVQoEYJD43x+ tyqU0d3IktuUcipLrSYuxCnU6Po3Fh02UYyU+37kuVFeE5v4ucGlfLJcuWx4/cS6LiUI AoBw== X-Gm-Message-State: ANoB5pm9b/2Wj7/uX2IeqV0EZ8lNycM3uwVusBw+Bw9N67DZzh4lLiz9 wXWiUdTvLtNifBPwJmfssks= X-Google-Smtp-Source: AA0mqf5Cjic3x5SsOPYkrCC09ZvJQXy514RBNdtA4slXvgbpEq2BQmPoUFuiRjzXVwkNUZsFxA7wVA== X-Received: by 2002:a62:3181:0:b0:572:149c:e1ba with SMTP id x123-20020a623181000000b00572149ce1bamr56373736pfx.19.1670027520961; Fri, 02 Dec 2022 16:32:00 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id u15-20020a1709026e0f00b00189a7fbfd44sm6086862plk.211.2022.12.02.16.31.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 16:32:00 -0800 (PST) Date: Fri, 2 Dec 2022 16:31:58 -0800 From: Nathan Bossart To: Bharath Rupireddy Cc: Andres Freund , PostgreSQL Hackers Subject: Re: WAL Insertion Lock Improvements (was: Re: Avoid LWLockWaitForVar() for currently held WAL insertion lock in WaitXLogInsertionsToFinish()) Message-ID: <20221203003158.GA2518778@nathanxps13> References: <20221124184619.xit4sfi52bcz2tva@awork3.anarazel.de> <20221202004042.qwjadmkpq4zky3tn@awork3.anarazel.de> 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, Dec 02, 2022 at 04:32:38PM +0530, Bharath Rupireddy wrote: > On Fri, Dec 2, 2022 at 6:10 AM Andres Freund wrote: >> I'm not sure this is quite right - don't we need a memory barrier. But I don't >> see a reason to not just leave this code as-is. I think this should be >> optimized entirely in lwlock.c > > Actually, we don't need that at all as LWLockWaitForVar() will return > immediately if the lock is free. So, I removed it. I briefly looked at the latest patch set, and I'm curious how this change avoids introducing memory ordering bugs. Perhaps I am missing something obvious. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com