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

Abierto
#3,230 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

  • #3235 de @ritojoao — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go, kubernetes, postgresql

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
5.3k
Forks
1.1k
Merge medio
3 d 17 h
PR fusionados (30 d)
11

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de zalando/postgres-operator

Todos los issues de zalando/postgres-operator

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.