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 1odjTm-0004ia-Od for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Sep 2022 02:40:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1odjTl-0000qZ-1c for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Sep 2022 02:40:49 +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 1odjTk-0000qI-Mf for pgsql-hackers@lists.postgresql.org; Thu, 29 Sep 2022 02:40:48 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1odjTe-0005Fx-R8 for pgsql-hackers@postgresql.org; Thu, 29 Sep 2022 02:40:47 +0000 Received: by mail-pf1-x434.google.com with SMTP id w2so260832pfb.0 for ; Wed, 28 Sep 2022 19:40:42 -0700 (PDT) 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; bh=UamFDCMiHzRLAbeZsUpMUw6izkdj+9hpBMbIip07Vds=; b=T/3IoZBEzTQfKZYpD0qV5lrJU0eaoIaDg1jBqnKAb/iB9+KsDwwM3Hf/9Cd4TZkiUK 1R2po5XXa4TqkNIe0SVhtHeJRz0atenZHdsdNvNJzH9K+xCxBYHQ6FKdOl3cuylMEX7V vNgAzq90XDpVz5OgIxlAwDyZtITIX0dtIHM+R32bSkdB3cHY4g52HRTk286cdsz43gKN QMDevdxdLadVvpQaPwtm1ylCaENaGMlY99T8M4be7UY5bWCO/x+4+tVqgCVIp4y9aWJw CbKcPxTDEmU8C4sNTcfyXGglB7FFuiVgWRztqlAG/rFU0kM9WMpmMt+WXS677p4yQ7ET uMUQ== 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; bh=UamFDCMiHzRLAbeZsUpMUw6izkdj+9hpBMbIip07Vds=; b=WII8T7RjMpUDSUl/1v/WG8LLqRvSGQ1ZVtHpyHB3z2CmPd9jkxwJSmiUY0gOd7kV4v EgucFj2WFMj/3RoV6xNP8ck2b06c9FdWQZjy/67iAhO/CGfpG6N+HllLI/tmtN6l+70g NyIJ3mEvzWf96SUzgIBQ0p07NvHwOkcRL9+75IgUKME2goJTEFQqgkXMUOVqtC2MFsNW 0ziSsStFMJvaK/XbabJreEouxyptthsYNQR8+Rx6XV/tHFxS1GwxoblM8NxNEV9EZKC0 bJZWiqon4QT7V/1ygf6thhXlg2CtdXpvFSlhGQWm+sFwHcvgpb+22pS5BfSOTcBZiHJ5 g9Ww== X-Gm-Message-State: ACrzQf0lOaHa8NgVJee1BfNKMFcCO8ow3RI6bpihshjjCzbC/r8tfbBG o7Dvs+bB18FaoSWvRYEX8UM= X-Google-Smtp-Source: AMsMyM7Gn4SGSFOuT9pF2qxzKoAhWv529vcXhmdSvI8+b+6yGV3z4mlIGN1TEFEcAMNg28TJgmB6ww== X-Received: by 2002:a63:87c7:0:b0:43b:da19:a35c with SMTP id i190-20020a6387c7000000b0043bda19a35cmr848009pge.83.1664419241184; Wed, 28 Sep 2022 19:40:41 -0700 (PDT) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id w70-20020a628249000000b005386162bc2asm4763768pfd.92.2022.09.28.19.40.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Sep 2022 19:40:40 -0700 (PDT) Date: Wed, 28 Sep 2022 19:40:38 -0700 From: Nathan Bossart To: Tom Lane Cc: Greg Stark , pgsql-hackers@postgresql.org Subject: Re: identifying the backend that owns a temporary schema Message-ID: <20220929024038.GA4945@nathanxps13> References: <20220815205811.GA250990@nathanxps13> <20220829230757.GA542616@nathanxps13> <2297420.1664041298@sss.pgh.pa.us> <20220926160822.GA1298186@nathanxps13> <3499642.1664221809@sss.pgh.pa.us> <20220926201113.GA1340606@nathanxps13> <4157446.1664405780@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4157446.1664405780@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Sep 28, 2022 at 06:56:20PM -0400, Tom Lane wrote: > I reviewed this and made some changes, some cosmetic some less so. Thanks for the detailed review. > A point that still bothers me a bit about pg_stat_get_backend_idset is > that it could miss or duplicate some backend IDs if the user calls > pg_stat_clear_snapshot() partway through the SRF's run, and we reload > a different set of backend entries than we had before. I added a comment > about that, with an argument why it's not worth working harder, but > is the argument convincing? If not, what should we do? Isn't this an existing problem? Granted, it'd manifest differently with this patch, but ISTM we could already end up with too many or too few backend IDs if there's a refresh partway through. I don't know if there's an easy way to avoid mismatches altogether besides perhaps ERROR-ing if there's a concurrent refresh. > - if (beid < 1 || beid > localNumBackends) > - return NULL; The reason I'd kept this in was because I was worried about overflow in the comparator function. Upon further inspection, I don't think there's actually any way that will produce incorrect results. And I'm not sure we should worry about such cases too much, anyway. Overall, LGTM. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com