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 1r0WIz-0066TO-B0 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 00:20:25 +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 1r0WIx-00Dng1-Ax for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Nov 2023 00:20:23 +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 1r0WIw-00DnbS-3Y for pgsql-hackers@lists.postgresql.org; Wed, 08 Nov 2023 00:20:23 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r0WIq-005G6f-Mi for pgsql-hackers@postgresql.org; Wed, 08 Nov 2023 00:20:21 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 800555C0211; Tue, 7 Nov 2023 19:20:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 07 Nov 2023 19:20:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm3; t=1699402813; x=1699489213; bh=pR S+2vBr45+KyBs9NyuyNJaodNF1OipOk7m28xaBVNc=; b=JA2NuRkCcF7bUS5Z/w vkU3elyS/2uA4TnFw2aohf/p0IRuHrmCg0BXe79WDD/LNOKDfPF6xVgclFON6sZ7 vgpHMsD1M4kLGQjLCcRYo/8dNIOM8AD0777zPjTB7TehOST9I5cAV1BQygejGtqo znf7+JYNLBtM8os97UqprOHk8WCQi2itaFLpa2faPfGI6IEEgMuuVyFNooeJF7k9 C93Ej2lKefHL1KOeSUECq0NW+95XSz2BZdlX7nMR8R3yjkg+tUBRl+cAQAei110p Nkz+HxhfaxCEhD/RaOi0qmPH3sUgNDme46CkAnx3LUzZ8+doX6n3Y6A0TZEC0NOC HLYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type: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=fm3; t=1699402813; x=1699489213; bh=pRS+2vBr45+Ky Bs9NyuyNJaodNF1OipOk7m28xaBVNc=; b=YBdip5fXzpjaSCThMUIIGO3tTuI0f A41rIpLmP5GRdkNnQTbh1XEHsvswlvwkM0BY8dqrZEdngUb9cW08Ii9us2KQzWRH nC0QJPhDPtGXunV0bcraJ4Sfw0EA3Jh/+yEYx/amadZGF+iifWxnziTbVtgN9bDq Yz2z5VZJ9b5ezwT3PlNH4HQe+Tx2469gb2DAX4iB1QzAgNAHvRNuMgMiNwol8BIy qr8MwjNJ1T7SwcxS1nkiRK2q4UCDXJF0Wj/PLrdhRtAVGA3VBukNRulWSP/FXYKS ZjsTZiD4C/jck43BAV7d2n4qDSqYrjtFQAHfwKbbAL0vvXMpfQuHfnPtA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedruddukedgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Nov 2023 19:20:12 -0500 (EST) Date: Tue, 7 Nov 2023 16:20:11 -0800 From: Andres Freund To: David Christensen Cc: Matthias van de Meent , PostgreSQL-development , Stephen Frost Subject: Re: [PATCHES] Post-special page storage TDE support Message-ID: <20231108002011.2c7amddaul7dhkbd@awork3.anarazel.de> References: 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, On 2023-05-09 17:08:26 -0500, David Christensen wrote: > From 965309ea3517fa734c4bc89c144e2031cdf6c0c3 Mon Sep 17 00:00:00 2001 > From: David Christensen > Date: Tue, 9 May 2023 16:56:15 -0500 > Subject: [PATCH v4 1/3] Add reserved_page_space to Page structure > > This space is reserved for extended data on the Page structure which will be ultimately used for > encrypted data, extended checksums, and potentially other things. This data appears at the end of > the Page, after any `pd_special` area, and will be calculated at runtime based on specific > ControlFile features. > > No effort is made to ensure this is backwards-compatible with existing clusters for `pg_upgrade`, as > we will require logical replication to move data into a cluster with > different settings here. The first part of the last paragraph makes it sound like pg_upgrade won't be supported across this commit, rather than just between different settings... I think as a whole this is not an insane idea. A few comments: - IMO the patch touches many places it shouldn't need to touch, because of essentially renaming a lot of existing macro names to *Limit, necessitating modifying a lot of users. I think instead the few places that care about the runtime limit should be modified. As-is the patch would cause a lot of fallout in extensions that just do things like defining an on-stack array of Datums or such - even though all they'd need is to change the define to the *Limit one. Even leaving extensions aside, it must makes reviewing (and I'm sure maintaining) the patch very tedious. - I'm a bit worried about how the extra special page will be managed - if there are multiple features that want to use it, who gets to put their data at what offset? After writing this I saw that 0002 tries to address this - but I don't like the design. It introduces runtime overhead that seems likely to be visible. - Checking for features using PageGetFeatureOffset() seems the wrong design to me - instead of a branch for some feature being disabled, perfectly predictable for the CPU, we need to do an external function call every time to figure out that yet, checksums are *still* disabled. - Recomputing offsets every time in PageGetFeatureOffset() seems too expensive. The offsets can't change while running as PageGetFeatureOffset() have enough information to distinguish between different kinds of relations - so why do we need to recompute offsets on every single page? I'd instead add a distinct offset variable for each feature. - Modifying every single PageInit() call doesn't make sense to me. That'll just create a lot of breakage for - as far as I can tell - no win. - Why is it worth sacrificing space on every page to indicate which features were enabled? I think there'd need to be some convincing reasons for introducing such overhead. - Is it really useful to encode the set of features enabled in a cluster with a bitmask? That pretty much precludes utilizing extra page space in extensions. We could instead just have an extra cluster-wide file that defines a mapping of offset to feature. Greetings, Andres Freund