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 1mEZe7-0002bb-Sr for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Aug 2021 16:03:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mEZe5-0006G8-8f for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Aug 2021 16:02:57 +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 1mEZb1-0001SZ-T3 for pgsql-hackers@lists.postgresql.org; Fri, 13 Aug 2021 15:59:47 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mEZay-0001Dm-UC for pgsql-hackers@postgresql.org; Fri, 13 Aug 2021 15:59:47 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 57BFF32009AC; Fri, 13 Aug 2021 11:59:42 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 13 Aug 2021 11:59:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=NQT7YgBFbWhB0mwsudI2ZNg1GSI tBoY90OksoL4FuD4=; b=cujYI1yF2r5Mssk5HqsQIW4xaE1TzYuX6BTs9Xd1As+ hgX4SGyAUpuI1sNc0SM1kUx8BmdrlIq/20ttuDH58ORZAteIG0V5fGEkqmcuKgbr MnGJOuiSWklZda6m413ptcLLQ13sqfj91yqXZUU39SRoWFMnDe+DKMy94wAH5lPh 26jSVfa6PwZJfxZj1TySVBmWP3QKVxv3nhkowjvGth3UuPF2CUp1PZNRcbqimy+R eRR9nVu8B/MWJ18pzsmOeiAvFqvaRVPr6iep8SkvL1xKzaiKSUFA7Vj3i31sFp/7 6IGnKUzyZBpZZP4wu0Gof6MIZTnkgYIiSKVEhcpENZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=NQT7Yg BFbWhB0mwsudI2ZNg1GSItBoY90OksoL4FuD4=; b=aFPm/mBHBCpnFqXDFFuuW7 WdlWCZTRZ464VZ7cGk5JnIuuV9O/QxBiOwu0V8npHNYY7q6M88kQxc9RiBbMz6gL Lqy6AxW5ceLGJP1G65IW27FFOY6gYIeNPY6G5NvQAcIuhXn4GgSxL7qZdfZlyF7k Zdj3PyEp7YVCFZ5PncQm9AYjfhxKkmtJzY9y/x5+flM1KMJTZCnHsdzR/+/QBxBR gWFaOVtv/wr7ardm86Ai+6EmRvhiKdYvYlPo/D+/lZJ0spwC8oCObeS+E2yh9A2P +wtKBmwp7IkpFvCb9cySU1K7dD8MUvk99sXoEm5f2zfFy44NYOQJ257E+DwEptbQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkeehgdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepudekhfekleeugeevteehleffffejgeelueduleeffeeutdelffeujeffhfeu ffdunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 Aug 2021 11:59:41 -0400 (EDT) Date: Fri, 13 Aug 2021 08:59:40 -0700 From: Andres Freund To: Amit Kapila , Thomas Munro Cc: pgsql-hackers , Dilip Kumar , Masahiko Sawada , Tom Lane Subject: Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o Message-ID: <20210813155940.kp7mdg3ynl2hodqk@alap3.anarazel.de> References: <20210808022435.svp4spxlrfoi3w4p@alap3.anarazel.de> <20210812082237.in7l5x3rc4gxhgjh@alap3.anarazel.de> <20210812124819.5mrurb6ueizmqgru@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, (dropping -committers to avoid moderation stalls due xposting to multiple lists - I find that more annoying than helpful) On 2021-08-13 14:38:37 +0530, Amit Kapila wrote: > > What I'm wondering is why it is a good idea to have a SharedFileSet specific > > cleanup mechanism. One that only operates on process lifetime level, rather > > than something more granular. I get that the of the files here needs to be > > longer than a transaction, but that can easily be addressed by having a longer > > lived resource owner. > > > > Process lifetime may work well for the current worker.c, but even there it > > doesn't seem optimal. One e.g. could easily imagine that we'd want to handle > > connection errors or configuration changes without restarting the worker, in > > which case process lifetime obviously isn't a good idea anymore. > > > > I don't deny that we can't make this at a more granular level. IIRC, > at that time, we tried to follow AtProcExit_Files which cleans up temp > files at proc exit and we needed something similar for temporary files > used via SharedFileSet. The comparison to AtProcExit_Files isn't convincing to me - normally temp files are cleaned up long before that via resowner cleanup. To me the reuse of SharedFileSet for worker.c as executed seems like a bad design. As things stand there's little code shared between dsm/non-dsm shared file sets. The cleanup semantics are entirely different. Several functions don't work if used on the "wrong kind" of set (e.g. SharedFileSetAttach()). > I think we can extend this API but I guess it is better to then do it > for dsm-based as well so that these get tracked via resowner. DSM segments are resowner managed already, so it's not obvious that that'd buy us much? Although I guess there could be a few edge cases that'd look cleaner, because we could reliably trigger cleanup in the leader instead of relying on dsm detach hooks + refcounts to manage when a set is physically deleted? Greetings, Andres Freund