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 1o8Qx5-0002as-MU for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jul 2022 18:37:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o8Qx2-0003Fh-PZ for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Jul 2022 18:37:40 +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 1o8Qx2-0003FV-AJ for pgsql-hackers@lists.postgresql.org; Mon, 04 Jul 2022 18:37:40 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o8Qwy-0006Hx-7c for pgsql-hackers@lists.postgresql.org; Mon, 04 Jul 2022 18:37:38 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0A8605C00DA; Mon, 4 Jul 2022 14:37:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 04 Jul 2022 14:37:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1656959855; x= 1657046255; bh=H2hF824vYOEma30v+zYUY2kKbhRGbpKTOly7aidWoXA=; b=Q rhbBf7UOQaB9bFukoY2YUHJAk2D4evKvKWTjZdgHWZmFpAJlBNuMLi2Xd+mmd1uV OosDPnJoig/zXEu9TaZ52S38PBz5jK9LDnGNyKkX2sOG6s7CORIElpzB0WrBSYXX KW1dF+NLq5fSuJ75wVb9kYGp1Q6d+/qXwVdNq9TZmQr+sQLmGMfPQksHZrnQ3YwN HtmsQgbcKZPzlThi+758tgRjb2JdqbRbN3V7rMKYN+BHAAFyYA0FEjdfASOWWRjF ArPibKb63FUItzrz8Y//PJuQwZQTr199hwmzVZA+r9CG6LbMm+itHkbzvobO8OaU p0TPUGEQgzaBhDA0LvvgA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudehledguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnh htvghrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepheelffeggedujeet iefhleetuddvieffhfffvdejvdffgeejkeduleduheduieefnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgr uhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 Jul 2022 14:37:32 -0400 (EDT) Message-ID: <46aa800a-dad7-5080-ee9f-371cc2797b36@enterprisedb.com> Date: Mon, 4 Jul 2022 20:37:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: Temporary file access API Content-Language: en-US To: Antonin Houska , pgsql-hackers@lists.postgresql.org Cc: Robert Haas , Stephen Frost References: <4987.1644323098@antos> <20220301143431.GT10577@tamriel.snowman.net> <27013.1646738099@antos> <3146.1649408068@antos> <2132.1649664364@antos> <3690.1649755839@antos> <24759.1650466826@antos> <60402.1656952546@antos.home> From: Peter Eisentraut In-Reply-To: <60402.1656952546@antos.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 04.07.22 18:35, Antonin Houska wrote: >> Attached is a new version of the patch, to evaluate what the API use in the >> backend could look like. I haven't touched places where the file is accessed >> in a non-trivial way, e.g. lseek() / fseek() or pg_pwrite() / pg_pread() is >> called. > Rebased patch set is attached here, which applies to the current master. > > (A few more opportunities for the new API implemented here.) I don't understand what this patch set is supposed to do. AFAICT, the thread originally forked off from a TDE discussion and, considering the thread subject, was possibly once an attempt to refactor temporary file access to make integrating encryption easier? The discussion then talked about things like saving on system calls and excising all OS-level file access API use, which I found confusing, and the thread then just became a general TDE-related mini-discussion. The patches at hand extend some internal file access APIs and then sprinkle them around various places in the backend code, but there is no explanation why or how this is better. I don't see any real structural savings one might expect from a refactoring patch. No information has been presented how this might help encryption. I also suspect that changing around the use of various file access APIs needs to be carefully evaluated in each individual case. Various code has subtle expectations about atomic write behavior, syncing, flushing, error recovery, etc. I don't know if this has been considered here.