Skip to content

Commit 529cdfc

Browse files
authored
skip slots where publication sync failed (zalando#2091)
1 parent 70f3ee8 commit 529cdfc

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

pkg/cluster/streams.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ func (c *Cluster) syncStreams() error {
279279
c.streamApplications = appIds
280280

281281
slots := make(map[string]map[string]string)
282+
slotsToSync := make(map[string]map[string]string)
282283
publications := make(map[string]map[string]acidv1.StreamTable)
283284

284285
requiredPatroniConfig := c.Spec.Patroni
@@ -308,13 +309,6 @@ func (c *Cluster) syncStreams() error {
308309
}
309310
}
310311

311-
// no slots = no streams defined
312-
if len(slots) > 0 {
313-
requiredPatroniConfig.Slots = slots
314-
} else {
315-
return nil
316-
}
317-
318312
// create publications to each created slot
319313
c.logger.Debug("syncing database publications")
320314
for publication, tables := range publications {
@@ -323,7 +317,16 @@ func (c *Cluster) syncStreams() error {
323317
err = c.syncPublication(publication, dbName, tables)
324318
if err != nil {
325319
c.logger.Warningf("could not sync publication %q in database %q: %v", publication, dbName, err)
320+
continue
326321
}
322+
slotsToSync[publication] = slots[publication]
323+
}
324+
325+
// no slots to sync = no streams defined or publications created
326+
if len(slotsToSync) > 0 {
327+
requiredPatroniConfig.Slots = slotsToSync
328+
} else {
329+
return nil
327330
}
328331

329332
// add extra logical slots to Patroni config

0 commit comments

Comments
 (0)