Skip to content
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: Add topicIds and directoryIds to the return value of the toString method. #16189

Merged
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,23 @@ public Map<String, Uuid> topicIds() {
return topicIds;
}

public Map<TopicIdPartition, Uuid> directoryIds() {
return directoryIds;
}

@Override
public String toString() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Could we move directoryIds() method above toString() method for better readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. The toString() method is just a utility function, so we should arrange it appropriately.

return String.format(
"LocalReplicaChanges(deletes = %s, newly elected leaders = %s, leaders = %s, followers = %s)",
"LocalReplicaChanges(deletes = %s, newly elected leaders = %s, leaders = %s, followers = %s, topicIds = %s, directoryIds = %s)",
deletes,
electedLeaders,
leaders,
followers
followers,
topicIds,
directoryIds
);
}

public Map<TopicIdPartition, Uuid> directoryIds() {
return directoryIds;
}

public static final class PartitionInfo {
private final Uuid topicId;
private final PartitionRegistration partition;
Expand All @@ -98,17 +100,17 @@ public PartitionInfo(Uuid topicId, PartitionRegistration partition) {
this.partition = partition;
}

@Override
public String toString() {
return String.format("PartitionInfo(topicId = %s, partition = %s)", topicId, partition);
}

public Uuid topicId() {
return topicId;
}

public PartitionRegistration partition() {
return partition;
}

@Override
public String toString() {
return String.format("PartitionInfo(topicId = %s, partition = %s)", topicId, partition);
}
}
}