Re: [PATCHES] Post-special page storage TDE support

From: David Christensen <david(dot)christensen(at)crunchydata(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>
Subject: Re: [PATCHES] Post-special page storage TDE support
Date: 2024-01-19 18:49:03
Message-ID: CAOxo6XL-sok+u2J5KmFVp30OrpHTaKo28dWg0c850H1i+7=xoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I have finished the reworking of this particular patch series, and have
tried to
organize this in such a way that it will be easily reviewable. It is
constructed progressively to be able to follow what is happening here. As
such,
each individual commit is not guaranteed to compile on its own, so the whole
series would need to be applied before it works. (It does pass CI tests.)

Here is a brief roadmap of the patches; some of them have additional
details in
the commit message describing a little more about them.

These two patches do some refactoring of existing code to make a common
place to
modify the definitions:

v3-0001-refactor-Create-PageUsableSpace-to-represent-spac.patch
v3-0002-refactor-Make-PageGetUsablePageSize-routine.patch

These two patches add the ReservedPageSize variable and teach PageInit to
use to
adjust sizing accordingly:

v3-0003-feature-Add-ReservedPageSize-variable.patch
v3-0004-feature-Adjust-page-sizes-at-PageInit.patch

This patch modifies the definitions of 4 symbols to be computed based on
PageUsableSpace:

v3-0005-feature-Create-Calc-Limit-and-Dynamic-forms-for-f.patch

These following 4 patches are mechanical replacements of all existing uses
of
these symbols; this provides both visibility into where the existing symbol
is
used as well as distinguishing between parts that care about static
allocation
vs dynamic usage. The only non-mechanical change is to remove the
definition of
the old symbol so we can be guaranteed that all uses have been considered:

v3-0006-chore-Split-MaxHeapTuplesPerPage-into-Limit-and-D.patch
v3-0007-chore-Split-MaxIndexTuplesPerPage-into-Limit-and-.patch
v3-0008-chore-Split-MaxHeapTupleSize-into-Limit-and-Dynam.patch
v3-0009-chore-Split-MaxTIDsPerBTreePage-into-Limit-and-Dy.patch

The following patches are related to required changes to support dynamic
toast
limits:

v3-0010-feature-Add-hook-for-setting-reloptions-defaults-.patch
v3-0011-feature-Dynamically-calculate-toast_tuple_target.patch
v3-0012-feature-Add-Calc-options-for-toast-related-pieces.patch
v3-0013-chore-Replace-TOAST_MAX_CHUNK_SIZE-with-ClusterTo.patch
v3-0014-chore-Translation-updates-for-TOAST_MAX_CHUNK_SIZ.patch

In order to calculate some of the sizes, we need to include nbtree.h
internals,
but we can't use in front-end apps, so we separate out the pieces we care
about
into a separate include and use that:

v3-0015-chore-Split-nbtree.h-structure-defs-into-an-inter.patch

This is the meat of the patch; provide a common location for these
block-size-related constants to be computed using the infra that has been
set up
so far. Also ensure that we are properly initializing this in front end and
back end code. A tricky piece here is we have two separate include files
for
blocksize.h; one which exposes externs as consts for optimizations, and one
that
blocksize.c itself uses without consts, which it uses to create/initialized
the
vars:

v3-0016-feature-Calculate-all-blocksize-constants-in-a-co.patch

Add ControlFile and GUC support for reserved_page_size:

v3-0017-feature-ControlFile-GUC-support-for-reserved_page.patch

Add initdb support for reserving page space:

v3-0018-feature-Add-reserved_page_size-to-initdb-bootstra.patch

Fixes for pg_resetwal:

v3-0019-feature-Updates-for-pg_resetwal.patch

The following 4 patches mechanically replace the Dynamic form to use the new
Cluster variables:

v3-0020-chore-Rename-MaxHeapTupleSizeDynamic-to-ClusterMa.patch
v3-0021-chore-Rename-MaxHeapTuplesPerPageDynamic-to-Clust.patch
v3-0022-chore-Rename-MaxIndexTuplesPerPageDynamic-to-Clus.patch
v3-0023-chore-Rename-MaxTIDsPerBTreePageDynamic-to-Cluste.patch

Two pieces of optimization required for visibility map:

v3-0024-optimization-Add-support-for-fast-non-division-ba.patch
v3-0025-optimization-Use-fastdiv-code-in-visibility-map.patch

Update bufpage.h comments:

v3-0026-doc-update-bufpage-docs-w-reserved-space-data.patch

Fixes for bloom to use runtime size:

v3-0027-feature-Teach-bloom-about-PageUsableSpace.patch

Fixes for FSM to use runtime size:

v3-0028-feature-teach-FSM-about-reserved-page-space.patch

I hope this makes sense for reviewing, I know it's a big job, so breaking
things up a little more and organizing will hopefully help.

Best,

David

Attachment Content-Type Size
v3-0002-refactor-Make-PageGetUsablePageSize-routine.patch application/octet-stream 4.3 KB
v3-0001-refactor-Create-PageUsableSpace-to-represent-spac.patch application/octet-stream 15.4 KB
v3-0005-feature-Create-Calc-Limit-and-Dynamic-forms-for-f.patch application/octet-stream 6.3 KB
v3-0004-feature-Adjust-page-sizes-at-PageInit.patch application/octet-stream 1.9 KB
v3-0003-feature-Add-ReservedPageSize-variable.patch application/octet-stream 2.2 KB
v3-0007-chore-Split-MaxIndexTuplesPerPage-into-Limit-and-.patch application/octet-stream 17.7 KB
v3-0006-chore-Split-MaxHeapTuplesPerPage-into-Limit-and-D.patch application/octet-stream 22.9 KB
v3-0009-chore-Split-MaxTIDsPerBTreePage-into-Limit-and-Dy.patch application/octet-stream 6.3 KB
v3-0008-chore-Split-MaxHeapTupleSize-into-Limit-and-Dynam.patch application/octet-stream 9.3 KB
v3-0010-feature-Add-hook-for-setting-reloptions-defaults-.patch application/octet-stream 2.0 KB
v3-0012-feature-Add-Calc-options-for-toast-related-pieces.patch application/octet-stream 2.5 KB
v3-0014-chore-Translation-updates-for-TOAST_MAX_CHUNK_SIZ.patch application/octet-stream 13.4 KB
v3-0013-chore-Replace-TOAST_MAX_CHUNK_SIZE-with-ClusterTo.patch application/octet-stream 8.1 KB
v3-0011-feature-Dynamically-calculate-toast_tuple_target.patch application/octet-stream 1.2 KB
v3-0015-chore-Split-nbtree.h-structure-defs-into-an-inter.patch application/octet-stream 17.3 KB
v3-0017-feature-ControlFile-GUC-support-for-reserved_page.patch application/octet-stream 5.0 KB
v3-0018-feature-Add-reserved_page_size-to-initdb-bootstra.patch application/octet-stream 8.0 KB
v3-0016-feature-Calculate-all-blocksize-constants-in-a-co.patch application/octet-stream 10.8 KB
v3-0019-feature-Updates-for-pg_resetwal.patch application/octet-stream 5.3 KB
v3-0020-chore-Rename-MaxHeapTupleSizeDynamic-to-ClusterMa.patch application/octet-stream 8.6 KB
v3-0021-chore-Rename-MaxHeapTuplesPerPageDynamic-to-Clust.patch application/octet-stream 18.4 KB
v3-0024-optimization-Add-support-for-fast-non-division-ba.patch application/octet-stream 2.0 KB
v3-0022-chore-Rename-MaxIndexTuplesPerPageDynamic-to-Clus.patch application/octet-stream 7.2 KB
v3-0023-chore-Rename-MaxTIDsPerBTreePageDynamic-to-Cluste.patch application/octet-stream 5.1 KB
v3-0025-optimization-Use-fastdiv-code-in-visibility-map.patch application/octet-stream 7.1 KB
v3-0028-feature-teach-FSM-about-reserved-page-space.patch application/octet-stream 2.2 KB
v3-0027-feature-Teach-bloom-about-PageUsableSpace.patch application/octet-stream 3.4 KB
v3-0026-doc-update-bufpage-docs-w-reserved-space-data.patch application/octet-stream 2.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-01-19 18:53:03 Re: PG12 change to DO UPDATE SET column references
Previous Message Andrey Borodin 2024-01-19 18:07:35 Re: UUID v7