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 1nPbeq-0005Hr-3l for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Mar 2022 02:57:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nPbep-0002A3-0k for pgsql-hackers@arkaria.postgresql.org; Thu, 03 Mar 2022 02:57:35 +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 1nPbeo-00029t-Lo for pgsql-hackers@lists.postgresql.org; Thu, 03 Mar 2022 02:57:34 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nPbei-0000eM-CT for pgsql-hackers@postgresql.org; Thu, 03 Mar 2022 02:57:34 +0000 Received: by mail-pl1-x634.google.com with SMTP id z2so3293899plg.8 for ; Wed, 02 Mar 2022 18:57:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=+WO4GXdE3fzF7f4LnqsLVIicAsV79sLPM4gzE8XDL1M=; b=niHnQQzQ8NBCMy6iKunjPpim7FThh/IvyCm8c2wc4YjtYzk8Lo1mmux+9NZVVwVOSl 47XzHvBKsLC06KjQRyAre5tBveLfyHpfh+71nkPInC9kJY8HYkhQBXjLbfKUcQ4MYjEA QAkm0s1pQcNlR/ToTSxDQxvcln8wNLNpnQp8uDL7EDb14bOBSdH5k0rxN7qPo6o4hhsV 4cZOIoED2HfDYAdSkyWEg3kwFCEAn4yJwOwcOgczfRZbmWeIlui2eb8NfJhbqZiT6Vqi pDxfv0qiFALNnI/WO50idiaR0Z1nGs3ApoS/ts/lqx3iHakK0Vu2832A86KQi2jNT/Iw HdkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=+WO4GXdE3fzF7f4LnqsLVIicAsV79sLPM4gzE8XDL1M=; b=xwIpt/8Tf4PjgJxl9GldFWW5HiR8DQt1A6duvY1gDHI7bFOwMP3jZkjMCefvt9aw/P DOnMzv1ZEULhZeT5meHfj+PnTavPnQX/z2abz/DmxM8YZbTO91LgO46SUBGO5bDCKcjw GnVy0PUtZ9HDNjz9jN5H8c0+Vy/UjGflzYE7gLB3NsFowm9J5ZKiN8hoKXhy0+5iCBrq bok+PJXGidI8FRNVLmpglNHGxDY31j6QALjW2r+EjbsZWRf9Rk+t0YK+4YECicgwM+aW GrwlE6ikbqsXPYTTiBEF2m3HVlTg1h9geKQDMtij070FGruVAmPBG1hpbImucCCLVh9w HlUQ== X-Gm-Message-State: AOAM532iYgsIUMpMvck1cvsyZ4Zg/YvmluCdjoER5OTq5/WOANpb1eCb Y7NTVwz3rPTaJUkZRx+kyrg= X-Google-Smtp-Source: ABdhPJzxU65fRsMt9gYNUh1tFeBZRJTkc4qL25JT2docKM3Ec3zrFtWOGyAWXMZOgMfVDJCdfuscaA== X-Received: by 2002:a17:902:7b8a:b0:151:8517:51fd with SMTP id w10-20020a1709027b8a00b00151851751fdmr10730637pll.119.1646276245972; Wed, 02 Mar 2022 18:57:25 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id s14-20020a056a0008ce00b004f66dcd4f1csm501417pfu.32.2022.03.02.18.57.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 02 Mar 2022 18:57:25 -0800 (PST) Date: Thu, 03 Mar 2022 11:57:23 +0900 (JST) Message-Id: <20220303.115723.407686721420998045.horikyota.ntt@gmail.com> To: melanieplageman@gmail.com Cc: pgsql-hackers@postgresql.org Subject: Re: Why do spgbuildempty(), btbuildempty(), and blbuildempty() use smgrwrite()? From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Wed, 2 Mar 2022 20:07:14 -0500, Melanie Plageman wrote in > If you enable the CHECK_WRITE_VS_EXTEND-protected assert in mdwrite(), > you'll trip it anytime you exercise btbuildempty(), blbuildempty(), or > spgbuildempty(). > > In this case, it may not make any meaningful difference if smgrwrite() > or smgrextend() is called (_mdfd_getseg() behavior won't differ even > with the different flags, so really only the FileWrite() wait event will > be different). > However, it seems like it should still be changed to call smgrextend(). > Or, since they only write a few pages, why not use shared buffers like > gistbuildempty() and brinbuildempty() do? > > I've attached a patch to move these three into shared buffers. > > And, speaking of spgbuildempty(), there is no test exercising it in > check-world, so I've attached a patch to do so. I wasn't sure if it > belonged in spgist.sql or create_index_spgist.sql (on name alone, seems > like the latter but based on content, seems like the former). > > - Melanie I didn't dig into your specific isssue, but I'm mildly opposed to moving them onto shared buffers. They are cold images of init-fork, which is actually no-use for active servers. Rather I'd like to move brinbuildempty out of shared buffers considering one of my proposing patches.. regards. -- Kyotaro Horiguchi NTT Open Source Software Center