Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
nit fixes
  • Loading branch information
mannoopj committed Dec 15, 2025
commit f072ffb1724761b653ccac25fc0015a374f5964c
4 changes: 2 additions & 2 deletions core/src/main/scala/kafka/server/ControllerApis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1060,8 +1060,8 @@ class ControllerApis(
// Nearly all RPCs should check MetadataVersion inside the QuorumController. However, this
// RPC is consulting a cache which lives outside the QC. So we check MetadataVersion here.
if (!apiVersionManager.features.metadataVersion().map(_.isControllerRegistrationSupported).orElse(false)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if we could return a more accurate error message in the case where metadataVersion().isEmpty(). Returning a message like "There is no finalized MetadataVersion, so direct-to-controller communication is not supported" is more accurate in this case.

throw new UnsupportedVersionException("Direct-to-controller communication is not " +
"supported with the current MetadataVersion.")
throw new UnsupportedVersionException("There is no finalized MetadataVersion, so " +
"direct-to-controller communication is not supported.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a separate if/else if clause for if the metadata version is not finalized. We should not change this existing check.

}
// Unlike on the broker, DESCRIBE_CLUSTER on the controller requires a high level of
// permissions (ALTER on CLUSTER).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@

import org.slf4j.Logger;

import java.util.Map;
import java.util.Optional;


public class FeaturesPublisher implements MetadataPublisher {
private final Logger log;
private final FaultHandler faultHandler;
private volatile FinalizedFeatures finalizedFeatures = new FinalizedFeatures(
Optional.empty(), Map.of(), -1);
private volatile FinalizedFeatures finalizedFeatures = FinalizedFeatures.UNKNOWN_FINALIZED_FEATURES;

public FeaturesPublisher(
LogContext logContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ public record FinalizedFeatures(
Map<String, Short> finalizedFeatures,
long finalizedFeaturesEpoch
) {
public static final FinalizedFeatures UNKNOWN_FINALIZED_FEATURES =
new FinalizedFeatures(Optional.empty(), Map.of(), -1);

public static FinalizedFeatures fromKRaftVersion(MetadataVersion version) {
return new FinalizedFeatures(Optional.of(version), Map.of(), -1);
}
Expand Down