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 1smKaq-004vgU-Vg for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Sep 2024 22:04:45 +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 1smKao-0014Ig-Nf for pgsql-hackers@arkaria.postgresql.org; Thu, 05 Sep 2024 22:04:43 +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 1smKao-0014IL-43 for pgsql-hackers@lists.postgresql.org; Thu, 05 Sep 2024 22:04:42 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1smKal-000LEP-Je for pgsql-hackers@postgresql.org; Thu, 05 Sep 2024 22:04:40 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-7cd8803fe0aso1041683a12.0 for ; Thu, 05 Sep 2024 15:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1725573878; x=1726178678; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=jL2J0C0ipLSnTUldgV4sufTszmHTKrv0/2jvHrBN4AI=; b=eFWGhzC02VJZK0EkROBq3nJ8XTSrVS9o3QLIGD6CjNQ5OCogtHCS2JVwBbM+uG9pyZ k4V08y1um8azBW3bB/lEWKsoLui6xOQa1+iwZJB/u53/YG0ssDwXn2splEbMnQGr3lTX k4Nznn9K4fcO7RGIp8LeGC76wQwqEWP0Qo2sg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725573878; x=1726178678; h=user-agent:in-reply-to:content-transfer-encoding :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=jL2J0C0ipLSnTUldgV4sufTszmHTKrv0/2jvHrBN4AI=; b=rDabjDCXGD2OGc38T9hDwYriFOKnwMvvVj4jDPlJMWH+P5MEtwzvp5h52ExTjwWG19 /XbjG7WVlVgIalIakrDY/MSdfGQ5jCeqc9W+qPudRbB8m6ZVg0fhv7/xZElA58GgzxJy dXygpFImMkuWZYUy/ebIylQthml0OmzFxEv/CdvlcSj6TW6FyU+USI5ioggiNElypLYy SMslochXuD+bs6NSMQAMVLw7tK94H8FgNHPj/lrzIaRPyl/4KBiH73RBhxUP9oma5/La uDXfEdMakvFjVM9uv7V2DgUujqETezwzOmJELpUbPKaRQz0/TNMtGHjW3aCPxL6/N+Mi NPBg== X-Forwarded-Encrypted: i=1; AJvYcCUTqMqoyjf3EDoVKeXXUsgrAsadrNxefJhSHbbbQh1XVZPP55uyvvQnvvCfdnQU2bEW57yi33msUPrfJG0D@postgresql.org X-Gm-Message-State: AOJu0Yw1G9xPbG+BswVdin/vSUeCCbqAR9HcBHCsw4ZSYB6xe8D4eGcy CNJV6lsh0igCgcFTNNPePwoEaTJyxdhMB+W5J7z+J9aa8Mk0p8OUnYo5TqhvDA== X-Google-Smtp-Source: AGHT+IFlDPrdfSZ2ZB7OXpmbEsSfeYu95KhV0elIilyDIJiMz3/XXdiPdvuXBfudave+WOm53czOxA== X-Received: by 2002:a17:90b:384a:b0:2d8:b6a6:bc2b with SMTP id 98e67ed59e1d1-2d8b6a6bffamr18862114a91.21.1725573877878; Thu, 05 Sep 2024 15:04:37 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::48]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2dadbff259esm13503a91.5.2024.09.05.15.04.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Sep 2024 15:04:36 -0700 (PDT) Date: Thu, 5 Sep 2024 15:04:34 -0700 From: Noah Misch To: Nitin Motiani Cc: Heikki Linnakangas , Robert Haas , pgsql-hackers@postgresql.org, Tom Lane , Smolkin Grigory , Michael Paquier , Alexander Lakhin Subject: Re: race condition in pg_class Message-ID: <20240905220434.80.nmisch@google.com> References: <20240817040748.f8.nmisch@google.com> <63c27c17-0d8f-4ede-a624-3ee41d28b539@iki.fi> <20240822073200.4f.nmisch@google.com> <20240831011043.2b.nmisch@google.com> <20240903212329.61.nmisch@google.com> <20240904195720.cf.nmisch@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Sep 05, 2024 at 07:10:04PM +0530, Nitin Motiani wrote: > On Thu, Sep 5, 2024 at 1:27 AM Noah Misch wrote: > > On Wed, Sep 04, 2024 at 09:00:32PM +0530, Nitin Motiani wrote: > > > Assert(rel->ri_needsLockTagTuple == IsInplaceUpdateRelation(rel->relationDesc) > > > > > > This can safeguard against users of ResultRelInfo missing this field. > > > > v10 does the rename and adds that assertion. This question remains open: > > Looks good. A couple of minor comments : > 1. In the inplace110 commit message, there are still references to > heap_inplace_update. Should it be clarified that the function has been > renamed? PGXN has only one caller of this function, so I think that wouldn't help readers enough. If someone gets a compiler error about the old name, they'll figure it out without commit log guidance. If a person doesn't get a compiler error, they didn't need to read about the fact of the rename. > 2. Should there be a comment above the ri_needLockTag definition in > execNodes.h that we are caching this value to avoid function calls to > IsInPlaceUpdateRelation for every tuple? Similar to how the comment > above ri_TrigFunctions mentions that it is cached lookup info. Current comment: /* updates do LockTuple() before oldtup read; see README.tuplock */ bool ri_needLockTagTuple; Once the comment doesn't fit in one line, pgindent rules make it take a minimum of four lines. I don't think words about avoiding function calls would add enough value to justify the vertical space, because a person starting to remove it would see where it's called. That's not to say the addition would be negligent. If someone else were writing the patch and had included that, I wouldn't be deleting the material.