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 1q9Etl-0002jS-Hb for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jun 2023 01:02:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q9Etj-00059D-MJ for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jun 2023 01:02:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q9Etj-00057d-Ct for pgsql-hackers@lists.postgresql.org; Wed, 14 Jun 2023 01:02:07 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q9Eth-002Elm-1X for pgsql-hackers@postgresql.org; Wed, 14 Jun 2023 01:02:06 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-25bf28a04a9so2049545a91.1 for ; Tue, 13 Jun 2023 18:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686704523; x=1689296523; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=BgZw4qLdviV7k5ldbV+BITWzQQDAahcWMkxQGth1/xA=; b=glYfbrsyUN3tQhjihmLANmZ1s1hHirIJfIRL5u6PDqLEpjJsIBYjnOqYZW18XZ2pQG ky1XfPrb6zxLBGQg9WkdauPqjkhRfHJBybe71/BlVkHdjaWI+RtxvbjsTV05lvVKapP3 P9Tf614erEJeUCbqmYjMmYyhsaZ0XErKm0P3bHA5D5mZRH/8pJHdYPUXb7cKWgJDbs0+ b1w0bGXYh0QLggr74KY9DkVLbxLoCHMsMMmkXxsVL8lBbRSU5Edd42NCE3NTEsXlwcfy +GP4QzE0vM/K3XuYojelSIpUiLjcdYnUGJEbfM+US+8xAxanxbmR1l3sSJt0DV6deZTF y+ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686704523; x=1689296523; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=BgZw4qLdviV7k5ldbV+BITWzQQDAahcWMkxQGth1/xA=; b=H1eg+4Rn6oEOHLN1P9XpJY/ZkjWM/gLVdEvPy4Rv9lTO5ifJ2Q4hmF2Wt1w9mwcXJ1 CZa9VpUcBGiW75u4acu5lccMe7ZOB/ZvJiikDOwpifWaeE1BvptZgYKG0Z7L6kZJR+4D y2ESP8Pbm7madI5mVksnNlo/cF4QLw4kWDZ1t5Yi8Oz6Uw0dSiOLrya6/buOZqC8Bn1O 5HLM9BKY8rovwZwAPmyEmL8C3uzZBLi/F82zkqbqkurHmElZwruJB8IkdotuntCHFxUl w+ADDGGcnGPObRl/KUPlhXLZLtMPeGOAFiC330S78TuXRIMqXI/lkt3q1wy8rT7f8aQW sg/Q== X-Gm-Message-State: AC+VfDzWmyBGyKUjzILHqTzYyMDV8CrDMXKfRnrkrwgDTd2Q5WpWoJ9m eOI5vvaIrJM2ruQGx0eZwvU= X-Google-Smtp-Source: ACHHUZ4q/aL+lh43QYWatehzkPioF3LkKNrJYKOv3YMgVzB6tHpKXTGQYA+2HVsR+uQNHB83Jx3YeA== X-Received: by 2002:a17:90a:390f:b0:255:2dde:17cc with SMTP id y15-20020a17090a390f00b002552dde17ccmr277280pjb.47.1686704523035; Tue, 13 Jun 2023 18:02:03 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id nd14-20020a17090b4cce00b002565a84c848sm2097166pjb.43.2023.06.13.18.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 18:02:02 -0700 (PDT) Date: Wed, 14 Jun 2023 10:01:59 +0900 (JST) Message-Id: <20230614.100159.450192360046344001.horikyota.ntt@gmail.com> To: ranier.vf@gmail.com Cc: gurjeet@singh.im, guofenglinux@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c) From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Tue, 13 Jun 2023 08:21:20 -0300, Ranier Vilela = wrote in = > Em ter., 13 de jun. de 2023 =E0s 02:51, Gurjeet Singh > escreveu: > = > > Please see attached v2 of the patch; it includes both occurrences o= f > > the spurious checks identified in this thread. > > > +1 > LGTM. > LockRelationForExtension(eb.rel, ExclusiveLock); > = > - /* could have been closed while waiting for lock */ > - if (eb.rel) > - eb.smgr =3D RelationGetSmgr(eb.rel); > + eb.smgr =3D RelationGetSmgr(eb.rel); = (It seems to me) The removed comment does refer to smgr, so we could consider keeping it. There are places instances where the function calls are accompanied by similar comments and others where they aren't. However, personally, I inclined towards its removal. That's because our policy is to call RelationGetSmgr() each time before using smgr, and this is well documented in the function's comment. If we decide to remove it, the preceding blank line seems to be a separator from the previous function call. So, we might want to consider removing that blank line, too. Otherwise it LGTM. regards. -- = Kyotaro Horiguchi NTT Open Source Software Center