Skip to content

Conversation

cbandy
Copy link
Member

@cbandy cbandy commented Oct 2, 2025

This is similar to #4304, but for restore jobs in PostgresCluster using Postgres images.

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature

Other Information:

📝 Might be easier to review as separate commits.

Issue: PGO-864

// Patroni config when bootstrapping a cluster using an existing data directory.
func RestoreCommand(pgdata, hugePagesSetting, fetchKeyCommand string, _ []*corev1.PersistentVolumeClaim, args ...string) []string {
ps := postgres.NewParameterSet()
func RestoreCommand(postgresVersion int32, pgdata string, params *postgres.ParameterSet, args ...string) []string {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

// ensure options are properly set
// TODO (andrewlecuyer): move validation logic to a webhook
for _, opt := range options {
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to check all the flags and emit all the errors at once?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to change any more of this behavior right now. 🌱 The comment above suggests CRD validation.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be ranging over hasOptions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not that I know of. What would a range do here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see where I was going wrong: in the original code, we loop over the options, and if one of them is wrong for some reason, we emit an event and return.

(As opposed to, say, telling the user every things that's wrong with their input in one pass.)

cbandy added 3 commits October 3, 2025 10:21
Input options were being scanned multiple times in different ways.
This makes restores compatible with images from other distros.

Issue: PGO-864
@cbandy cbandy merged commit 0276eff into CrunchyData:main Oct 6, 2025
19 checks passed
@cbandy cbandy deleted the restore-paths branch October 6, 2025 15:19
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.

2 participants