-
Notifications
You must be signed in to change notification settings - Fork 15.4k
MINOR: remove some specifying types in tool command #10329
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
Changes from 5 commits
06dc4a0
bed68ab
2d2d15f
c599f56
1eb3de6
a31bf6f
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 |
|---|---|---|
|
|
@@ -443,7 +443,7 @@ object ReassignPartitionsCommand extends Logging { | |
| val (foundReassignments, notFoundReassignments) = targetReassignments.partition { | ||
| case (part, _) => currentReassignments.contains(part) | ||
| } | ||
| val foundResults: Seq[(TopicPartition, PartitionReassignmentState)] = foundReassignments.map { | ||
| val foundResults = foundReassignments.map { | ||
| case (part, targetReplicas) => (part, | ||
| PartitionReassignmentState( | ||
| currentReassignments(part).replicas. | ||
|
|
@@ -458,7 +458,7 @@ object ReassignPartitionsCommand extends Logging { | |
| } | ||
| val topicDescriptions = adminClient. | ||
| describeTopics(topicNamesToLookUp.asJava).values().asScala | ||
| val notFoundResults: Seq[(TopicPartition, PartitionReassignmentState)] = notFoundReassignments.map { | ||
| val notFoundResults = notFoundReassignments.map { | ||
| case (part, targetReplicas) => | ||
| currentReassignments.get(part) match { | ||
| case Some(reassignment) => (part, | ||
|
|
@@ -557,7 +557,7 @@ object ReassignPartitionsCommand extends Logging { | |
| val replicaLogDirInfos = adminClient.describeReplicaLogDirs( | ||
| targetMoves.keySet.asJava).all().get().asScala | ||
| targetMoves.map { case (replica, targetLogDir) => | ||
| val moveState: LogDirMoveState = replicaLogDirInfos.get(replica) match { | ||
| val moveState = replicaLogDirInfos.get(replica) match { | ||
| case None => MissingReplicaMoveState(targetLogDir) | ||
| case Some(info) => if (info.getCurrentReplicaLogDir == null) { | ||
| MissingLogDirMoveState(targetLogDir) | ||
|
|
@@ -1189,10 +1189,9 @@ object ReassignPartitionsCommand extends Logging { | |
| */ | ||
| def alterPartitionReassignments(adminClient: Admin, | ||
| reassignments: Map[TopicPartition, Seq[Int]]): Map[TopicPartition, Throwable] = { | ||
| val results: Map[TopicPartition, KafkaFuture[Void]] = | ||
| adminClient.alterPartitionReassignments(reassignments.map { case (part, replicas) => | ||
| (part, Optional.of(new NewPartitionReassignment(replicas.map(Integer.valueOf).asJava))) | ||
| }.asJava).values().asScala | ||
| val results = adminClient.alterPartitionReassignments(reassignments.map { case (part, replicas) => | ||
| (part, Optional.of(new NewPartitionReassignment(replicas.map(Integer.valueOf).asJava))) | ||
| }.asJava).values().asScala | ||
| results.flatMap { | ||
| case (part, future) => { | ||
| try { | ||
|
|
@@ -1215,10 +1214,9 @@ object ReassignPartitionsCommand extends Logging { | |
| def cancelPartitionReassignments(adminClient: Admin, | ||
| reassignments: Set[TopicPartition]) | ||
| : Map[TopicPartition, Throwable] = { | ||
| val results: Map[TopicPartition, KafkaFuture[Void]] = | ||
| adminClient.alterPartitionReassignments(reassignments.map { | ||
| (_, (None: Option[NewPartitionReassignment]).asJava) | ||
| }.toMap.asJava).values().asScala | ||
| val results = adminClient.alterPartitionReassignments(reassignments.map { | ||
|
Member
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. ditto |
||
| (_, (None: Option[NewPartitionReassignment]).asJava) | ||
|
Member
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. While we are here, could we replace
Member
Author
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. Good idea.I updated the code, please review it again, thank you. |
||
| }.toMap.asJava).values().asScala | ||
| results.flatMap { case (part, future) => | ||
| try { | ||
| future.get() | ||
|
|
||
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.
nit: The indentation of the two lines below could be corrected now.