Skip to content

Commit 6e47930

Browse files
committed
Fix XLogging of rotated key
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
1 parent 415cb8d commit 6e47930

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

contrib/pg_tde/src/access/pg_tde_tdemap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ pg_tde_perform_rotate_key(const TDEPrincipalKey *principal_key, const TDEPrincip
318318
{
319319
XLogPrincipalKeyRotate xlrec;
320320

321-
xlrec.databaseId = principal_key->keyInfo.databaseId;
322-
xlrec.keyringId = principal_key->keyInfo.keyringId;
321+
xlrec.databaseId = new_principal_key->keyInfo.databaseId;
322+
xlrec.keyringId = new_principal_key->keyInfo.keyringId;
323323
memcpy(xlrec.keyName, new_principal_key->keyInfo.name, sizeof(new_principal_key->keyInfo.name));
324324

325325
XLogBeginInsert();

contrib/pg_tde/src/access/pg_tde_xlog_keys.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ pg_tde_perform_rotate_server_key(const TDEPrincipalKey *principal_key,
739739
{
740740
XLogPrincipalKeyRotate xlrec;
741741

742-
xlrec.databaseId = principal_key->keyInfo.databaseId;
743-
xlrec.keyringId = principal_key->keyInfo.keyringId;
742+
xlrec.databaseId = new_principal_key->keyInfo.databaseId;
743+
xlrec.keyringId = new_principal_key->keyInfo.keyringId;
744744
memcpy(xlrec.keyName, new_principal_key->keyInfo.name, sizeof(new_principal_key->keyInfo.name));
745745

746746
XLogBeginInsert();

0 commit comments

Comments
 (0)