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 1qPAC3-00AAHO-FZ for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Jul 2023 23:14:51 +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 1qPAC0-00CKTX-Vw for pgsql-bugs@arkaria.postgresql.org; Thu, 27 Jul 2023 23:14:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qPAC0-00CKTD-Mj for pgsql-bugs@lists.postgresql.org; Thu, 27 Jul 2023 23:14:48 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qPABy-000lx6-2X for pgsql-bugs@lists.postgresql.org; Thu, 27 Jul 2023 23:14:48 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b8ad9eede0so12177365ad.1 for ; Thu, 27 Jul 2023 16:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690499684; x=1691104484; h=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=7hzlPkGCPClNpBZ2wggg6OK/w+NjZD1O6EuyO5rrhLQ=; b=Ii+w1rvCe+szxsqWMjWwhTem7NMzOBLgH2lNiTF+/AjNriyTNpgDPJjuMEX+xAfe7I PXMWkrE4dehP+6zOKn8y7DauCichWn2EwaQDiUcWFhH1cQ8xgq3zGhTfMq+dhyqz9Rn5 Vle80bDxXcxKCMxypgJBsV9fr4xzHun+P8x2EyLmOhwSOI32IRj9gRe0vgd6sbd/bSkc s0S5SDOeKOurE0akCHWWL6rkxmMCeDvpCEj46TCeHf4L4GN6ntkYjgjqnyTTwA/F/6Ze NPzvvc+lxsZtDLflV0hzHq2VyRr4GnbfwYm8KSgiarEXZCAt3wZ7ygLc3wrai8iXvoJY S5GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690499684; x=1691104484; h=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=7hzlPkGCPClNpBZ2wggg6OK/w+NjZD1O6EuyO5rrhLQ=; b=PqhqYF7DVnwHKPjI592qExQG1+d8KW1pHcSTxlPXYEbB7ykOInmMYZjskKPP1KX1GQ 83kRkNwBTIOrD/Xcy/SHrEkxEPSVxodAp0PpMuOS1F+e7TcQzUnqU5G9rV51IKMiPHlk ZcNUQx/nVqgkF5RiYDowRPOkFRuGsgSDv/sMH2X8v5FBZYyslJEGP5u7AV/+5D8LKaGu fe65D58PEH9LBPSqAkTwn6QH+nxsakr6g22u6SsRcvu4YS89UjC5xwlbOYes9pmUSg9W OaAK6pjS3GL1gycYoDid94uqBl12WVhRmfJ1aNJmjJBJdcBoYozO/NJC86KRDjXd00iF FaZQ== X-Gm-Message-State: ABy/qLanOJb7JuPJ5++7Fo211oMKGhsdzhEflnqmVRL43oZBkLkwmyCc oDrOfSSfzCrpubBT32rfJJ4= X-Google-Smtp-Source: APBJJlEoQG1L9dUsv4A1MelUYZnQLltOwmeiiMCfSlOe/Q8jF21sp3oo+BUnoPi/SuHgu+ku25T6ww== X-Received: by 2002:a17:903:1205:b0:1b8:987f:3f34 with SMTP id l5-20020a170903120500b001b8987f3f34mr701plh.25.1690499684098; Thu, 27 Jul 2023 16:14:44 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id m8-20020a170902bb8800b001b8a3dd5a4asm2144467pls.283.2023.07.27.16.14.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 16:14:43 -0700 (PDT) Date: Thu, 27 Jul 2023 16:14:41 -0700 From: Nathan Bossart To: Gurjeet Singh Cc: Tom Lane , Michael Paquier , Richard =?iso-8859-1?Q?Vesel=FD?= , pgsql-bugs@lists.postgresql.org Subject: Re: Fwd: BUG #18016: REINDEX TABLE failure Message-ID: <20230727231441.GB3612597@nathanxps13> References: <1457241.1688775601@sss.pgh.pa.us> <1867443.1688912310@sss.pgh.pa.us> <20230726175000.GA3259285@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jul 26, 2023 at 06:43:18PM -0700, Gurjeet Singh wrote: > On Wed, Jul 26, 2023 at 2:53 PM Gurjeet Singh wrote: >> On Wed, Jul 26, 2023 at 10:50 AM Nathan Bossart >> wrote: >> > On Mon, Jul 10, 2023 at 09:35:05AM -0700, Gurjeet Singh wrote: >> > + * This should be done after the suppression of the use of indexes (above), >> > + * because the recursive call to reindex_relation() below will invoke >> > + * CommandCounterIncrement(), which may prevent enumeration of the indexes >> > + * on the table. >> > >> > I'm not following this. We've already obtained the list of index OIDs >> > before this point. Does this create problems when we try to open and lock >> > the relations? And if so, how? >> >> This comment is calling out the fact that there's a recursive call to >> reindex_relation() inside the 'if' code block, and that that >> reindex_relation() calls CCI. Hence this 'if' code block should _not_ >> be placed before the the calls to RelationGetIndexList() and >> SetReindexPending(). Because if we do, then the CCI done by >> reindex_relation() will impact what RelationGetIndexList() sees. >> >> This is to match the expectation set for the >> REINDEX_REL_SUPPRESS_INDEX_USE flag. > > Given that the issue is already explained by the flag's comments above > the function, this comment paragraph in the patch may be considered > extraneous. Feel free to remove it, if you think so. > > I felt the need for that paragraph, because it doesn't feel obvious to > me as to why we can't simply reindex the toast table as the first > thing in this function; the toast table reindex will trigger CCI, and > that'd be bad if done before RelationGetIndexList(). I see. I'd suggest referencing the comment above the function, but in general I do think having a comment about this is appropriate. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com