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 all commits
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"
6 changes: 6 additions & 0 deletions jobs/bbr-postgres-db/templates/restore.sh.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export_as_private_temp_file "$JOB_DIR/config/pgpass" PGPASSFILE
export_as_private_temp_file "$JOB_DIR/config/client_certificate_key" PGSSLKEY
<% end %>

SINGLE_TRANSACTION=
<% if p("postgres.single-transaction") %>
SINGLE_TRANSACTION="--single-transaction"
<% end %>

for dbname in ${DATABASES[@]}; do
BBR_ARTIFACT_FILE_PATH="${BBR_ARTIFACT_DIRECTORY}/postgres_${dbname}.sql"
if [ -f "${BBR_ARTIFACT_FILE_PATH}" ]; then
Expand All @@ -41,6 +46,7 @@ for dbname in ${DATABASES[@]}; do
--use-list=${TMP_LIST_FILE} \
--if-exists \
--clean \
${SINGLE_TRANSACTION} \
"${BBR_ARTIFACT_FILE_PATH}"
else
echo "WARNING: Not restoring ${dbname} because backup file ${BBR_ARTIFACT_FILE_PATH} does not exist"
Expand Down