Prepared schema creation ignores grant errors and does not retry missing privileges

Đang mở
#3,230 3 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.

  • #3235 của @ritojoao — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
68/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

Start with execCreateDatabaseSchema() in pkg/cluster/database.go and syncPreparedSchemas() in pkg/cluster/sync.go; trace how default privilege grant errors are handled and how existing schemas are skipped. Check nearby tests for prepared schema synchronization. Done means grant failures are reported and missing privileges are retried on later synchronizations.

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

Mô tả

duplicate

Description

When initializing a prepared schema, the operator creates the schema first and then sets its default privileges. If schema creation succeeds but the privilege grant step fails, execCreateDatabaseSchema() ignores the error from execAlterSchemaDefaultPrivileges() and returns nil (pkg/cluster/database.go:453-480).

On subsequent runs, syncPreparedSchemas() checks only whether the schema name already exists and skips existing schemas (pkg/cluster/sync.go:1660-1693). As a result, synchronizations report no errors, and the missing schema USAGE and default table SELECT privileges are never retried.

Steps to reproduce

  1. Configure a prepared database schema_db (DefaultUsers=false) with a prepared schema data (DefaultRoles=false).
  2. Create schema_db along with the schema_db_owner and schema_db_reader roles, leaving schema_db_writer absent.
  3. Synchronize prepared schemas. Schema data is created, while setting its default privileges fails because schema_db_writer does not exist (and the error is ignored).
  4. Create the missing schema_db_writer role and synchronize prepared schemas three more times.
  5. Create a new table in data as schema_db_owner: schema_db_reader has neither USAGE on schema data nor SELECT on the new table.

Expected behavior

Return an error when execAlterSchemaDefaultPrivileges() fails, and retry the missing schema privileges on subsequent synchronizations until setup succeeds.

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.