fix(cluster): make the advertised leader accept partition writes - #3985
Conversation
hubcio
left a comment
There was a problem hiding this comment.
a few things that aren't on changed lines.
nothing tells you from outside whether the seed took. the branch that applies it logs nothing, the one right above it logs, and no other surface shows a partition group's view - so the test can only check that sends work. a log line there would let it check the real thing. the view_fallback doc is stale too, it still talks about the last journaled prepare.
current_primary_index gives back a replica id, not a roster index - the name says otherwise.
the simulator covers none of this: init_partition is simulator-only and never goes through build_partition_fresh.
this only lines the two planes up once, at create time. the next election on either side splits them again, and nothing forwards writes over TCP, so the same problem comes back. worth spelling out in the description.
one question: the primary stays at log_view 0 while backups move to V. can that wedge the next view change?
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3985 +/- ##
=============================================
- Coverage 84.26% 68.86% -15.40%
Complexity 1398 1398
=============================================
Files 1219 1220 +1
Lines 173644 156522 -17122
Branches 140742 123623 -17119
=============================================
- Hits 146317 107787 -38530
- Misses 23369 44797 +21428
+ Partials 3958 3938 -20
🚀 New features to boost your workflow:
|
|
/ready |
A client is told which node leads the cluster, sends a partition
write there, and is refused for its whole budget. The node it was
told about is genuinely the leader; the write is genuinely unroutable.
Each node runs a metadata consensus group plus one per partition,
each with its own view counter, and both pick a primary as
view % replica_count.get_cluster_metadatamarks a node Leaderfrom the metadata plane alone and
ClusterNodecarries onerole,so a partition group's primary cannot be expressed on the wire.
Partition ops route within a node, never to a peer, so the
advertised leader cannot forward one either.
A group materialised with no durable state started at view 0,
naming replica 0 wherever the metadata plane had got to, so any
metadata election opened the gap for every topic created after.
Seed a fresh group from the metadata view shard 0 already publishes
for the roster's leader marking. Both planes then name the same
node by construction, with no wire or client change. The seed sets
log_viewtoo: a primary whoselog_viewlags counts asmid-transition and answers no
RequestStartView. A replica thathas not seen a view defers materialising rather than reading the
unknown sentinel as 0, and that deferral counts toward the pass so
it cannot arm the reconciler's fast-skip.
This aligns the planes once, at creation. A later election on
either side parts them again and nothing forwards a write across
the gap, so the symptom returns for that group.