cybertec-postgresql / CYBERTEC-pg-container

Apache License 2.0
1 stars 0 forks source link

pgbackrest initialization fails on GCS #50

Open rocket357 opened 2 months ago

rocket357 commented 2 months ago

Hello team,

Using pg-container: docker.io/cybertecpostgresql/cybertec-pg-container-dev:postgres-16.3-2

Running on GCS, and for reasons unknown to me the operator is setting "repo1-gcs-region" (region is not required on GCS like it is on AWS), and this causes an error to be output when /scripts/pgbackrest/repo-host/start.sh is run for the first time.

For reference, the error output I'm seeing is:

(same command from line 12)

[postgres@jjsisson-test-major-upgrade3-0 ~]$ pgbackrest info --stanza=db --output=json 
P00   WARN: configuration file contains invalid option 'repo1-gcs-region'
[{"archive":[],"backup":[],"cipher":"none","db":[],"name":"db","repo":[{"cipher":"none","key":1,"status":{"code":1,"message":"missing stanza path"}}],"status":{"code":1,"lock":{"backup":{"held":false}},"message":"missing stanza path"}}]

Given the json output, it should parse properly in the following 2-3 lines setting variables for db=, archive=, and status=, but the error output breaks it and results in the following logged:

Initialise pgBackRest ... 
parse error: Invalid numeric literal at line 1, column 4

Uncaught FileWriteError: unable to write log to stdout: [32] Broken pipe
    thrown at common/log.c:320

parse error: Invalid numeric literal at line 1, column 4
Stanza version matches another PostgreSQL version: A Stanza upgrade is required to ensure that pgBackRest can work with the current version of PostgreSQL
P00   WARN: configuration file contains invalid option 'repo1-gcs-region'
2024-07-31 20:38:21.702 P00  ERROR: [055]: unable to load info file '/cybertec/jjsisson-test-major-upgrade3/archive/db/archive.info' or '/cybertec/jjsisson-test-major-upgrade3/archive/db/archive.info.copy':
                                    FileMissingError: unable to open missing file '/cybertec/jjsisson-test-major-upgrade3/archive/db/archive.info' for read
                                    FileMissingError: unable to open missing file '/cybertec/jjsisson-test-major-upgrade3/archive/db/archive.info.copy' for read
                                    HINT: archive.info cannot be opened but is required to push/get WAL segments.
                                    HINT: is archive_command configured correctly in postgresql.conf?
                                    HINT: has a stanza-create been performed?
                                    HINT: use --no-archive-check to disable archive checks during backup if you have an alternate archiving scheme.

This causes the cluster creation to fail.

I tried a quick and dirty "2>/dev/null" on the pgbackrest info command, but that didn't help, as it seems pgbackrest outputs that to stdout, not stderr. I'm not certain how to approach resolving this, given that.

Alternatively, I can open an issue in the CYBERTEC-pg-operator repo to investigate why the repo1-gcs-region variable is being set incorrectly?

rocket357 commented 2 months ago

Looks like the relevant line in the operator code is here. If repo.Storage is 'gcs', the region shouldn't be set.