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

barman-cloud-restore and missing links for tablespaces #343

Closed
pguser4ever opened this issue Jul 2, 2021 · 2 comments
Closed

barman-cloud-restore and missing links for tablespaces #343

pguser4ever opened this issue Jul 2, 2021 · 2 comments
Assignees
Labels
Milestone

Comments

@pguser4ever
Copy link

pguser4ever commented Jul 2, 2021

Hello
We like Barman and use multiple Barman servers in our production envionment, but to start using the barman-cloud stuff there are several things that causes problems for us. Most of the problems have been reported earlier but not sure about missing links for tablespaces after barman-cloud-wal-restore

1/
barman-cloud-backup seems to be working but we need support for pg_wal and symbolic link
agree with case #327 it is very common to use like we do
(barman-cloud-backup -e AES256 -j -v -J 4 s3://barman-s3-backup/ whdb)

2/
barman-cloud-restore seems to working as well and used recover param.
restore_command = 'barman-cloud-wal-restore s3://barman-s3-backup whdb %f %p'
recovery_target_timeline = 'latest'
But also got ERROR: Barman cloud WAL restore exception: coercing to Unicode: need string or buffer, StreamingBody found
same as #325 ?
(barman-cloud-restore -e AES256 -v s3://barman-s3-backup whdb 20210702T121955 /pg/pgcluster/whdb/data)

3/
Copy all the wal files to local disk
(aws s3 cp s3://barman-s3-backup/whdb/wals/0000018F00000006/ restore_dir --recursive)

changed restore_command
restore_command = 'cp /pg/pglog/whdb/restore_dir/%f "%p"'

4/
started recovery and it worked, instance started up
but connect failed what ??
psql: error: could not connect to server: FATAL: database "whdb" does not exist
DETAIL: The database subdirectory "pg_tblspc/16386/PG_12_201909212/16388" is missing

Same case as #330 ? maybe
But creating links to tablepaces solved the problem

ln -s /pg/pgdata/whdb/data/tswhdb01 /pg/pgcluster/whdb/data/pg_tblspc/16385
ln -s /pg/pgdata/whdb/data/tsuserspace1 /pg/pgcluster/whdb/data/pg_tblspc/16386
ln -s /pg/pgtemp/whdb/data /pg/pgcluster/whdb/data/16387

psql (12.4)
Type "help" for help.
whdb=#

@mikewallace1979 mikewallace1979 added this to the 2.13 milestone Jul 13, 2021
@amenonsen
Copy link
Contributor

About (1), I have a fix for #327 now.

About (2), I'm not sure if it's the same as #325, but we're looking into that. Please provide the complete backtrace if you can.

I'll investigate the tablespace thing now.

amenonsen added a commit that referenced this issue Jul 22, 2021
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

@pguser4ever #355 should address both (1) and (4) above. Comments welcome.

(2) still under investigation.

@amenonsen amenonsen assigned amenonsen and unassigned amenonsen and pguser4ever Jul 22, 2021
amenonsen added a commit that referenced this issue Jul 23, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants