Skip to content

Conversation

@jason-lynch
Copy link
Member

Summary

Replaces custom quoting logic with the shellescape library and moves it to only affect the Patroni bootstrap command.

Changes

Docker already escapes and quotes arguments, so the backup workflow breaks when we pre-quote those arguments. However, we still need the quoting when we build the bootstrap command in a Patroni config. Using a library for this handles more cases than just whitespace characters.

Testing

You can test this by adding restore_options to the local-backup-and-restore Bruno scenario, e.g.:

{
  "restore_config": {
    "source_database_id": "storefront",
    "source_node_name": "n1",
    "source_database_name": "storefront",
    "repository": {
      "id": "{{repository_id}}",
      "type": "posix",
      "base_path": "/backups"
    },
    "restore_options": {
      "type": "time",
      "target": "2025-12-19 13:27:12+00"
    }
  }
}

Note that when testing the restore functionality, you should use a timestamp after the end of the most recent full backup. When testing the create from backup functionality, you should just the beginning timestamp for your backup set. You can inspect your backup sets by running pgbackrest info inside the container, e.g.:

# use the dev-env.zsh helper to exec into the n1 container
cp-docker-exec

# then from inside the container
pgbackrest --stanza=db --config=/opt/pgedge/configs/pgbackrest.backup.conf

PLAT-365

Replaces custom quoting logic with the shellescape library and moves it
to only affect the Patroni bootstrap command.

Explanation: Docker already escapes and quotes arguments, so the backup
workflow breaks when we pre-quote those arguments. However, we still
need the quoting when we build the bootstrap command in a Patroni
config. Using a library for this handles more cases than just whitespace
characters.

You can test this by adding `restore_options` to the
`local-backup-and-restore` Bruno scenario, e.g.:

```json
{
  "restore_config": {
    "source_database_id": "storefront",
    "source_node_name": "n1",
    "source_database_name": "storefront",
    "repository": {
      "id": "{{repository_id}}",
      "type": "posix",
      "base_path": "/backups"
    },
    "restore_options": {
      "type": "time",
      "target": "2025-12-19 13:27:12+00"
    }
  }
}

```

Note that when testing the restore functionality, you should use a
timestamp after the end of the most recent full backup. When testing
the create from backup functionality, you should just the beginning
timestamp for your backup set. You can inspect your backup sets by
running `pgbackrest info` inside the container, e.g.:

```sh
# use the dev-env.zsh helper to exec into the n1 container
cp-docker-exec

# then from inside the container
pgbackrest --stanza=db --config=/opt/pgedge/configs/pgbackrest.backup.conf
```

PLAT-365
@jason-lynch jason-lynch requested a review from mmols December 19, 2025 15:09
@jason-lynch jason-lynch merged commit 565b838 into main Dec 19, 2025
2 checks passed
@jason-lynch jason-lynch deleted the fix/PLAT-365/remove-quotes branch December 19, 2025 15:48
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.

3 participants