Skip to content

Commit

Permalink
sync stateful set when syncing streams during ADD event (#2245)
Browse files Browse the repository at this point in the history
  • Loading branch information
FxKu committed Feb 28, 2023
1 parent 645fcc0 commit 9973262
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pkg/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,22 @@ func (c *Cluster) Create() error {
// something fails, report warning
c.createConnectionPooler(c.installLookupFunction)

// remember slots to detect deletion from manifest
for slotName, desiredSlot := range c.Spec.Patroni.Slots {
c.replicationSlots[slotName] = desiredSlot
}

if len(c.Spec.Streams) > 0 {
// creating streams requires syncing the statefulset first
err = c.syncStatefulSet()
if err != nil {
return fmt.Errorf("could not sync statefulset: %v", err)
}
if err = c.syncStreams(); err != nil {
c.logger.Errorf("could not create streams: %v", err)
}
}

for slotName, desiredSlot := range c.Spec.Patroni.Slots {
c.replicationSlots[slotName] = desiredSlot
}

return nil
}

Expand Down

0 comments on commit 9973262

Please sign in to comment.