WIP: Re-encrypt partially copied relations when needed#528
WIP: Re-encrypt partially copied relations when needed#528dAdAbird wants to merge 3 commits intopercona:mainfrom
Conversation
We do encrypt other forks. Not sure if this was an error or not.
I sure hope
Would an idea be to find that we need to do so from reading the WAL and looking for key deletion events? |
jeltz left a comment
There was a problem hiding this comment.
From a quick look the changes seem sound but I need to think more.
| | ||
| /* Skip pg_tde key data */ | ||
| if (strstr(path, "pg_tde/") != NULL) | ||
| return FILE_ACTION_NONE; |
There was a problem hiding this comment.
Doesn't this mean it should not be in excludeDirContents? Also should the comment explain it better like for global/pg_control?
This means we also don't copy wal keys, which means this doesn't work properly with wal encryption. |
| I realized one more thing: while we have to keep using our own pg_tde directory at the beginning, if we want to do a consistent recovery, we also have to ensure that we are using exactly the same key providers/principal keys as the source at the end. |
also copy pg_tde/wal_keys as WAL will be replaced with the source's one
Codecov Report❌ Patch coverage is ❌ Your project status has failed because the head coverage (79.70%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@ ## main #528 +/- ## ========================================== - Coverage 58.63% 58.56% -0.08% ========================================== Files 68 68 Lines 10696 10783 +87 Branches 1842 1857 +15 ========================================== + Hits 6272 6315 +43 - Misses 3557 3593 +36 - Partials 867 875 +8
🚀 New features to boost your workflow:
|
This is a WIP for fixing various issues with pg_tde_rewind and encrypted tables (https://perconadev.atlassian.net/browse/PG-2234)
Currently changes are only for pg18. I'll port to pg17 after we approve/solve everything for pg18
What's here:
First, it prevent pgdata/pg_tde/ should not be replaced on the target. Otherwise it won't be able to read it own tables on start
Then, for every partially updated relation we do:
RelFileLocatorbased on the file path.Concerns:
This doesn't help with VACUUM FULL - when there is an encrypted table with new dbOid on the source but no key on the target. For such cases we have to copy internal keys (from pg_tde/xxxxx_keys) to from the source which doesn't exists on the target.Everything here works only for local source. For the remote, we have to handle the issue of server sending encrypted data