Skip to content

PG-1879 PostgreSQL 18 support#423

Merged
jeltz merged 13 commits intopercona:mainfrom
jeltz:pg18
Oct 14, 2025
Merged

PG-1879 PostgreSQL 18 support#423
jeltz merged 13 commits intopercona:mainfrom
jeltz:pg18

Conversation

@jeltz
Copy link
Copy Markdown
Collaborator

@jeltz jeltz commented Oct 2, 2025

This adds support for PostgreSQL 18 to pg_tde. This required quite extensive changes to pg_basebackup due to it being heavily refactored. Additionally we had to do an ugly fix due to the AIO changes which are relevant in with io_method = sync. This code only works with sync IO.

@jeltz jeltz force-pushed the pg18 branch 5 times, most recently from 11ba2ac to bb91aa2 Compare October 9, 2025 14:00
jeltz added 2 commits October 13, 2025 11:41
Due to the refacotring of the streamer interface we needed to update the
Makefile.
Since the streaming interface was heavily refactored in PostgreSQL 18
we will add those changes in a separate, later commit.
@jeltz jeltz force-pushed the pg18 branch 13 times, most recently from 7afade5 to 47e548d Compare October 14, 2025 00:17
jeltz added 4 commits October 14, 2025 03:34
Since the streamer interface was heavily refactored in PostgreSQL 18 we
could not just re-use our patch for the PostgreSQL 17 tools. The new
interface seems much nicer than the old one though.
Fixes necessary to make sure it builds:

- Make sure to only include shmem.h in backend code
- Add new SMGR hooks
- Change base64 calls to support new function signature
These constants should also be marked with static since they are local
to their respective files.
The return typ of pg_buffercache_evict() changed in PostgreSQL 18 so
we need to write code which gives the same output in both 17 and 18.
@jeltz jeltz force-pushed the pg18 branch 4 times, most recently from e895da9 to ed70d10 Compare October 14, 2025 02:02
jeltz added 2 commits October 14, 2025 04:15
On top of improving the quality of the test it also makes it possible to
have the same output for both PostgreSQL 17 and 18.
To make it easier to add support for setting io_mode we first refactor
the test runner scripts.
@jeltz jeltz force-pushed the pg18 branch 3 times, most recently from bb242d8 to b46bd43 Compare October 14, 2025 09:48
dutow and others added 4 commits October 14, 2025 12:37
We don't have a proper AIO callback implementation, which results in AIO
reads skipping the pg_tde decryption code.

Simply disable it until we implement proper support.
The AIO patches changed to code so the AIO codepaths are used in most
cases even when synchronous IO is used, so we need to add some basic TDE
support to the AIO codepaths even for when async IO is disabled.

This implements it as a quick and dirty fix which only works with our
patched upstream code and uses a global variable in the backend which
makes it only work when io_method = sync.
Including making sure the code formatting works for both PostgreSQL 17
and 18 files. For now skip moving from to 18 for the sanitizer tests.
Due to a typo we actually never uplaoded any artifacts on test failure
when running PSP tests with pg_tde enabled.
@jeltz jeltz marked this pull request as ready for review October 14, 2025 10:46
@jeltz jeltz requested a review from artemgavrilov as a code owner October 14, 2025 10:46
@jeltz jeltz changed the title PoC: PG-1879 PostgreSQL 18 support PG-1879 PostgreSQL 18 support Oct 14, 2025
# https://wiki.postgresql.org/wiki/Running_pgindent_on_non-core_code_or_development_code
update-typedefs:
wget -q -O - "https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?branch=REL_17_STABLE" | cat - typedefs.list | sort | uniq > typedefs-full.list
(wget -q -O - "https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?branch=REL_17_STABLE"; wget -q -O - "https://buildfarm.postgresql.org/cgi-bin/typedefs.pl?branch=REL_18_STABLE") | cat - typedefs.list | sort -u > typedefs-full.list
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems to work for now, but it can't cause problems when we format earlier version source code with latest pgindent + typedefs?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this was a pretty ugly fix to get it working.

@jeltz jeltz merged commit 07a110d into percona:main Oct 14, 2025
16 checks passed
@jeltz jeltz deleted the pg18 branch November 14, 2025 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants