cloudnative-pg / cloudnative-pg/cloudnative-pg

[Feature]: Capture shutdown diagnostics before immediate PostgreSQL shutdown

Open
#11,136 0 comments 2 reactions 1 assignee Claimed by @gbartolini View on GitHub
triage
Dominant language
Go
Stars
9.3k
Forks
759
Avg merge
2d 6h
Merged PRs (30d)
44

Description

### Is there an existing issue already for this feature request/idea?

- [x] I have searched for an existing issue, and could not find anything. I believe this is a new feature request to be evaluated.

### What problem is this feature going to solve? Why should it be added?

We recently had a fairly painful incident on CNPG. The root cause was a hung postgres shutdown which has been reported to hackers - but there was not enough diagnostics to further root cause.

https://www.postgresql.org/message-id/flat/CA%2BfnDAa8Kbbx3KkqpfxutTx41RchJsT3Lykqwcedm0CVr5Tw%3DA%40mail.gmail.com

We would like to preserve diagnostic evidence immediately before CNPG requests abortive PostgreSQL shutdown. Currently, when shutdown hangs until CloudNativePG escalates to immediate shutdown, the remaining PostgreSQL process state is the most useful evidence but is often lost as the pod exits or is killed.

### Describe the solution you'd like

Want to add a minimal instance-manager diagnostics collector that runs only when a fast PostgreSQL shutdown fails and CloudNativePG is about to issue `pg_ctl -m immediate stop`.

### Describe alternatives you've considered

An operator manually collects troubleshooting info when a hung shutdown happens. Requires oncall/paging, immediate response, and requires delaying resolution for collecting data.

### Additional context

_No response_

### Backport?

Yes

### Are you willing to actively contribute to this feature?

Yes

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.