Track live PostgreSQL readiness - #1602
Open
snevolin wants to merge 1 commit into
Open
Conversation
Probe the devshard PostgreSQL pool in the background so readiness reflects a database outage that happens after startup instead of remaining latched forever. Use two-sample failure and recovery hysteresis to avoid flapping, combine the result with session-index readiness, and stop the monitor cleanly when storage closes. Add a unit test for the hysteresis state machine and a Docker test that verifies readiness withdrawal when the live database stops.
This was referenced Aug 18, 2026
snevolin
marked this pull request as ready for review
August 18, 2026 18:08
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.
Summary
Track the live PostgreSQL connection after devshard storage has started:
Pingcalls;Why
Previously, PostgreSQL readiness represented only successful startup and completion of the initial session-index rebuild. If the database became unavailable later, devshardd stayed alive and could continue reporting ready from stale startup state.
The process should remain alive so a transient database outage does not cause a restart loop, while readiness-aware routing must be able to withdraw it until PostgreSQL recovers.
Behavior
This applies whenever a live PostgreSQL backend is attached. In fail-closed
DEVSHARD_STORAGE_MODE=postgres, database loss makes/readyzunready without terminating devshardd, and readiness recovers automatically when the database returns. Hybrid storage uses the same PostgreSQL signal while attached. SQLite-only mode is unaffected.This PR does not change storage-mode selection, compare database identities, migrate SQL data, or change the PostgreSQL data-directory layout.
Validation
go test -race ./storageHistory
This focused PR extracts the PostgreSQL live-readiness work previously developed in the closed umbrella PRs #1517 and #1587 so it can be reviewed and merged independently.