Add heartbeat to background worker epoch sentinel - #42
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a heartbeat timestamp to the background worker epoch sentinel so operators can query worker liveness via SQL, without relying on logs or process inspection.
Changes:
- Extend
df._worker_epochwith alast_seen_atcolumn. - Make the epoch-sentinel poll update
last_seen_at(heartbeat) on each tick viaUPDATE ... RETURNING. - Document the new liveness query in the user guide and lifecycle docs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/worker.rs |
Writes last_seen_at on sentinel creation and updates it on each poll tick. |
src/lib.rs |
Adds last_seen_at TIMESTAMPTZ to df._worker_epoch table DDL. |
USER_GUIDE.md |
Adds a “Worker Liveness” section with a query and interpretation guidance. |
docs/extension_lifecycle.md |
Updates epoch-sentinel schema description to include last_seen_at. |
Add last_seen_at column to df._worker_epoch and update the epoch sentinel check from a SELECT to UPDATE ... RETURNING, writing now() on every poll tick (~5s). This gives operators a simple SQL query to verify background worker liveness. Update USER_GUIDE.md with Worker Liveness monitoring section.
- Consolidate USER_GUIDE.md liveness bullets and drop 'healthy' claim - Add E2E test for heartbeat liveness (35_heartbeat_liveness.sql)
Pino de Candia (pinodeca)
force-pushed
the
heartbeat-sentinel
branch
from
March 6, 2026 22:17
3e5cd8d to
56b27f5
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.
Summary
Add a
last_seen_atcolumn todf._worker_epochand update the epoch sentinel check to write a heartbeat on every poll tick (~5 seconds). This gives operators a simple SQL query to verify background worker liveness without inspecting logs or process lists.Changes
src/lib.rs: Addlast_seen_at TIMESTAMPTZcolumn todf._worker_epochDDLsrc/worker.rs: Update sentinel insert to includelast_seen_at; replaceSELECT EXISTS(...)withUPDATE ... SET last_seen_at = now() ... RETURNING epoch_idUSER_GUIDE.md: Add Worker Liveness subsection to Monitoringdocs/extension_lifecycle.md: Update schema description to include new columntests/e2e/sql/35_heartbeat_liveness.sql: E2E test that verifieslast_seen_atadvances over timescripts/test-e2e-local.sh: Register new test as superuser (reads internaldf._worker_epoch)User-Facing Liveness Check
time_since_last_heartbeat < 15 seconds→ worker is alive (recent heartbeat)Cost
SELECTis replaced with anUPDATE ... RETURNING(same round trip)