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