Skip to content

Стабильно отваливается бэкап, если длится более 1 часа #649

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

Open
bomuva opened this issue Apr 28, 2025 · 0 comments

Comments

@bomuva
Copy link

bomuva commented Apr 28, 2025

Примерно через час с минутами стабильно отваливается полный бэкап вот с таким сообщением

INFO: Start transferring data files
INFO: Data files are transferred, time elapsed: 1h:2m
ERROR: query failed: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
query was: SET client_min_messages = warning;
WARNING: A backup is in progress, stopping it.
ERROR: query failed: no connection to the server
query was: SET datestyle = 'ISO, DMY';
WARNING: query failed: no connection to the server
query was: SELECT pg_catalog.txid_snapshot_xmax(pg_catalog.txid_current_snapshot()), current_timestamp(0)::timestamptz, lsn, labelfile, spcmapfile FROM pg_catalog.pg_backup_stop(false)
ERROR: Failed to send pg_backup_stop query

Бэкап выполняется в удаленном режиме, то есть с другого сервера. При старте бэкапа в БД порождается сессия, которая не открывает транзакцию, и ничего не делает в течение бэкапа и в какой-то момент должна выполнить команду pg_backup_stop в БД, но к этому времени она уже убита, вероятнее всего, сетевым оборудованием, которое отключает бездействующие TCP коннекты. Настройки tcp keepalive на сервере БД не помогают. Очевидно, что для того, чтобы продлить жизнь этой сессии, она должна проявлять какую-то активность в БД, пока файлы бэкапируются, например делать "select 1" каждые n минут.

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

1 participant