Skip to content

Commit

Permalink
Add on-demand WAL download in CreateReplicationSlot
Browse files Browse the repository at this point in the history
  • Loading branch information
save-buffer committed Aug 16, 2024
1 parent 46b4b23 commit 6731510
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/backend/replication/walsender.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,7 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
{
LogicalDecodingContext *ctx;
bool need_full_snapshot = false;
XLogReaderRoutine xlr;

/*
* Do options check early so that we can bail before calling the
Expand Down Expand Up @@ -1136,11 +1137,15 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
need_full_snapshot = true;
}

xlr.page_read = logical_read_xlog_page;
xlr.segment_open = WalSndSegmentOpen;
xlr.segment_close = wal_segment_close;
if (WalSender_Custom_XLogReaderRoutines != NULL)
WalSender_Custom_XLogReaderRoutines(&xlr);

ctx = CreateInitDecodingContext(cmd->plugin, NIL, need_full_snapshot,
InvalidXLogRecPtr,
XL_ROUTINE(.page_read = logical_read_xlog_page,
.segment_open = WalSndSegmentOpen,
.segment_close = wal_segment_close),
&xlr,
WalSndPrepareWrite, WalSndWriteData,
WalSndUpdateProgress);

Expand Down

0 comments on commit 6731510

Please sign in to comment.