Skip to content

Cluster features are declared and raised through the log - #683

Merged
matrixarkai merged 1 commit into
mainfrom
the-features-are-declared-and-raised-through-the-log
Nov 18, 2026
Merged

matrixarkai merged 1 commit into
mainfrom
the-features-are-declared-and-raised-through-the-log

Conversation

@matrixarkai

Copy link
Copy Markdown
Owner

Reversible in this build, with one thing to know: this adds a new metadata request code (96) and a new committed outcome version (14). Nothing in this change sends either on its own, so a mixed set of builds is unaffected until an operator runs the new command. An old voter that meets a version 14 entry fails to apply it (the same strict re-encode check every outcome has); it never skips it. That is why the raise is refused until every named voter has declared support.

Stacked on #4a-1 (the cluster feature set in the metadata snapshot); the first two commits are that PR.

What

  • src/cluster/features_commands.rs: FeaturesRequest with three actions.
    • Declare: a voter records the feature bits it reads. A repeat of the same bits proposes nothing (a restart does not grow the log); a build that changed declares again and replaces its entry.
    • Raise: the group agrees to emit bits. The caller names every voter of the group (ascending). Refused unless every named voter has declared every requested bit and this build reads the bits itself. A bit is never lowered; raising what is raised proposes nothing.
    • Read: the committed set.
  • PlacementOutcome version 14 with a features field (tag 16): the whole set before and after. It carries nothing else (validation refuses any other state in the same outcome), changes either one voter's declaration or the raised bits (never both), never removes a voter, never lowers a bit, refuses a bit this build cannot read. Applied only against exactly the set it was decided from and the metadata index it was decided at, so a leader change between decision and commit cannot slip a bit past the check.
  • Wire: MetaRequestCode::Features = 96, request and reply plumbing in the message, consensus, server and client; client methods read_cluster_features, declare_voter_features, raise_cluster_features.
  • Guards that pin durable stamps and counts name the new snapshot version and checksum stamp.

What an old node does

A voter or journal reader that does not know version 14 or the features field fails to apply the entry (the outcome is re-encoded and compared byte for byte, so an unknown field is corruption, not ignored). Nothing is skipped. The raise command is the protection: it is refused unless every named voter declared the bits, and a voter only declares bits it reads.

Known limits, to be closed in the next part

  • The voter list in a raise is supplied by the caller; the leader does not yet check it against its own membership.
  • Chunkservers do not yet declare; the raise checks voters only.
  • Voters do not yet declare automatically at startup.

Tests (cluster::features_commands::tests, 7, plus the 7 of the snapshot part)

Declaration recorded once and repeat is a no-op; a mixed set (one voter without the feature, or with one of two bits) keeps the bit low and a refused raise writes nothing; an unnamed voter and an unknown bit are refused; an outcome applies only to the set it was decided from (a declaration that commits in between makes it stale, and it cannot apply twice); strict outcome shape (lowering, two voters, removal, raise plus declaration, no change, unknown bit, wrong version, extra index); replay of the log from the start and a late joiner (snapshot after entry 2, then entries 3 and 4) reach the same set; canonical request shape and the request code.
Planted defects, each caught (undone by edit): raise skips the voter check, apply skips the bound-set check, a bit may go down, a repeated declaration is proposed again, voters need not be ascending.

Numbers

Control-plane only; no data path changed, so instructions per append and per read are unchanged. Cost of a declaration or a raise: one metadata log entry (a version 14 outcome of about 50 bytes plus 16 bytes per declared voter, twice: before and after), once per upgrade step, never per request.

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@matrixarkai
matrixarkai merged commit ff1b187 into main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants