Stream sync generates an empty `FOR TABLE` clause for a standalone Patroni slot

未关闭 适合新手
#3,252 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go, kubernetes, postgresql
领域
backend, databases

调研方向

从 pkg/cluster/streams.go 中链接行 125–140 和 380–422 附近的流同步逻辑开始;追踪独立的 Patroni slot 如何到达 publication 创建流程。检查 PR #2868 中描述的现有行为,以及 pkg/cluster/database.go 中的 SQL 执行路径。完成条件是:在表映射为空且不存在现有 publication 时,slot 仍保留在 slotsToSync 中,并跳过 CREATE PUBLICATION。

由索引模型根据 Issue 内容生成。

描述

Description

When a cluster uses event streams, it can also define a logical replication slot in spec.patroni.slots for a separate consumer. If no stream supplies tables for that slot and no publication with the same name exists, the operator adds the slot with an empty table map and queues a CREATE PUBLICATION statement with an empty table list. PostgreSQL rejects the generated SQL on every sync.

Steps to reproduce

  1. Install the FabricEventStream CRD and configure a postgresql resource with an active entry in spec.streams.
  2. Add a separate logical replication slot in spec.patroni.slots (for example my_custom_slot: {type: logical, database: foo, plugin: pgoutput}) in database foo without an existing publication named my_custom_slot.
  3. During stream sync, the operator executes:
CREATE PUBLICATION "my_custom_slot" FOR TABLE  WITH (publish = 'insert, update');

Observed behavior

PostgreSQL rejects the statement with ERROR: syntax error at or near "WITH" (SQLSTATE 42601), and the operator logs a publication creation error on every reconcile.

Expected behavior

When a slot in spec.patroni.slots has no stream tables (len(newTables) == 0) and no existing publication, stream sync should keep the slot in slotsToSync and skip CREATE PUBLICATION. (PR #2868 preserves an existing publication for a standalone slot, whereas this case starts with no publication.)

主要语言
Go
星标
5.3k
派生
1.1k
平均合并
3 天 17 小时
30 天内合并 PR
11

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

zalando/postgres-operator 的其他 Issue

查看 zalando/postgres-operator 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。