Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

Commit e6fb57a

Browse files
authored
add c.replicationSlots on sync (zalando#2238)
1 parent 8356ebf commit e6fb57a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/cluster/sync.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ func (c *Cluster) syncStatefulSet() error {
413413
}
414414

415415
// sync Patroni config
416+
c.logger.Debug("syncing Patroni config")
416417
if configPatched, restartPrimaryFirst, restartWait, err = c.syncPatroniConfig(pods, c.Spec.Patroni, requiredPgParameters); err != nil {
417418
c.logger.Warningf("Patroni config updated? %v - errors during config sync: %v", configPatched, err)
418419
isSafeToRecreatePods = false
@@ -641,18 +642,18 @@ func (c *Cluster) checkAndSetGlobalPostgreSQLConfiguration(pod *v1.Pod, effectiv
641642
}
642643
// check if specified slots exist in config and if they differ
643644
for slotName, desiredSlot := range desiredPatroniConfig.Slots {
644-
if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists {
645-
if reflect.DeepEqual(desiredSlot, effectiveSlot) {
646-
continue
647-
}
648-
}
649-
slotsToSet[slotName] = desiredSlot
650645
// only add slots specified in manifest to c.replicationSlots
651646
for manifestSlotName, _ := range c.Spec.Patroni.Slots {
652647
if manifestSlotName == slotName {
653648
c.replicationSlots[slotName] = desiredSlot
654649
}
655650
}
651+
if effectiveSlot, exists := effectivePatroniConfig.Slots[slotName]; exists {
652+
if reflect.DeepEqual(desiredSlot, effectiveSlot) {
653+
continue
654+
}
655+
}
656+
slotsToSet[slotName] = desiredSlot
656657
}
657658
if len(slotsToSet) > 0 {
658659
configToSet["slots"] = slotsToSet

0 commit comments

Comments
 (0)