8000 Build and test pg_rewind with encrypted WAL by dAdAbird · Pull Request #97 · percona/postgres · GitHub
[go: up one dir, main page]

Skip to content

Build and test pg_rewind with encrypted WAL #97

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Fix TLI change with encrypted WAL
Copying data to the segment with updated TLI requires re-encrypting
it if it is encrypted.
  • Loading branch information
dAdAbird committed Mar 7, 2025
commit ea401cee5a491d4b2908aebcd14f05176fba513c
9 changes: 7 additions & 2 deletions src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -3423,6 +3423,8 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno,
int srcfd;
int fd;
int nbytes;
off_t read_pos = 0;
off_t write_pos = 0;

/*
* Open the source file
Expand Down Expand Up @@ -3471,7 +3473,8 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno,
if (nread > sizeof(buffer))
nread = sizeof(buffer);
pgstat_report_wait_start(WAIT_EVENT_WAL_COPY_READ);
r = read(srcfd, buffer.data, nread);
r = xlog_smgr->seg_read(srcfd, buffer.data, nread, read_pos,
srcTLI, srcsegno, wal_segment_size);
if (r != nread)
{
if (r < 0)
Expand All @@ -3486,10 +3489,11 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno,
path, r, (Size) nread)));
}
pgstat_report_wait_end();
read_pos += nread;
}
errno = 0;
pgstat_report_wait_start(WAIT_EVENT_WAL_COPY_WRITE);
if ((int) write(fd, buffer.data, sizeof(buffer)) != (int) sizeof(buffer))
if ((int) xlog_smgr->seg_write(fd, buffer.data, sizeof(buffer), write_pos, destTLI, destsegno) != (int) sizeof(buffer))
{
int save_errno = errno;

Expand All @@ -3505,6 +3509,7 @@ XLogFileCopy(TimeLineID destTLI, XLogSegNo destsegno,
errmsg("could not write to file \& 58BF quot;%s\": %m", tmppath)));
}
pgstat_report_wait_end();
write_pos += sizeof(buffer);
}

pgstat_report_wait_start(WAIT_EVENT_WAL_COPY_SYNC);
Expand Down
Loading
0