Skip to content
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

Recreate pg_wal if required in barman-cloud-restore #355

Closed
wants to merge 2 commits into from

Conversation

amenonsen
Copy link
Contributor

If you run barman-cloud-backup on a data directory where pg_wal is a
symlink, it doesn't include pg_wal in the uploaded tar files, and the
pg_wal directory will not be created if you restore the backup.

We fix this by creating pg_wal in the destination directory if it does
not exist at the end of the backup.

Closes #327

@amenonsen
Copy link
Contributor Author

I've added another commit to add the tablespace remapping feature mentioned in #343 and #330

If you run barman-cloud-backup on a data directory where pg_wal is a
symlink, it doesn't include pg_wal in the uploaded tar files, and the
pg_wal directory will not be created if you restore the backup.

We fix this by creating pg_wal (or pg_xlog, depending on the version) in
the destination directory if it does not exist at the end of the backup.

Closes #327
Each tablespace has a name, an oid, and a location (directory), and
there is a symbolic link from $PGDATA/pg_tblspc/$oid to the location.
barman-cloud-backup uploads a $oid.tar file for each tablespace, and
records the properties of each tablespace in backup_info.tablespaces.

Until now, barman-cloud-restore knew only how to download $oid.tar and
extract its contents to the original location. Here we add a couple of
new features:

1. You may optionally specify `--tablespace name:/new/location` to
   extract a given tablespace to a different location (you can repeat
   this option multiple times)

2. After downloading and extracting $oid.tar to the desired location, we
   now recreate the symbolic link from $PGDATA/pg_tblspc/$oid to that
   directory.

Closes #343
Closes #330
@amenonsen
Copy link
Contributor Author

Merged.

@amenonsen amenonsen closed this Jul 24, 2021
@amenonsen amenonsen deleted the dev/327-restore-pg_wal branch July 24, 2021 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants