xxxxxxjun commented on PR #22164:
URL: https://github.com/apache/kafka/pull/22164#issuecomment-5306572087
Answering my own question above about `kraftVersion()` returning an
uncommitted version.
I went through the existing callers and I don't think this PR should try to
solve it:
- `KRaftVersionAccessor.kraftVersion()` documents the semantics as "The
latest version may
be uncommitted", and `FeatureControlManager` reads the kraft version
through it.
- `KRaftMetadataCache.features()` computes
`kraftVersionSupplier.get().featureLevel()` from
the same `RaftClient.kraftVersion()`, wired in `BrokerServer` and
`ControllerServer`, and
that value goes into the `FinalizedFeatures` served to clients.
- `QuorumController` reports `raftClient.kraftVersion().featureLevel()` in
the controller
features.
So this makes the metric agree with what the broker already reports for
kraft.version. A
strict finalized source would need a new raft API and would put the metric
out of sync with
`features()`. I can file a separate JIRA if that's worth pursuing.
I also updated the description with a behavior change I had missed. The
gauge for
`featureName=kraft.version` is now registered with level 0 on a
kraft.version=0 cluster,
where it previously didn't exist at all. I kept the call unconditional to
match
`metadata.version` a few lines above, and
`maybeRemoveFinalizedFeatureLevelMetrics` already
treats kraft.version as never removed. If you'd rather keep the old surface
exactly, gating
on `featureLevel() > 0` matches `KRaftMetadataCache.features()` and is a two
line change.
Happy to go either way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]