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

KAFKA-6074 Use ZookeeperClient in ReplicaManager and Partition #4166

Closed
wants to merge 4 commits into from
Closed

KAFKA-6074 Use ZookeeperClient in ReplicaManager and Partition #4166

wants to merge 4 commits into from

Conversation

tedyu
Copy link
Contributor

@tedyu tedyu commented Nov 1, 2017

No description provided.

@tedyu
Copy link
Contributor Author

tedyu commented Nov 1, 2017

See if changes in ReassignPartitionsCommand are on right track.
The changes are due to admin.fetchEntityConfig() taking KafkaZkClient.

Alternative is to use ZkUtils and KafkaZkClient in ReassignPartitionsCommand.
This way, scope of change is easier to manage.

@mimaison
Copy link
Member

mimaison commented Nov 1, 2017

We should rename the zkUtils variables that are now KafkaZkClient objects to zkClient like in f88fdbd and 9504af7

@omkreddy
Copy link
Contributor

omkreddy commented Nov 1, 2017

I suggest to change ReplicaManager.scala, LogDirUtils.scala, ReplicationUtils.scala classes as part of this PR.

ReassignPartitionsCommand can be done in another JIRA/PR. I am doing few changes to AdminUtils as part of KAFKA-5646. We can reuse those changes for Admin Operations/KAFKA-5647.

@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

2 similar comments
@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

2 similar comments
@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

@asfgit
Copy link

asfgit commented Nov 1, 2017

FAILURE
No test results found.
--none--

@tedyu
Copy link
Contributor Author

tedyu commented Nov 1, 2017

40 tests extend ZooKeeperTestHarness where {{var zkUtils: ZkUtils}} is declared.

Suggestion on how to phase out ZkUtils is welcome.

Copy link
Contributor

@junrao junrao left a comment

Choose a reason for hiding this comment

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

@tedyu : Thanks for the patch. A few comments below. Also, your PR somehow shows "unknown repository".

def createSequentialPersistentPath(path: String, data: String = ""): String = {
val createRequest = CreateRequest(path, data.getBytes("UTF-8"), acls(path), CreateMode.PERSISTENT_SEQUENTIAL)
val createResponse = retryRequestUntilConnected(createRequest)
createResponse.path
Copy link
Contributor

Choose a reason for hiding this comment

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

We should throw an exception if the result code is not OK.

def leaderAndIsrZkData(leaderAndIsr: LeaderAndIsr, controllerEpoch: Int): String = {
Json.encode(Map("version" -> 1, "leader" -> leaderAndIsr.leader, "leader_epoch" -> leaderAndIsr.leaderEpoch,
"controller_epoch" -> controllerEpoch, "isr" -> leaderAndIsr.isr))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't access zookeeperClient and should be moved to ZkData.scala.

} else {
val data = new String(getDataResponse.data, UTF_8)
(Some(data), getDataResponse.stat)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should throw an exception in the result code is not OK.

"controller_epoch" -> controllerEpoch, "isr" -> leaderAndIsr.isr))
}

def readDataMaybeNull(path: String): (Option[String], Stat) = {
Copy link
Contributor

Choose a reason for hiding this comment

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

With this, methods like getPreferredReplicaElection() and getControllerId, etc could potentially be simplified by reusing this method.

@@ -48,6 +48,29 @@ import scala.collection.mutable.ArrayBuffer
class KafkaZkClient(zooKeeperClient: ZooKeeperClient, isSecure: Boolean) extends Logging {
import KafkaZkClient._

def createSequentialPersistentPath(path: String, data: String = ""): String = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a unit test for each new public method introduced in this class?

@tedyu
Copy link
Contributor Author

tedyu commented Nov 7, 2017

@junrao
See my previous comment w.r.t. 40 tests extending ZooKeeperTestHarness.

I was waiting for some advice on how the related tests should be handled so that compilation passes.

@junrao
Copy link
Contributor

junrao commented Nov 7, 2017

@tedyu : Mani is making some changes in #4155 related to the testing of ZooKeeperTestHarness. You can probably wait until his PR is merged.

@omkreddy
Copy link
Contributor

omkreddy commented Nov 7, 2017

@tedyu I am migrating few utility methods as part of KAFKA-5646 and 5647.
I will raise the PR in couple days. maybe you can wait for few more days, so that we can reuse the code changes.

@junrao
Copy link
Contributor

junrao commented Nov 22, 2017

@tedyu : KAFKA-5646 is now committed. You can rebase your patch now.

@tedyu tedyu closed this Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants