Report whether durability/projection affinity engaged (GH-3785) - #3854
Merged
Conversation
The GH-3785 cross-family affinity join is deliberately fail-silent: a durability agent that cannot be matched to its database's projection owner falls back to the even spread, because a miss is never wrong, only not-better. That is the right runtime behavior and an unusable diagnostic story -- a join that never fires because the two descriptor pipelines spell the same database differently looks exactly like the feature working, minus the benefit. Short of joining pg_stat_activity against the assignment table on a production cluster, there was no way to tell the two apart. So count both outcomes and say so: matched, considered, and the number of databases there were to follow. Logged only when the numbers move -- assignment is re-evaluated on every health check and a settled cluster reports the same figures forever, so an unconditional line would be noise at exactly the cadence that makes it unreadable. A change means a deploy, a rebalance, or a database arriving or leaving. The one case that escalates to a warning is Matched == 0 with both KnownDatabases and Considered non-zero: there ARE projection agents, there ARE database-bearing durability agents, and not one of them joined. On a multi-database store that is a spelling divergence, not a coincidence. An application with no projections has nothing to co-locate with and stays silent. Seven new CoreTests, each mutation-tested against a matching defect (counting non-database URIs, dropping the change gate, not escalating the fail-silent case, warning when there was nothing to follow). The real-stores Marten test now also asserts every database matched -- that test exists because the join spans two descriptor pipelines, so it is the right place to pin the counters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WHAuhdWS3XeAk16swV9G8m
This was referenced Aug 5, 2026
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.
The GH-3785 cross-family affinity join (#3805) is deliberately fail-silent — a durability agent that cannot be matched to its database's projection owner falls back to the even spread, because a miss is never wrong, only not-better. That is the right runtime behavior and an unusable diagnostic story: a join that never fires because the two descriptor pipelines spell the same database differently looks exactly like the feature working, minus the benefit.
Short of joining
pg_stat_activityagainst the assignment table on a production cluster, there was no way to tell the two apart. That matters right now: #3785 is one confirming measurement away from closing, and the measurement it is waiting on is precisely "did the join engage against this cluster's 512 databases and its particular server naming."What this adds
DurabilityAffinityPreferencewraps the preference function and counts both outcomes:KnownDatabasesConsideredMatchedLogged only when the numbers move. Assignment is re-evaluated on every health check, and a settled cluster reports the same figures forever — an unconditional line would be noise at exactly the cadence that makes it unreadable. A change means a deploy, a rebalance, or a database arriving or leaving.
Three outcomes, three behaviors:
Matched > 0→ Information, once:co-located {Matched} of {Considered} durability agents ... across {KnownDatabases} databasesMatched == 0withKnownDatabasesandConsideredboth non-zero → Warning. There are projection agents, there are database-bearing durability agents, and not one joined. On a multi-database store that is a spelling divergence, not a coincidence — and it names the consequence (each of those databases attracts two nodes' connection pools instead of one).KnownDatabases == 0→ silent. An application with no projections has nothing to co-locate with; that is not a finding.Testing
7 new CoreTests, each mutation-tested against a matching defect — counting non-database URIs as considered, dropping the change gate, not escalating the fail-silent case, warning when there was nothing to follow. All four mutants killed, one test each, no overlap.
The real-stores Marten test now also asserts every database matched. That test exists because the join spans two descriptor pipelines (Weasel vs Marten), so it is the right place to pin the counters — it is the only test where a spelling divergence could actually occur.
CoreTests.Runtime.Agents— 293/293durability_projection_affinity_real_stores— passes against real Postgres tenant databases, 3 of 3 matchedwolverine.slnxRelease build cleanBehavior is unchanged: this is counting and logging only.
Related: #3785, #3805
🤖 Generated with Claude Code
https://claude.ai/code/session_01WHAuhdWS3XeAk16swV9G8m