-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MINOR: Fix Some Exceptions in MetaPropertiesEnsemble and MetadataQuorumCommand #18957
base: trunk
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,13 +266,13 @@ else if (leader.lastCaughtUpTimestamp().isPresent() && maxLagFollower.lastCaught | |
|
||
System.out.println( | ||
"ClusterId: " + clusterId + | ||
"\nLeaderId: " + quorumInfo.leaderId() + | ||
"\nLeaderEpoch: " + quorumInfo.leaderEpoch() + | ||
"\nHighWatermark: " + quorumInfo.highWatermark() + | ||
"\nMaxFollowerLag: " + maxFollowerLag + | ||
"\nMaxFollowerLagTimeMs: " + maxFollowerLagTimeMs + | ||
"\nCurrentVoters: " + printVoterState(quorumInfo) + | ||
"\nCurrentObservers: " + printObserverState(quorumInfo) | ||
"\nLeaderId: " + quorumInfo.leaderId() + | ||
"\nLeaderEpoch: " + quorumInfo.leaderEpoch() + | ||
"\nHighWatermark: " + quorumInfo.highWatermark() + | ||
"\nMaxFollowerLag: " + maxFollowerLag + | ||
"\nMaxFollowerLagTimeMs: " + maxFollowerLagTimeMs + | ||
"\nCurrentVoters: " + printVoterState(quorumInfo) + | ||
"\nCurrentObservers: " + printObserverState(quorumInfo) | ||
); | ||
} | ||
|
||
|
@@ -373,7 +373,7 @@ static String getMetadataDirectory(Properties props) throws TerseException { | |
"configuration file?"); | ||
} | ||
|
||
static Uuid getMetadataDirectoryId(String metadataDirectory) throws Exception { | ||
static Uuid getMetadataDirectoryId(String metadataDirectory) throws TerseException { | ||
MetaPropertiesEnsemble ensemble = new MetaPropertiesEnsemble.Loader(). | ||
addLogDirs(Collections.singletonList(metadataDirectory)). | ||
addMetadataLogDir(metadataDirectory). | ||
|
@@ -390,7 +390,7 @@ static Uuid getMetadataDirectoryId(String metadataDirectory) throws Exception { | |
|
||
static Set<RaftVoterEndpoint> getControllerAdvertisedListeners( | ||
Properties props | ||
) throws Exception { | ||
) throws TerseException { | ||
Map<String, Endpoint> listeners = new HashMap<>(); | ||
SocketServerConfigs.listenerListToEndPoints( | ||
props.getOrDefault(SocketServerConfigs.LISTENERS_CONFIG, "").toString(), | ||
|
@@ -404,16 +404,16 @@ static Set<RaftVoterEndpoint> getControllerAdvertisedListeners( | |
} | ||
LinkedHashSet<RaftVoterEndpoint> results = new LinkedHashSet<>(); | ||
for (String listenerName : props.getProperty( | ||
KRaftConfigs.CONTROLLER_LISTENER_NAMES_CONFIG).split(",")) { | ||
KRaftConfigs.CONTROLLER_LISTENER_NAMES_CONFIG).split(",")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this indentation and formatting so that the for loop statement block is clearly separated from the for loop iterable. for (String listenerName : props.getProperty(
KRaftConfigs.CONTROLLER_LISTENER_NAMES_CONFIG).split(",")
) { |
||
listenerName = ListenerName.normalised(listenerName).value(); | ||
Endpoint endpoint = listeners.get(listenerName); | ||
if (endpoint == null) { | ||
throw new TerseException("Cannot find information about controller listener name: " + | ||
listenerName); | ||
} | ||
results.add(new RaftVoterEndpoint(endpoint.listenerName().get(), | ||
endpoint.host() == null ? "localhost" : endpoint.host(), | ||
endpoint.port())); | ||
endpoint.host() == null ? "localhost" : endpoint.host(), | ||
endpoint.port())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this formatting? results.add(
new RaftVoterEndpoint(
endpoint.listenerName().get(),
endpoint.host() == null ? "localhost" : endpoint.host(),
endpoint.port()
)
); |
||
} | ||
return results; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This indentation doesn't look correct. We indent Java code using 4 spaces.