Skip to content

MINOR: Cleanups in Tools Module (3/n) #20332

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

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

sjhajharia
Copy link
Contributor

This PR aims at cleaning up the tools module further by getting rid of some extra code which can be replaced by record

@github-actions github-actions bot added triage PRs from the community tools labels Aug 10, 2025
@sjhajharia
Copy link
Contributor Author

Adding @chia7712 as he kindly helped with all PR reviews in this region.

@sjhajharia sjhajharia changed the title MINOR: Cleanups in Test Module (3/n) MINOR: Cleanups in Tools Module (3/n) Aug 14, 2025
Copy link

A label of 'needs-attention' was automatically added to this PR in order to raise the
attention of the committers. Once this issue has been triaged, the triage label
should be removed to prevent this automation from happening again.

Copy link
Member

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

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

@sjhajharia thanks for your patch

AdminClientService(AclCommandOptions opts) {
this.opts = opts;
}
private record AdminClientService(AclCommandOptions opts) {
Copy link
Member

Choose a reason for hiding this comment

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

Rewriting it as static helper methods seems to better than using a record class. WDYT?

this.err = err;
}
private record Config(Command command, Set<Path> locations, boolean dryRun, boolean keepNotFound, PrintStream out,
PrintStream err) {

@Override
public String toString() {
Copy link
Member

Choose a reason for hiding this comment

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

how about trusting the generated toString?

this.topicPartition = topicPartition;
this.producerState = producerState;
}
private record OpenTransaction(TopicPartition topicPartition, ProducerState producerState) {
Copy link
Member

Choose a reason for hiding this comment

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

Based on the use cases, using Map<TopicPartition, ProducerState> seems more suitable.

public CancelledMoveState(String currentLogDir, String targetLogDir) {
this.currentLogDir = currentLogDir;
this.targetLogDir = targetLogDir;
CancelledMoveState {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

*/
public CompletedMoveState(String targetLogDir) {
this.targetLogDir = targetLogDir;
CompletedMoveState {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

*/
public MissingLogDirMoveState(String targetLogDir) {
this.targetLogDir = targetLogDir;
MissingLogDirMoveState {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

*/
public MissingReplicaMoveState(String targetLogDir) {
this.targetLogDir = targetLogDir;
MissingReplicaMoveState {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

this.path = path;
}

private record PluginLocation(Path path) {
@Override
public String toString() {
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@github-actions github-actions bot removed needs-attention triage PRs from the community labels Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants