-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
base: trunk
Are you sure you want to change the base?
Conversation
Adding @chia7712 as he kindly helped with all PR reviews in this region. |
A label of 'needs-attention' was automatically added to this PR in order to raise the |
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.
@sjhajharia thanks for your patch
AdminClientService(AclCommandOptions opts) { | ||
this.opts = opts; | ||
} | ||
private record AdminClientService(AclCommandOptions opts) { |
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.
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() { |
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.
how about trusting the generated toString
?
this.topicPartition = topicPartition; | ||
this.producerState = producerState; | ||
} | ||
private record OpenTransaction(TopicPartition topicPartition, ProducerState producerState) { |
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.
Based on the use cases, using Map<TopicPartition, ProducerState>
seems more suitable.
tools/src/main/java/org/apache/kafka/tools/reassign/ActiveMoveState.java
Show resolved
Hide resolved
public CancelledMoveState(String currentLogDir, String targetLogDir) { | ||
this.currentLogDir = currentLogDir; | ||
this.targetLogDir = targetLogDir; | ||
CancelledMoveState { |
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.
ditto
*/ | ||
public CompletedMoveState(String targetLogDir) { | ||
this.targetLogDir = targetLogDir; | ||
CompletedMoveState { |
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.
ditto
*/ | ||
public MissingLogDirMoveState(String targetLogDir) { | ||
this.targetLogDir = targetLogDir; | ||
MissingLogDirMoveState { |
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.
ditto
*/ | ||
public MissingReplicaMoveState(String targetLogDir) { | ||
this.targetLogDir = targetLogDir; | ||
MissingReplicaMoveState { |
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.
ditto
this.path = path; | ||
} | ||
|
||
private record PluginLocation(Path path) { | ||
@Override | ||
public String toString() { |
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.
ditto
This PR aims at cleaning up the tools module further by getting rid of some extra code which can be replaced by
record