-
Notifications
You must be signed in to change notification settings - Fork 11
Fix XLogging of rotated key #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (82.22%) 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 @@
## release-17.5.3 #552 +/- ##
===============================================
Coverage 82.22% 82.22%
===============================================
Files 25 25
Lines 3246 3246
Branches 512 512
===============================================
Hits 2669 2669
Misses 465 465
Partials 112 112
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question about why we use the old key for any of the fields. If there is no good reason we should probably use the new key for all of them.
@@ -319,7 +319,7 @@ pg_tde_perform_rotate_key(const TDEPrincipalKey *principal_key, const TDEPrincip | |||
XLogPrincipalKeyRotate xlrec; | |||
|
|||
xlrec.databaseId = principal_key->keyInfo.databaseId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any reason we don't want to use the new_principal_key
as the source of all three fields?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, makes sense. I was on the fence with that and decided in favor "less changes". But given it the second thought after your comment, yes, it's better to change it for consistency. Database will be the same anyway, as we can't rotate key "into another db". I'll do the change
Before this commit, we XLogged the provider ID (keyringId) of the old key. Yet, we then attempt to fetch the new key from the old provider during the Redo, which obviously fails and crashes the recovery. So the next steps lead to the recovery stalemate: - Create new provider (with new destination - mount_path, url etc). - Create new server/global key. - Rotate key. - <Crash!> This commit fixes it by Xlogging the new key's provider ID. For: PG-1895
b50abbc
to
6e47930
Compare
Before this commit, we XLogged the provider ID (keyringId) of the old key. Yet, we then attempt to fetch the new key from the old provider during the Redo, which obviously fails and crashes the recovery. So the next steps lead to the recovery stalemate:
This commit fixes it by Xlogging the new key's provider ID.
For: PG-1895