Skip to content

PG-1710 Decrypt partial WAL segments when archvining them #496

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

Merged
merged 1 commit into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion contrib/pg_tde/src/bin/pg_tde_archive_decrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
static bool
is_segment(const char *filename)
{
return strspn(filename, "0123456789ABCDEF") == XLOG_FNAME_LEN && filename[XLOG_FNAME_LEN] == '\0';
return strspn(filename, "0123456789ABCDEF") == XLOG_FNAME_LEN &&
(filename[XLOG_FNAME_LEN] == '\0' || strcmp(filename + XLOG_FNAME_LEN, ".partial") == 0);
}

static void
Expand Down
9 changes: 8 additions & 1 deletion contrib/pg_tde/src/bin/pg_tde_restore_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@

#define TMPFS_DIRECTORY "/dev/shm"

/*
* Partial WAL segments are archived but never automatically fetched from the
* archive by the restore_command. We support them here for symmetry though
* since if someone would want to fetch a partial segment from the archive and
* write it to pg_wal then they would want it encrypted.
*/
static bool
is_segment(const char *filename)
{
return strspn(filename, "0123456789ABCDEF") == XLOG_FNAME_LEN && filename[XLOG_FNAME_LEN] == '\0';
return strspn(filename, "0123456789ABCDEF") == XLOG_FNAME_LEN &&
(filename[XLOG_FNAME_LEN] == '\0' || strcmp(filename + XLOG_FNAME_LEN, ".partial") == 0);
}

static void
Expand Down
Loading