Skip to content

Commit 2aa1c21

Browse files
committed
Don't rewrite _map files on the save_principal_key redo
We create a new WAL key during the extension init, which happens before the redo. This means that in case of a crash, pg_tde_save_principal_key_redo was rewriting a WAL _map file and destroying a newly created key. Since we emit an XLog record after the key was successfully written to the file (the file was created), we can safely assume that we should not change the file if it exists.
1 parent 93ef451 commit 2aa1c21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

contrib/pg_tde/src/access/pg_tde_tdemap.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ pg_tde_save_principal_key_redo(const TDESignedPrincipalKeyInfo *signed_key_info)
275275

276276
LWLockAcquire(tde_lwlock_enc_keys(), LW_EXCLUSIVE);
277277

278-
map_fd = pg_tde_open_file_write(db_map_path, signed_key_info, true, &curr_pos);
278+
map_fd = pg_tde_open_file_write(db_map_path, signed_key_info, false, &curr_pos);
279279
close(map_fd);
280280

281281
LWLockRelease(tde_lwlock_enc_keys());

0 commit comments

Comments
 (0)