From 1b2f94d6bfb4508b2cbf3d552a5615ae2959e90c Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi Date: Thu, 18 Jun 2020 11:25:25 +0900 Subject: [PATCH 2/3] 002 --- src/backend/replication/slot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index dcc76c4783..8893516f00 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -380,7 +380,7 @@ static int ReplicationSlotAcquireInternal(ReplicationSlot *slot, const char *name, SlotAcquireBehavior behavior) { - ReplicationSlot *s; + ReplicationSlot *s = NULL; int active_pid; retry: @@ -393,8 +393,12 @@ retry: * acquire is not given. If the slot is not found, we either * return -1 or error out. */ - s = (slot == NULL) ? SearchNamedReplicationSlot(name) : slot; - if (s == NULL || !s->in_use || strcmp(name, NameStr(s->data.name)) != 0) + if (!slot) + s = SearchNamedReplicationSlot(name); + else if(s->in_use && strcmp(name, NameStr(s->data.name))) + s = slot; + + if (s == NULL) { if (behavior == SAB_Inquire) { -- 2.18.4