Skip to content

add singel-transaction option #55

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 5 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions jobs/bbr-postgres-db/spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ properties:
postgres.client_certificate_key:
default: ''
description: "Secret key used for the client certificate. Specify it if you want to auhtenticate using certificates."
postgres.single-transaction:
default: false
description: "uses singele transaction when restoring databases"
3 changes: 3 additions & 0 deletions jobs/bbr-postgres-db/templates/restore.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ for dbname in ${DATABASES[@]}; do
--use-list=${TMP_LIST_FILE} \
--if-exists \
--clean \
<% if p("postgres.single-transaction") %>
Copy link
Contributor

Choose a reason for hiding this comment

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

@ramonskie Thanks for the PR. The empty line left behind by the tag after the erb processing causes the "${BBR_ARTIFACT_FILE_PATH}" line not to be concatenated to the restore command.
I suggest to create a variable that contains the --single-transaction only if the new property is specified; then you can unconditionally use the variable with the continuation character in the restore command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed the \ so that even when false an empty line will be added to the command.

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems not to work when the property is true:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

followed your advise and putted it in to a variable.
otherwise there would be to much empty line with \ in the command

--single-transaction \
<% end %>
"${BBR_ARTIFACT_FILE_PATH}"
else
echo "WARNING: Not restoring ${dbname} because backup file ${BBR_ARTIFACT_FILE_PATH} does not exist"
Expand Down