fix(lifecycle): archive remaining WAL files after shutdown#10345
Open
aglees wants to merge 2 commits intocloudnative-pg:mainfrom
Open
fix(lifecycle): archive remaining WAL files after shutdown#10345aglees wants to merge 2 commits intocloudnative-pg:mainfrom
aglees wants to merge 2 commits intocloudnative-pg:mainfrom
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
During pod termination (hibernation, rolling update, node drain), PostgreSQL's built-in archiver may be killed before it can archive the final WAL segment. Add a call to ArchiveAllReadyWALs() after each TryShuttingDownSmartFast() in both shutdown paths (context cancellation and SIGTERM signal) to sweep any remaining .ready WAL files via the plugin sidecar, which outlives the postgres container as a native sidecar. A fresh context.Background() is used for the WAL sweep because the parent context may already be cancelled in the context-cancellation path, which would cause gRPC calls to the sidecar to fail immediately. Errors are logged but do not prevent the instance manager from exiting, consistent with existing shutdown error handling. Closes cloudnative-pg#10341 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Andrew Gleeson <Andrew_Gleeson@external.mckinsey.com>
f37c650 to
74c74ed
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
During pod termination (hibernation, rolling update, node drain), PostgreSQL's built-in archiver may be killed before it can archive the final WAL segment. Add a call to ArchiveAllReadyWALs() after each TryShuttingDownSmartFast() in both shutdown paths (context cancellation and SIGTERM signal) to sweep any remaining .ready WAL files via the plugin sidecar, which outlives the postgres container as a native sidecar.
A fresh context.Background() is used for the WAL sweep because the parent context may already be cancelled in the context-cancellation path, which would cause gRPC calls to the sidecar to fail immediately.
Errors are logged but do not prevent the instance manager from exiting, consistent with existing shutdown error handling.
Closes #10341