Skip to content

Commit ad75935

Browse files
committed
improve condition to sync streams
1 parent 0b553a7 commit ad75935

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/cluster/cluster.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ func (c *Cluster) Update(oldSpec, newSpec *acidv1.Postgresql) error {
11601160

11611161
// streams
11621162
if len(newSpec.Spec.Streams) > 0 || len(oldSpec.Spec.Streams) != len(newSpec.Spec.Streams) {
1163+
c.logger.Debug("syncing streams")
11631164
if err := c.syncStreams(); err != nil {
11641165
c.logger.Errorf("could not sync streams: %v", err)
11651166
updateFailed = true

pkg/cluster/sync.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
153153
return fmt.Errorf("could not sync connection pooler: %v", err)
154154
}
155155

156-
if len(c.Spec.Streams) > 0 {
156+
// sync if manifest stream count is different from stream CR count
157+
// it can be that they are always different due to grouping of manifest streams
158+
// but we would catch missed removals on update
159+
if len(c.Spec.Streams) != len(c.Streams) {
157160
c.logger.Debug("syncing streams")
158161
if err = c.syncStreams(); err != nil {
159162
err = fmt.Errorf("could not sync streams: %v", err)

0 commit comments

Comments
 (0)