Skip to content

handle a graceful shutdown on request #594

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kathia-barahona
Copy link
Contributor

@kathia-barahona kathia-barahona commented Jul 4, 2023

About this change - What it does

Handles graceful shutdowns by making sure all compressed files get uploaded (considers also partial files)
Edit: renaming partial files is dangerous, after testing I didn't got the expected results (duplicated segments on different timelines)

Why this way

Shutting down pghoard can be dangerous, leading to missed segments if not all information was uploaded. To avoid this, its better to make sure all tasks/events were completed.

@kathia-barahona kathia-barahona self-assigned this Jul 4, 2023
@kathia-barahona kathia-barahona marked this pull request as ready for review July 5, 2023 09:20
@kathia-barahona kathia-barahona requested review from a team as code owners July 5, 2023 09:20
@kathia-barahona
Copy link
Contributor Author

:/ Build failing, seems rohmu got updated again (using Protocol, not supported on 3.7)

@Mulugruntz
Copy link
Contributor

:/ Build failing, seems rohmu got updated again (using Protocol, not supported on 3.7)

To be noted that Python 3.7 reached EOL a week ago.
That raises the question on whether we want to support a Python version on pghoard that is no longer officially supported and will no longer receive security patches.
I'd be in favour of removing 3.7 from the CI here.

@kathia-barahona kathia-barahona marked this pull request as draft July 7, 2023 07:55
@kathia-barahona kathia-barahona force-pushed the graceful_shutdown branch 3 times, most recently from 74b8995 to ed1f39c Compare July 28, 2025 11:10
@kathia-barahona kathia-barahona requested a review from rdunklau July 28, 2025 12:02
@kathia-barahona kathia-barahona marked this pull request as ready for review July 28, 2025 12:02
@kathia-barahona kathia-barahona force-pushed the graceful_shutdown branch 5 times, most recently from def47a1 to d99517e Compare July 28, 2025 15:02
Make sure that queues are emptied and all files are uploaded before shuting down. This way
we make sure that all WAL files are compressed and uploaded before
pghoard getshutdown.

[BF-3320]
@Claudenw
Copy link

@kathia-barahona can you mark this as draft until it is ready for review.
Also, do you know why this was not merged in 2023 when it was originally proposed?

@kathia-barahona
Copy link
Contributor Author

kathia-barahona commented Jul 29, 2025

@kathia-barahona can you mark this as draft until it is ready for review. Also, do you know why this was not merged in 2023 when it was originally proposed?

@Claudenw I am aware of it. At that time I thought this solution was not that necessary, since just stopping pghoard before postgresql seemed to solve the issue we were having (missing the last WAL file).
But we recently got a case were we lost a WAL file in between because of a network issue, so I think now this can actually help with that (I just added a couple of improvements)

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.

4 participants