diff options
Diffstat (limited to 'src/backend/replication/logical')
-rw-r--r-- | src/backend/replication/logical/logical.c | 25 | ||||
-rw-r--r-- | src/backend/replication/logical/logicalfuncs.c | 2 | ||||
-rw-r--r-- | src/backend/replication/logical/slotsync.c | 4 |
3 files changed, 6 insertions, 25 deletions
diff --git a/src/backend/replication/logical/logical.c b/src/backend/replication/logical/logical.c index 0b25efafe2b..8ea846bfc3b 100644 --- a/src/backend/replication/logical/logical.c +++ b/src/backend/replication/logical/logical.c @@ -542,28 +542,9 @@ CreateDecodingContext(XLogRecPtr start_lsn, errdetail("This replication slot is being synchronized from the primary server."), errhint("Specify another replication slot.")); - /* - * Check if slot has been invalidated due to max_slot_wal_keep_size. Avoid - * "cannot get changes" wording in this errmsg because that'd be - * confusingly ambiguous about no changes being available when called from - * pg_logical_slot_get_changes_guts(). - */ - if (MyReplicationSlot->data.invalidated == RS_INVAL_WAL_REMOVED) - ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("can no longer get changes from replication slot \"%s\"", - NameStr(MyReplicationSlot->data.name)), - errdetail("This slot has been invalidated because it exceeded the maximum reserved size."))); - - if (MyReplicationSlot->data.invalidated != RS_INVAL_NONE) - ereport(ERROR, - (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("can no longer get changes from replication slot \"%s\"", - NameStr(MyReplicationSlot->data.name)), - errdetail("This slot has been invalidated because it was conflicting with recovery."))); - - Assert(MyReplicationSlot->data.invalidated == RS_INVAL_NONE); - Assert(MyReplicationSlot->data.restart_lsn != InvalidXLogRecPtr); + /* slot must be valid to allow decoding */ + Assert(slot->data.invalidated == RS_INVAL_NONE); + Assert(slot->data.restart_lsn != InvalidXLogRecPtr); if (start_lsn == InvalidXLogRecPtr) { diff --git a/src/backend/replication/logical/logicalfuncs.c b/src/backend/replication/logical/logicalfuncs.c index 0148ec36788..ca53caac2f2 100644 --- a/src/backend/replication/logical/logicalfuncs.c +++ b/src/backend/replication/logical/logicalfuncs.c @@ -197,7 +197,7 @@ pg_logical_slot_get_changes_guts(FunctionCallInfo fcinfo, bool confirm, bool bin else end_of_wal = GetXLogReplayRecPtr(NULL); - ReplicationSlotAcquire(NameStr(*name), true); + ReplicationSlotAcquire(NameStr(*name), true, true); PG_TRY(); { diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index f6945af1d43..be6f87f00b2 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -446,7 +446,7 @@ drop_local_obsolete_slots(List *remote_slot_list) if (synced_slot) { - ReplicationSlotAcquire(NameStr(local_slot->data.name), true); + ReplicationSlotAcquire(NameStr(local_slot->data.name), true, false); ReplicationSlotDropAcquired(); } @@ -665,7 +665,7 @@ synchronize_one_slot(RemoteSlot *remote_slot, Oid remote_dbid) * pre-check to ensure that at least one of the slot properties is * changed before acquiring the slot. */ - ReplicationSlotAcquire(remote_slot->name, true); + ReplicationSlotAcquire(remote_slot->name, true, false); Assert(slot == MyReplicationSlot); |