Skip to content
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
14 changes: 11 additions & 3 deletions src/backend/replication/slotfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "utils/pg_lsn.h"
#include "utils/resowner.h"

void (*SlotFuncs_Custom_XLogReaderRoutines)(XLogReaderRoutine *xlr);

/*
* Helper function for creating a new physical replication slot with
* given arguments. Note that this function doesn't release the created
Expand Down Expand Up @@ -469,6 +471,14 @@ pg_logical_replication_slot_advance(XLogRecPtr moveto)

PG_TRY();
{
XLogReaderRoutine xlr;
xlr.page_read = read_local_xlog_page;
xlr.segment_open = wal_segment_open;
xlr.segment_close = wal_segment_close;

if (SlotFuncs_Custom_XLogReaderRoutines != NULL)
SlotFuncs_Custom_XLogReaderRoutines(&xlr);

/*
* Create our decoding context in fast_forward mode, passing start_lsn
* as InvalidXLogRecPtr, so that we start processing from my slot's
Expand All @@ -477,9 +487,7 @@ pg_logical_replication_slot_advance(XLogRecPtr moveto)
ctx = CreateDecodingContext(InvalidXLogRecPtr,
NIL,
true, /* fast_forward */
XL_ROUTINE(.page_read = read_local_xlog_page,
.segment_open = wal_segment_open,
.segment_close = wal_segment_close),
&xlr,
NULL, NULL, NULL);

/*
Expand Down
2 changes: 2 additions & 0 deletions src/include/replication/slot.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ typedef struct ReplicationSlot
#define SlotIsPhysical(slot) ((slot)->data.database == InvalidOid)
#define SlotIsLogical(slot) ((slot)->data.database != InvalidOid)

extern void (*SlotFuncs_Custom_XLogReaderRoutines)(XLogReaderRoutine *xlr);

/*
* Shared memory control area for all of replication slots.
*/
Expand Down