Skip to content

Draft: PostRecoverySQL #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Draft: PostRecoverySQL #1

wants to merge 2 commits into from

Conversation

zhammer
Copy link

@zhammer zhammer commented May 2, 2025

Experimenting with a solution for cloudnative-pg#6087

Comment on lines +105 to +116
func executeQueries(db *sql.DB, queries []string) error {
for _, sqlQuery := range queries {
log.Debug("Executing query", "sqlQuery", sqlQuery)
_, err := db.Exec(sqlQuery)
if err != nil {
return err
}
}

return nil
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i intentionally do this here rather than in InitInfo (https://github.com/cloudnative-pg/cloudnative-pg/blob/2fb0189d4efa1a927684d30ebcdfa56e5f74e8ae/pkg/management/postgres/initdb.go#L421-L435) as it seems like the recovery steps are already using that interface a bit awkwardly

Comment on lines +87 to +89
instance := info.GetInstance()

dbSuperUser, err := instance.GetSuperUserDB()
Copy link
Author

@zhammer zhammer May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. no idea if either of these methods will succeed as the restore process is tapping into some of the shared initdb Info functionality without being bootstrapped the same way that initdb dbs are.
  2. i'm a little unclear how we'd know which user to use to run our statements against. since it's from a restore, we don't really know the user names, right? we don't know for sure if there is a root postgres user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant