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

monitor pg connection when uploading chunks #634

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

kathia-barahona
Copy link
Contributor

About this change - What it does

While creating a backup, both pg_start_backup and pg_stop_backup must be executed within the same session. However, in some cases, the backup process may take several hours (especially when processing large chunks). During this time, the PostgreSQL instance may experience a restart, causing the connection used for the backup to be lost.

As a result, pghoard may continue uploading chunks, only to encounter a connection error when attempting to finish the backup. This leads to wasted time, as the system attempts to complete the backup and then raises an exception due to the lost connection. The backup will then retry, potentially leading to further delays and redundant work.

So now, instead of letting the backup continue and fail due to a lost connection, each upload task will actively monitor the connection during the process. If the connection is lost, the task will be aborted, raising an exception to indicate that the connection is no longer available.

Resolves: #BF-2931

Why this way

@kathia-barahona kathia-barahona force-pushed the kathiabarahona/handle_connection_termination branch 6 times, most recently from ad94dad to 7a1d76f Compare November 19, 2024 20:30
@kathia-barahona kathia-barahona requested a review from a team November 19, 2024 20:32
pghoard/pgutil.py Show resolved Hide resolved
@kathia-barahona kathia-barahona force-pushed the kathiabarahona/handle_connection_termination branch 2 times, most recently from fa6c42c to 2561768 Compare November 20, 2024 10:55
@rdunklau
Copy link
Contributor

Other than the small comment on the status above, looks fine to me.

@kathia-barahona kathia-barahona force-pushed the kathiabarahona/handle_connection_termination branch from 2561768 to d0cf535 Compare November 25, 2024 13:33
@rdunklau rdunklau merged commit 31b289c into main Nov 26, 2024
6 checks passed
@rdunklau rdunklau deleted the kathiabarahona/handle_connection_termination branch November 26, 2024 13:14
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

Successfully merging this pull request may close these issues.

2 participants