From e6fb57a6bd386feba835df1d68151bd3149f5abf Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 23 Feb 2023 13:19:35 +0100 Subject: [PATCH] add c.replicationSlots on sync (#2238) --- pkg/cluster/sync.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pkg/cluster/sync.go b/pkg/cluster/sync.go index ecdda6998..57f9f5b41 100644 --- a/pkg/cluster/sync.go +++ b/pkg/cluster/sync.go @@ -413,6 +413,7 @@ func (c *Cluster) syncStatefulSet() error { } // sync Patroni config + c.logger.Debug("syncing Patroni config") if configPatched, restartPrimaryFirst, restartWait, err = c.syncPatroniConfig(pods, c.Spec.Patroni, requiredPgParameters); err != nil { c.logger.Warningf("Patroni config updated? %v - errors during config sync: %v", configPatched, err) isSafeToRecreatePods = false @@ -641,18 +642,18 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration(pod *v1.Pod, effectiv } // check if specified slots exist in config and if they differ for slotName, desiredSlot := range desiredPatroniConfig.Slots { - if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists { - if reflect.DeepEqual(desiredSlot, effectiveSlot) { - continue - } - } - slotsToSet[slotName] = desiredSlot // only add slots specified in manifest to c.replicationSlots for manifestSlotName, _ := range c.Spec.Patroni.Slots { if manifestSlotName == slotName { c.replicationSlots[slotName] = desiredSlot } } + if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists { + if reflect.DeepEqual(desiredSlot, effectiveSlot) { + continue + } + } + slotsToSet[slotName] = desiredSlot } if len(slotsToSet) > 0 { configToSet["slots"] = slotsToSet