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

Đang mở Phù hợp với người mới
#3,252 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, kubernetes, postgresql
Lĩnh vực
backend, databases

Hướng nghiên cứu

Bắt đầu tại pkg/cluster/streams.go, ở logic đồng bộ stream quanh các dòng được liên kết 125–140 và 380–422; lần theo cách các slot Patroni độc lập đi đến bước tạo publication. Kiểm tra hành vi hiện có được mô tả trong PR #2868 và đường thực thi SQL trong pkg/cluster/database.go. Hoàn thành khi một map bảng rỗng, không có publication hiện hữu, vẫn giữ slot trong slotsToSync và bỏ qua CREATE PUBLICATION.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.)

Ngôn ngữ chính
Go
Star
5.3k
Fork
1.1k
Merge trung bình
3 ngày 17 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của zalando/postgres-operator

Tất cả issue của zalando/postgres-operator

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.