PG-2381 Fix migration with empty files and entries#582
Merged
AndersAstrand merged 2 commits intoMay 19, 2026
Merged
Conversation
Some clusters will have key files that are 0 bytes, ie. doesn't even have a header. This happens for example when VACUUM FULL is run and an empty 0_keys is created. We should probably make sure it is not created, but right now clusters in the wild will have the empty file so we need to not crash.
The previous code would try to decrypt empty slots in the file which would fail.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-2.2.0 #582 +/- ##
================================================
Coverage ? 57.61%
================================================
Files ? 68
Lines ? 10781
Branches ? 2659
================================================
Hits ? 6211
Misses ? 3291
Partials ? 1279
🚀 New features to boost your workflow:
|
rjd15372
approved these changes
May 19, 2026
rjd15372
left a comment
There was a problem hiding this comment.
Please note that my knowledge about this is very limited. But the changes look fine.
artemgavrilov
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The reproduction script in this issue surfaced two issues. One with an empty key file that was created by VACUUM FULL, and one with empty entries in the key file created by DROP TABLE. None of these issues had anything to do with pg_tde_upgrade but could be triggered even by only upgrading pg_tde without changing postgresql version at all.