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

backup-push does not work on the Postgresql 15/16 without $PGDATA in command line #1385

Open
IgorOhrimenko opened this issue Nov 23, 2022 · 8 comments

Comments

@IgorOhrimenko
Copy link

Database name

Postgresql

Issue description

Describe your problem

Command backup-push does not work on the Postgresql 15 with error:

ERROR: 2022/11/23 17:36:15.308547 unexpected response: &{%!t(string=ERROR) %!t(string=ERROR) %!t(string=42601) %!t(string=syntax error) %!t(string=) %!t(string=) %!t(int32=0) %!t(int32=0) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=repl_scanner.l) %!t(int32=237) %!t(string=replication_yyerror) map[]}:
    github.com/jackc/pglogrepl.getBaseBackupInfo
        /home/user/go/src/github.com/wal-g/wal-g/vendor/github.com/jackc/pglogrepl/pglogrepl.go:408

I try last v2.0.1 and compiled master 3d22cab.

Please provide steps to reproduce

sudo -u postgres wal-g backup-push

Please add config and wal-g stdout/stderr logs for debug purpose

/var/lib/postgresql/.walg.json

{
    "WALG_LOG_LEVEL": "DEVEL",
    "WALE_S3_PREFIX": "s3://backup_postgresql_wal-g/cluster-psql-test/15",
    "AWS_ACCESS_KEY_ID": "backup_postgresql_wal-g",
    "AWS_ENDPOINT": "https://s3",
    "AWS_S3_FORCE_PATH_STYLE": "true",
    "AWS_SECRET_ACCESS_KEY": "pass",
    "AWS_REGION": "region",
    "PGDATA": "/var/lib/postgresql/15/cluster-psql-test",
    "PGHOST": "/var/run/postgresql",
    "PGPORT": "5432",
    "WALG_DELTA_MAX_STEPS": "7",
    "WALG_PREFETCH_DIR": "/var/lib/postgresql/",
    "WALG_TAR_SIZE_THRESHOLD": "4294967296",
    "WALG_UPLOAD_CONCURRENCY": "10",
    "WALG_COMPRESSION_METHOD": "brotli"
}

Full logs with "WALG_LOG_LEVEL": "DEVEL"

DEBUG: 2022/11/23 17:36:15.281532 --- COMPILED ENVIRONMENT VARS ---
DEBUG: 2022/11/23 17:36:15.281735 AWS_ACCESS_KEY=
DEBUG: 2022/11/23 17:36:15.281786 AWS_ACCESS_KEY_ID=backup_postgresql_wal-g
DEBUG: 2022/11/23 17:36:15.281833 AWS_CA_BUNDLE=
DEBUG: 2022/11/23 17:36:15.281879 AWS_CONFIG_FILE=
DEBUG: 2022/11/23 17:36:15.281930 AWS_DEFAULT_OUTPUT=
DEBUG: 2022/11/23 17:36:15.281975 AWS_DEFAULT_REGION=
DEBUG: 2022/11/23 17:36:15.282020 AWS_ENDPOINT=https://s3
DEBUG: 2022/11/23 17:36:15.282067 AWS_PROFILE=
DEBUG: 2022/11/23 17:36:15.282118 AWS_REGION=region
DEBUG: 2022/11/23 17:36:15.282163 AWS_ROLE_ARN=
DEBUG: 2022/11/23 17:36:15.282210 AWS_ROLE_SESSION_NAME=
DEBUG: 2022/11/23 17:36:15.282256 AWS_S3_FORCE_PATH_STYLE=true
DEBUG: 2022/11/23 17:36:15.282308 AWS_SECRET_ACCESS_KEY=pass
DEBUG: 2022/11/23 17:36:15.282357 AWS_SECRET_KEY=
DEBUG: 2022/11/23 17:36:15.282405 AWS_SESSION_TOKEN=
DEBUG: 2022/11/23 17:36:15.282450 AWS_SHARED_CREDENTIALS_FILE=
DEBUG: 2022/11/23 17:36:15.282499 AZURE_BUFFER_SIZE=
DEBUG: 2022/11/23 17:36:15.282544 AZURE_ENDPOINT_SUFFIX=
DEBUG: 2022/11/23 17:36:15.282591 AZURE_ENVIRONMENT_NAME=
DEBUG: 2022/11/23 17:36:15.282637 AZURE_MAX_BUFFERS=
DEBUG: 2022/11/23 17:36:15.282711 AZURE_STORAGE_ACCESS_KEY=
DEBUG: 2022/11/23 17:36:15.282756 AZURE_STORAGE_ACCOUNT=
DEBUG: 2022/11/23 17:36:15.282807 AZURE_STORAGE_SAS_TOKEN=
DEBUG: 2022/11/23 17:36:15.282856 GCS_CONTEXT_TIMEOUT=
DEBUG: 2022/11/23 17:36:15.282901 GCS_ENCRYPTION_KEY=
DEBUG: 2022/11/23 17:36:15.282945 GCS_MAX_CHUNK_SIZE=
DEBUG: 2022/11/23 17:36:15.282989 GCS_MAX_RETRIES=
DEBUG: 2022/11/23 17:36:15.283045 GCS_NORMALIZE_PREFIX=
DEBUG: 2022/11/23 17:36:15.283093 GOMAXPROCS=
DEBUG: 2022/11/23 17:36:15.283137 GOOGLE_APPLICATION_CREDENTIALS=
DEBUG: 2022/11/23 17:36:15.283185 HOME=/var/lib/postgresql
DEBUG: 2022/11/23 17:36:15.283238 HTTP_EXPOSE_EXPVAR=
DEBUG: 2022/11/23 17:36:15.283284 HTTP_EXPOSE_PPROF=
DEBUG: 2022/11/23 17:36:15.283328 HTTP_LISTEN=
DEBUG: 2022/11/23 17:36:15.283373 LANG=en_US.UTF-8
DEBUG: 2022/11/23 17:36:15.283420 LC_ALL=C.UTF-8
DEBUG: 2022/11/23 17:36:15.283465 LOGNAME=postgres
DEBUG: 2022/11/23 17:36:15.283511 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
DEBUG: 2022/11/23 17:36:15.283584 MAIL=/var/mail/postgres
DEBUG: 2022/11/23 17:36:15.283642 OS_AUTH_URL=
DEBUG: 2022/11/23 17:36:15.283688 OS_PASSWORD=
DEBUG: 2022/11/23 17:36:15.283734 OS_REGION_NAME=
DEBUG: 2022/11/23 17:36:15.283780 OS_TENANT_NAME=
DEBUG: 2022/11/23 17:36:15.283826 OS_USERNAME=
DEBUG: 2022/11/23 17:36:15.283872 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
DEBUG: 2022/11/23 17:36:15.283934 PGBACKREST_STANZA=main
DEBUG: 2022/11/23 17:36:15.283980 PGDATA=/var/lib/postgresql/15/cluster-psql-test
DEBUG: 2022/11/23 17:36:15.284027 PGDATABASE=
DEBUG: 2022/11/23 17:36:15.284072 PGHOST=/var/run/postgresql
DEBUG: 2022/11/23 17:36:15.284117 PGPASSFILE=
DEBUG: 2022/11/23 17:36:15.284163 PGPASSWORD=
DEBUG: 2022/11/23 17:36:15.284213 PGPORT=5432
DEBUG: 2022/11/23 17:36:15.284262 PGSSLMODE=
DEBUG: 2022/11/23 17:36:15.284305 PGUSER=
DEBUG: 2022/11/23 17:36:15.284349 PG_READY_RENAME=
DEBUG: 2022/11/23 17:36:15.284403 PROFILE_MODE=
DEBUG: 2022/11/23 17:36:15.284449 PROFILE_PATH=
DEBUG: 2022/11/23 17:36:15.284493 PROFILE_SAMPLING_RATIO=
DEBUG: 2022/11/23 17:36:15.284537 S3_CA_CERT_FILE=
DEBUG: 2022/11/23 17:36:15.284586 S3_ENDPOINT_PORT=
DEBUG: 2022/11/23 17:36:15.284632 S3_ENDPOINT_SOURCE=
DEBUG: 2022/11/23 17:36:15.284677 S3_LOG_LEVEL=
DEBUG: 2022/11/23 17:36:15.284721 S3_MAX_PART_SIZE=
DEBUG: 2022/11/23 17:36:15.284776 S3_MAX_RETRIES=
DEBUG: 2022/11/23 17:36:15.284821 S3_RANGE_BATCH_ENABLED=
DEBUG: 2022/11/23 17:36:15.284867 S3_RANGE_MAX_RETRIES=
DEBUG: 2022/11/23 17:36:15.284913 S3_SSE=
DEBUG: 2022/11/23 17:36:15.284968 S3_SSE_C=
DEBUG: 2022/11/23 17:36:15.285014 S3_SSE_KMS_ID=
DEBUG: 2022/11/23 17:36:15.285057 S3_STORAGE_CLASS=
DEBUG: 2022/11/23 17:36:15.285101 S3_USE_LIST_OBJECTS_V1=
DEBUG: 2022/11/23 17:36:15.285150 S3_USE_YC_SESSION_TOKEN=
DEBUG: 2022/11/23 17:36:15.285195 SHELL=/bin/bash
DEBUG: 2022/11/23 17:36:15.285239 SSH_PASSWORD=
DEBUG: 2022/11/23 17:36:15.285282 SSH_PORT=
DEBUG: 2022/11/23 17:36:15.285336 SSH_PRIVATE_KEY_PATH=
DEBUG: 2022/11/23 17:36:15.285381 SSH_USERNAME=
DEBUG: 2022/11/23 17:36:15.285426 SUDO_COMMAND=/home/user/go/src/github.com/wal-g/wal-g/main/pg/wal-g backup-push
DEBUG: 2022/11/23 17:36:15.285470 SUDO_GID=0
DEBUG: 2022/11/23 17:36:15.285523 SUDO_UID=0
DEBUG: 2022/11/23 17:36:15.285569 SUDO_USER=root
DEBUG: 2022/11/23 17:36:15.285612 TERM=xterm-256color
DEBUG: 2022/11/23 17:36:15.285657 TOTAL_BG_UPLOADED_LIMIT=32
DEBUG: 2022/11/23 17:36:15.285706 UPLOAD_CONCURRENCY=
DEBUG: 2022/11/23 17:36:15.285751 USER=postgres
DEBUG: 2022/11/23 17:36:15.285798 WALE_GPG_KEY_ID=
DEBUG: 2022/11/23 17:36:15.285842 WALE_S3_PREFIX=s3://backup_postgresql_wal-g/cluster-psql-test/15
DEBUG: 2022/11/23 17:36:15.285892 WALG_ALIVE_CHECK_INTERVAL=
DEBUG: 2022/11/23 17:36:15.285936 WALG_AZURE_BUFFER_SIZE=
DEBUG: 2022/11/23 17:36:15.285980 WALG_AZURE_MAX_BUFFERS=
DEBUG: 2022/11/23 17:36:15.286025 WALG_AZ_PREFIX=
DEBUG: 2022/11/23 17:36:15.286074 WALG_COMPRESSION_METHOD=brotli
DEBUG: 2022/11/23 17:36:15.286119 WALG_CSE_KMS_ID=
DEBUG: 2022/11/23 17:36:15.286163 WALG_CSE_KMS_REGION=
DEBUG: 2022/11/23 17:36:15.286206 WALG_DELTA_FROM_NAME=
DEBUG: 2022/11/23 17:36:15.286255 WALG_DELTA_FROM_USER_DATA=
DEBUG: 2022/11/23 17:36:15.286299 WALG_DELTA_MAX_STEPS=7
DEBUG: 2022/11/23 17:36:15.286344 WALG_DELTA_ORIGIN=
DEBUG: 2022/11/23 17:36:15.286388 WALG_DISK_RATE_LIMIT=
DEBUG: 2022/11/23 17:36:15.286437 WALG_DOWNLOAD_CONCURRENCY=10
DEBUG: 2022/11/23 17:36:15.286482 WALG_FETCH_TARGET_USER_DATA=
DEBUG: 2022/11/23 17:36:15.286525 WALG_FILE_PREFIX=
DEBUG: 2022/11/23 17:36:15.286536 WALG_GPG_KEY_ID=
DEBUG: 2022/11/23 17:36:15.286541 WALG_GS_PREFIX=
DEBUG: 2022/11/23 17:36:15.286547 WALG_INTEGRITY_MAX_DELAYED_WALS=0
DEBUG: 2022/11/23 17:36:15.286553 WALG_LIBSODIUM_KEY=
DEBUG: 2022/11/23 17:36:15.286580 WALG_LIBSODIUM_KEY_PATH=
DEBUG: 2022/11/23 17:36:15.286589 WALG_LIBSODIUM_KEY_TRANSFORM=none
DEBUG: 2022/11/23 17:36:15.286595 WALG_LOG_LEVEL=DEVEL
DEBUG: 2022/11/23 17:36:15.286600 WALG_NETWORK_RATE_LIMIT=
DEBUG: 2022/11/23 17:36:15.286628 WALG_PGP_KEY=
DEBUG: 2022/11/23 17:36:15.286635 WALG_PGP_KEY_PASSPHRASE=
DEBUG: 2022/11/23 17:36:15.286641 WALG_PGP_KEY_PATH=
DEBUG: 2022/11/23 17:36:15.286646 WALG_PG_WAL_SIZE=16
DEBUG: 2022/11/23 17:36:15.286673 WALG_PREFETCH_DIR=/var/lib/postgresql/
DEBUG: 2022/11/23 17:36:15.286715 WALG_PREVENT_WAL_OVERWRITE=false
DEBUG: 2022/11/23 17:36:15.286725 WALG_S3_CA_CERT_FILE=
DEBUG: 2022/11/23 17:36:15.286731 WALG_S3_MAX_PART_SIZE=
DEBUG: 2022/11/23 17:36:15.286737 WALG_S3_PREFIX=
DEBUG: 2022/11/23 17:36:15.286742 WALG_S3_SSE=
DEBUG: 2022/11/23 17:36:15.286767 WALG_S3_SSE_C=
DEBUG: 2022/11/23 17:36:15.286776 WALG_S3_SSE_KMS_ID=
DEBUG: 2022/11/23 17:36:15.286782 WALG_S3_STORAGE_CLASS=
DEBUG: 2022/11/23 17:36:15.286787 WALG_SENTINEL_USER_DATA=
DEBUG: 2022/11/23 17:36:15.286811 WALG_SERIALIZER_TYPE=json_default
DEBUG: 2022/11/23 17:36:15.286820 WALG_SKIP_REDUNDANT_TARS=false
DEBUG: 2022/11/23 17:36:15.286826 WALG_SLOTNAME=
DEBUG: 2022/11/23 17:36:15.286850 WALG_SSH_PREFIX=
DEBUG: 2022/11/23 17:36:15.286859 WALG_STATSD_ADDRESS=
DEBUG: 2022/11/23 17:36:15.286864 WALG_STOP_BACKUP_TIMEOUT=
DEBUG: 2022/11/23 17:36:15.286870 WALG_STORAGE_PREFIX=
DEBUG: 2022/11/23 17:36:15.286900 WALG_STORE_ALL_CORRUPT_BLOCKS=false
DEBUG: 2022/11/23 17:36:15.286907 WALG_STREAM_CREATE_COMMAND=
DEBUG: 2022/11/23 17:36:15.286913 WALG_STREAM_RESTORE_COMMAND=
DEBUG: 2022/11/23 17:36:15.286919 WALG_SWIFT_PREFIX=
DEBUG: 2022/11/23 17:36:15.286943 WALG_TAR_DISABLE_FSYNC=false
DEBUG: 2022/11/23 17:36:15.286952 WALG_TAR_SIZE_THRESHOLD=4294967296
DEBUG: 2022/11/23 17:36:15.286958 WALG_UPLOAD_CONCURRENCY=10
DEBUG: 2022/11/23 17:36:15.286964 WALG_UPLOAD_DISK_CONCURRENCY=1
DEBUG: 2022/11/23 17:36:15.286991 WALG_UPLOAD_QUEUE=2
DEBUG: 2022/11/23 17:36:15.286997 WALG_UPLOAD_WAL_METADATA=NOMETADATA
DEBUG: 2022/11/23 17:36:15.287003 WALG_USE_COPY_COMPOSER=false
DEBUG: 2022/11/23 17:36:15.287026 WALG_USE_RATING_COMPOSER=false
DEBUG: 2022/11/23 17:36:15.287036 WALG_USE_REVERSE_UNPACK=false
DEBUG: 2022/11/23 17:36:15.287042 WALG_USE_WAL_DELTA=false
DEBUG: 2022/11/23 17:36:15.287048 WALG_VERIFY_PAGE_CHECKSUMS=false
DEBUG: 2022/11/23 17:36:15.287054 WALG_WITHOUT_FILES_METADATA=false
DEBUG: 2022/11/23 17:36:15.287090 YC_CSE_KMS_KEY_ID=
DEBUG: 2022/11/23 17:36:15.287096 YC_SERVICE_ACCOUNT_KEY_FILE=
DEBUG: 2022/11/23 17:36:15.287548 Initializing tmp connection to read Postgres info
WARNING: 2022/11/23 17:36:15.301291 It seems your archive_mode is not enabled. This will cause inconsistent backup. Please consider configuring WAL archiving.
DEBUG: 2022/11/23 17:36:15.302755 Datadir: /var/lib/postgresql/15/cluster-psql-test
DEBUG: 2022/11/23 17:36:15.302952 Postgres version: 150001
DEBUG: 2022/11/23 17:36:15.303149 Postgres SystemIdentifier: 150001
DEBUG: 2022/11/23 17:36:15.304919 Base backup folder: &{{%!s(*s3manager.Uploader=&{20971520 10 false 10000 0xc000010748 [] <nil> 0xc0002de9b0})    STANDARD} %!s(*s3.S3=&{0xc000967180}) %!s(*string=0xc0003d3c60) cluster-psql-test/15/basebackups_005/ map[AWS_ACCESS_KEY_ID:backup_postgresql_wal-g AWS_ENDPOINT:https://s3 AWS_REGION:region AWS_S3_FORCE_PATH_STYLE:true AWS_SECRET_ACCESS_KEY:pass UPLOAD_CONCURRENCY:10] %!s(bool=false)}
INFO: 2022/11/23 17:36:15.304931 Running remote backup through Postgres connection.
INFO: 2022/11/23 17:36:15.304934 Features like delta backup are disabled, there might be a performance impact.
INFO: 2022/11/23 17:36:15.304936 To run with local backup functionalities, supply [db_directory].
DEBUG: 2022/11/23 17:36:15.304946 Uploading folder: &{{%!s(*s3manager.Uploader=&{20971520 10 false 10000 0xc000010748 [] <nil> 0xc0002de9b0})    STANDARD} %!s(*s3.S3=&{0xc000967180}) %!s(*string=0xc0003d3d50) cluster-psql-test/15/basebackups_005/ map[AWS_ACCESS_KEY_ID:backup_postgresql_wal-g AWS_ENDPOINT:https://s3 AWS_REGION:region AWS_S3_FORCE_PATH_STYLE:true AWS_SECRET_ACCESS_KEY:pass UPLOAD_CONCURRENCY:10] %!s(bool=false)}
DEBUG: 2022/11/23 17:36:15.304954 Connecting to Postgres (replication connection)
INFO: 2022/11/23 17:36:15.306780 Starting remote backup
ERROR: 2022/11/23 17:36:15.308547 unexpected response: &{%!t(string=ERROR) %!t(string=ERROR) %!t(string=42601) %!t(string=syntax error) %!t(string=) %!t(string=) %!t(int32=0) %!t(int32=0) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=repl_scanner.l) %!t(int32=237) %!t(string=replication_yyerror) map[]}:
    github.com/jackc/pglogrepl.getBaseBackupInfo
        /home/user/go/src/github.com/wal-g/wal-g/vendor/github.com/jackc/pglogrepl/pglogrepl.go:408

\dconfig

                     List of non-default configuration parameters
         Parameter          |                          Value
----------------------------+----------------------------------------------------------
 application_name           | psql
 archive_command            | exit 0
 archive_mode               | on
 archive_timeout            | 1min
 cluster_name               | cluster-psql-test-15
 config_file                | /var/lib/postgresql/15/cluster-psql-test/postgresql.conf
 data_directory             | /var/lib/postgresql/15/cluster-psql-test
 default_text_search_config | pg_catalog.english
 effective_cache_size       | 1685MB
 effective_io_concurrency   | 200
 hba_file                   | /var/lib/postgresql/15/cluster-psql-test/pg_hba.conf
 ident_file                 | /var/lib/postgresql/15/cluster-psql-test/pg_ident.conf
 lc_messages                | en_US.UTF-8
 lc_monetary                | en_US.UTF-8
 lc_numeric                 | en_US.UTF-8
 lc_time                    | en_US.UTF-8
 listen_addresses           | 127.0.0.1,10.10.10.10
 log_directory              | /var/log/postgresql
 log_filename               | cluster-psql-test.log
 logging_collector          | on
 log_min_duration_statement | 5s
 log_rotation_age           | 0
 log_rotation_size          | 0
 log_timezone               | Europe/Moscow
 maintenance_work_mem       | 198MB
 max_connections            | 500
 max_wal_size               | 2GB
 min_wal_size               | 1GB
 pg_stat_statements.max     | 10000
 pg_stat_statements.track   | all
 random_page_cost           | 1.1
 shared_buffers             | 991MB
 shared_preload_libraries   | pg_stat_statements
 TimeZone                   | Europe/Moscow
 unix_socket_directories    | /var/run/postgresql/
 wal_buffers                | 16MB
 wal_keep_size              | 2GB
 wal_level                  | logical
 wal_log_hints              | on
 work_mem                   | 2MB
(40 rows)

@x4m
Copy link
Collaborator

x4m commented Nov 23, 2022

@sebasmannem Sebas, I think it's a problem of the remote backup.

Also, as a side note - was it really a good idea to default to remote backup when run without path in command line?

@IgorOhrimenko just use sudo -u postgres wal-g backup-push $PGDATA.

@usernamedt
Copy link
Member

usernamedt commented Nov 23, 2022

@sebasmannem Sebas, I think it's a problem of the remote backup.

Also, as a side note - was it really a good idea to default to remote backup when run without path in command line?

@IgorOhrimenko just use sudo -u postgres wal-g backup-push $PGDATA.

We can move the remote backup option to a separate flag, e.g. --remote since many users are being confused with this behaviour. Also, we need to add a release note about this breaking change.

@x4m
Copy link
Collaborator

x4m commented Nov 23, 2022

I think this is a good idea. It's kind of new feature compared to regular backup and we just activate it silently... maybe give a hint if no --remote is given?

@IgorOhrimenko
Copy link
Author

IgorOhrimenko commented Nov 24, 2022

@sebasmannem Sebas, I think it's a problem of the remote backup.

Also, as a side note - was it really a good idea to default to remote backup when run without path in command line?

@IgorOhrimenko just use sudo -u postgres wal-g backup-push $PGDATA.

There is $PGDATA in the /var/lib/postgresql/.walg.json and sudo -u postgres wal-g backup-push $PGDATA the same does not work because there is no $PGDATA in system env.
But the sudo -u postgres wal-g backup-push /var/lib/postgresql/15/cluster-psql-test/ work.
On the 10,11,12,13,14 does not require PATH in command line and wal-g get it from .walg.json, why wal-g on the 15 require PATH?

@x4m
Copy link
Collaborator

x4m commented Nov 24, 2022

You encounter one bug and one unexpected behavior:

  1. Unexpected behavior - is that remote backup is enabled by default if no data_dir is supplied as command line argument. Remote backup - is a tricky feature that is at least less performant than usual local backup. We should warn user about it and ask for explicit consent.
  2. There's a bug in remote backup of PG15, which is kind of not a sunrise given that
  • remote backup feature is relatively new and not very extensively used in the wild, and
  • PG 15 is relatively new.

@LeGEC
Copy link
Contributor

LeGEC commented Dec 7, 2022

#1396 currently allows to fix the first error,

another error is triggered at a later step :

ERROR: 2022/12/07 22:54:15.269275 CompressAndEncrypt: compress: archive/tar: invalid tar header

Please provide steps to reproduce (if it's a bug)

`local.json`
{
    "PGHOST": "localhost",
    "PGPORT": "4321",
    "PGUSER": "replication",
    "PGDATABASE": "test_database",
    "PGPASSWORD": "password",

    "WALG_COMPRESSION_METHOD": "zstd",
    "WALG_DELTA_MAX_STEPS": "6",
    
    "WALG_FILE_PREFIX": "data",

    "WALG_TAR_DISABLE_FSYNC":"true"
}
make pg_build
main/pg/wal-g --config local.json backup-push

Please add config and wal-g stdout/stderr logs for debug purpose

also you can use WALG_LOG_LEVEL=DEVEL for logs collecting

If you can, provide logs
$ WALG_LOG_LEVEL=DEVEL ./wal-g --config local.clear.json backup-push
DEBUG: 2022/12/07 22:54:15.202555 --- COMPILED ENVIRONMENT VARS ---
	PGBACKREST_STANZA=main
	PGDATABASE=test_database
	PGHOST=localhost
	PGPASSWORD=--HIDDEN--
	PGPORT=4321
	PGUSER=replication
	TOTAL_BG_UPLOADED_LIMIT=32
	WALG_COMPRESSION_METHOD=zstd
	WALG_DELTA_MAX_STEPS=6
	WALG_DOWNLOAD_CONCURRENCY=10
	WALG_FILE_PREFIX=data
	WALG_INTEGRITY_MAX_DELAYED_WALS=0
	WALG_LIBSODIUM_KEY_TRANSFORM=none
	WALG_LOG_LEVEL=DEVEL
	WALG_PG_WAL_SIZE=16
	WALG_PREVENT_WAL_OVERWRITE=false
	WALG_SERIALIZER_TYPE=json_default
	WALG_SKIP_REDUNDANT_TARS=false
	WALG_STORE_ALL_CORRUPT_BLOCKS=false
	WALG_TAR_DISABLE_FSYNC=true
	WALG_TAR_SIZE_THRESHOLD=1073741823
	WALG_UPLOAD_CONCURRENCY=16
	WALG_UPLOAD_DISK_CONCURRENCY=1
	WALG_UPLOAD_QUEUE=2
	WALG_UPLOAD_WAL_METADATA=NOMETADATA
	WALG_USE_COPY_COMPOSER=false
	WALG_USE_RATING_COMPOSER=false
	WALG_USE_REVERSE_UNPACK=false
	WALG_USE_WAL_DELTA=false
	WALG_VERIFY_PAGE_CHECKSUMS=false
	WALG_WITHOUT_FILES_METADATA=false
DEBUG: 2022/12/07 22:54:15.202705 Initializing tmp connection to read Postgres info
DEBUG: 2022/12/07 22:54:15.212066 Datadir: /home/gvarouchas/dev/pgsql/data
DEBUG: 2022/12/07 22:54:15.212207 Postgres version: 150000
DEBUG: 2022/12/07 22:54:15.212350 Postgres SystemIdentifier: 150000
INFO: 2022/12/07 22:54:15.212526 Running remote backup through Postgres connection.
INFO: 2022/12/07 22:54:15.212534 Features like delta backup are disabled, there might be a performance impact.
INFO: 2022/12/07 22:54:15.212538 To run with local backup functionalities, supply [db_directory].
DEBUG: 2022/12/07 22:54:15.212559 Uploading folder: &{data basebackups_005}
DEBUG: 2022/12/07 22:54:15.212570 Connecting to Postgres (replication connection)
INFO: 2022/12/07 22:54:15.216669 Starting remote backup
INFO: 2022/12/07 22:54:15.266169 Streaming remote backup
DEBUG: 2022/12/07 22:54:15.268538 Put base_0000000100000000000000EA/tar_partitions/part_001.tar.zst into basebackups_005
DEBUG: 2022/12/07 22:54:15.269049 Next file
INFO: 2022/12/07 22:54:15.269076 Adding data directory
ERROR: 2022/12/07 22:54:15.269275 CompressAndEncrypt: compress: archive/tar: invalid tar header
FS error : Unable to copy data to data/basebackups_005/base_0000000100000000000000EA/tar_partitions/part_001.tar.zst
github.com/wal-g/wal-g/pkg/storages/storage.NewError
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/storage/errors.go:27
github.com/wal-g/wal-g/pkg/storages/fs.NewError
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/fs/folder.go:17
github.com/wal-g/wal-g/pkg/storages/fs.(*Folder).PutObject
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/fs/folder.go:121
github.com/wal-g/wal-g/internal.(*Uploader).Upload
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/uploader.go:173
github.com/wal-g/wal-g/internal/databases/postgres.(*StreamingBaseBackup).Upload
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/streaming_base_backup.go:135
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).runRemoteBackup
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:463
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).createAndPushRemoteBackup
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:374
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).handleBackupPushRemote
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:329
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).HandleBackupPush
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:310
github.com/wal-g/wal-g/cmd/pg.glob..func4
	/home/gvarouchas/code/github.com/LeGEC/wal-g/cmd/pg/backup_push.go:97
github.com/spf13/cobra.(*Command).execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:860
github.com/spf13/cobra.(*Command).ExecuteC
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:974
github.com/spf13/cobra.(*Command).Execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:902
github.com/wal-g/wal-g/cmd/pg.Execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/cmd/pg/pg.go:45
main.main
	/home/gvarouchas/code/github.com/LeGEC/wal-g/main/pg/main.go:8
runtime.main
	/home/gvarouchas/go/src/runtime/proc.go:250
runtime.goexit
	/home/gvarouchas/go/src/runtime/asm_amd64.s:1594
ERROR: 2022/12/07 22:54:15.269384 CompressAndEncrypt: compress: archive/tar: invalid tar header
FS error : Unable to copy data to data/basebackups_005/base_0000000100000000000000EA/tar_partitions/part_001.tar.zst
github.com/wal-g/wal-g/pkg/storages/storage.NewError
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/storage/errors.go:27
github.com/wal-g/wal-g/pkg/storages/fs.NewError
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/fs/folder.go:17
github.com/wal-g/wal-g/pkg/storages/fs.(*Folder).PutObject
	/home/gvarouchas/code/github.com/LeGEC/wal-g/pkg/storages/fs/folder.go:121
github.com/wal-g/wal-g/internal.(*Uploader).Upload
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/uploader.go:173
github.com/wal-g/wal-g/internal/databases/postgres.(*StreamingBaseBackup).Upload
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/streaming_base_backup.go:135
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).runRemoteBackup
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:463
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).createAndPushRemoteBackup
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:374
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).handleBackupPushRemote
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:329
github.com/wal-g/wal-g/internal/databases/postgres.(*BackupHandler).HandleBackupPush
	/home/gvarouchas/code/github.com/LeGEC/wal-g/internal/databases/postgres/backup_push_handler.go:310
github.com/wal-g/wal-g/cmd/pg.glob..func4
	/home/gvarouchas/code/github.com/LeGEC/wal-g/cmd/pg/backup_push.go:97
github.com/spf13/cobra.(*Command).execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:860
github.com/spf13/cobra.(*Command).ExecuteC
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:974
github.com/spf13/cobra.(*Command).Execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/vendor/github.com/spf13/cobra/command.go:902
github.com/wal-g/wal-g/cmd/pg.Execute
	/home/gvarouchas/code/github.com/LeGEC/wal-g/cmd/pg/pg.go:45
main.main
	/home/gvarouchas/code/github.com/LeGEC/wal-g/main/pg/main.go:8
runtime.main
	/home/gvarouchas/go/src/runtime/proc.go:250
runtime.goexit
	/home/gvarouchas/go/src/runtime/asm_amd64.s:1594

@IgorOhrimenko IgorOhrimenko changed the title backup-push does not work on the Postgresql 15 backup-push does not work on the Postgresql 15/16 Oct 25, 2023
@IgorOhrimenko IgorOhrimenko changed the title backup-push does not work on the Postgresql 15/16 backup-push does not work on the Postgresql 15/16 without $PGDATA in command line Oct 25, 2023
@IgorOhrimenko
Copy link
Author

A year has passed.
The PG15 is outdated, I installed PG16 and get the same error:

ERROR: 2023/10/25 15:37:36.274535 unexpected response: &{%!t(string=ERROR) %!t(string=ERROR) %!t(string=42601) %!t(string=syntax error) %!t(string=) %!t(string=) %!t(int32=0) %!t(int32=0) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=repl_scanner.l) %!t(int32=247) %!t(string=replication_yyerror) map[]}

and the same workaround is working:
wal-g backup-push /var/lib/postgresql/16/cluster-psql-test

Relative #1248

@x4m
Copy link
Collaborator

x4m commented Oct 25, 2023

A year has passed. The PG15 is outdated, I installed PG16 and get the same error:

ERROR: 2023/10/25 15:37:36.274535 unexpected response: &{%!t(string=ERROR) %!t(string=ERROR) %!t(string=42601) %!t(string=syntax error) %!t(string=) %!t(string=) %!t(int32=0) %!t(int32=0) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=) %!t(string=repl_scanner.l) %!t(int32=247) %!t(string=replication_yyerror) map[]}

and the same workaround is working: wal-g backup-push /var/lib/postgresql/16/cluster-psql-test

Relative #1248

It’s not workaround. It’s correct expected recommended syntax. The problem is we have a remote backup which tries to kick in… and that’s kind of a bug.

tangtx3 pushed a commit to tangtx3/wal-g that referenced this issue Nov 16, 2023
* In the streamFromPostgres method, CopyData case adds data receiving processing from pgsql version 15 or later.
* In the streamFromPostgres method, add NoticeResponse case.
* Troubleshoot EOF problems caused by the last zeroBlock message sent from pgsql15 or later.
* Add test for Supports remote backup push from PostgreSQL 15 or later
tangtx3 pushed a commit to tangtx3/wal-g that referenced this issue Nov 16, 2023
* In the streamFromPostgres method, CopyData case adds data receiving processing from pgsql version 15 or later.
* In the streamFromPostgres method, add NoticeResponse case.
* Troubleshoot EOF problems caused by the last zeroBlock message sent from pgsql15 or later.
* Add test for Supports remote backup push from PostgreSQL 15 or later

Signed-off-by: tangtx <tianxitang@harmonycloud.cn>
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

No branches or pull requests

4 participants