Skip to content

Commit 902a2c2

Browse files
committed
Remove useless code from CreateReplicationSlot.
According to the comments, we initialize sendTimeLineIsHistoric and sendTimeLine here for the benefit of WalSndSegmentOpen. However, the only way that can happen is if logical_read_xlog_page calls WALRead. And since logical_read_xlog_page initializes the same global variables internally, we don't need to also do it here. These initializations have been here since replication slots were introduced in commit 858ec11. They were certainly useless at that time, too, because logical decoding didn't yet exist then, and physical replication doesn't examine any WAL at the time of slot creation. I haven't checked all the intermediate versions, but I suspect there's no point at which this code ever did anything useful. To reduce future confusion, remove the code. Since there's no functional defect, no back-patch. Discussion: http://postgr.es/m/CA+TgmobSWzacEs+r6C-7DrOPDHoDar4i9gzxB3SCBr5qjnLmVQ@mail.gmail.com
1 parent 18e0913 commit 902a2c2

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

src/backend/replication/walsender.c

-4
Original file line numberDiff line numberDiff line change
@@ -1042,10 +1042,6 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
10421042

10431043
parseCreateReplSlotOptions(cmd, &reserve_wal, &snapshot_action, &two_phase);
10441044

1045-
/* setup state for WalSndSegmentOpen */
1046-
sendTimeLineIsHistoric = false;
1047-
sendTimeLine = ThisTimeLineID;
1048-
10491045
if (cmd->kind == REPLICATION_KIND_PHYSICAL)
10501046
{
10511047
ReplicationSlotCreate(cmd->slotname, false,

0 commit comments

Comments
 (0)