-
Notifications
You must be signed in to change notification settings - Fork 636
Look in more directories for restore binaries #4310
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,10 +212,9 @@ func MakePGBackrestLogDir(template *corev1.PodTemplateSpec, | |
// - Renames the data directory as needed to bootstrap the cluster using the restored database. | ||
// This ensures compatibility with the "existing" bootstrap method that is included in the | ||
// 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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
ps := params.DeepCopy() | ||
ps.Add("data_directory", pgdata) | ||
ps.Add("huge_pages", hugePagesSetting) | ||
|
||
// Keep history and WAL files until the cluster starts with its normal | ||
// archiving enabled. | ||
|
@@ -226,10 +225,6 @@ func RestoreCommand(pgdata, hugePagesSetting, fetchKeyCommand string, _ []*corev | |
// progress during recovery. | ||
ps.Add("hot_standby", "on") | ||
|
||
if fetchKeyCommand != "" { | ||
ps.Add("encryption_key_command", fetchKeyCommand) | ||
} | ||
|
||
configure := strings.Join([]string{ | ||
// With "hot_standby" on, some parameters cannot be smaller than they were | ||
// when Postgres was backed up. Configure these to match values reported by | ||
|
@@ -271,6 +266,7 @@ func RestoreCommand(pgdata, hugePagesSetting, fetchKeyCommand string, _ []*corev | |
|
||
script := strings.Join([]string{ | ||
`declare -r PGDATA="$1" opts="$2"; export PGDATA PGHOST`, | ||
postgres.ShellPath(postgresVersion), | ||
|
||
// Remove any "postmaster.pid" file leftover from a prior failure. | ||
`rm -f "${PGDATA}/postmaster.pid"`, | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.)