-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Feature for scheduling preferred replica leader election #630
Conversation
val jsonData = toJson(schedule) | ||
|
||
ZkUtils.updatePersistentPath(curator, ZkUtils.SchedulePreferredLeaderElectionPath, jsonData) | ||
logger.info("Updating ZK scheduler with %s".format(jsonData)) |
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.
Might throw error format(jsonData)
} | ||
|
||
def handleScheduleRunElection(c: String) = Action.async { implicit request => | ||
var status_string: String = "" |
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.
!!
@@ -226,6 +227,9 @@ class KafkaManagerActor(kafkaManagerConfig: KafkaManagerActorConfig) | |||
case KMGetAllClusters => | |||
sender ! KMClusterList(clusterConfigMap.values.toIndexedSeq, pendingClusterConfigMap.values.toIndexedSeq) | |||
|
|||
case KSGetScheduleLeaderElection => | |||
sender ! ZkUtils.readDataMaybeNull(curator, ZkUtils.SchedulePreferredLeaderElectionPath)._1.getOrElse("{}") |
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.
"{}" try to declare it separately depends on how base code structures
private def writeScheduleLeaderElectionToZk(schedule: Map[String, Int]) = { | ||
implicit val ec = longRunningExecutionContext | ||
|
||
log.info("Updating schedule for preferred leader election") |
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.
try to put more context to messages some uniqueness maybe of possible
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.
small comments made
Please rebase off master. |
Other contributors: Johan Lundahl
7dad013
to
fd5517e
Compare
Thanks for all the suggestions everyone. @kumarankit01 @sandeepjindal I have tried to resolve as per your suggestions as much as possible according to current codebase structure. |
it would be very nice to update the README.md to include the description of those API endpoints we added here so other ppl can use them easily if we want to expose them as RestAPIs, if not then it's fine:
|
@linehrr These are not JSON REST endpoints, rather they return HTML content. We did add REST endpoints as well for this feature in our internal code - we would be happy to send another PR to open-source them if the project maintainers see value in having them (and this feature, in general). Those APIs use some code components of this PR. Thanks for the suggestion - appreciate your time & feedback. 🙏 |
We recently worked on adding a feature (new tab & REST APIs) to Kafka Manager which would allow users to schedule the replica leader election. We thought it might be helpful for other users as well so would like to share it here and preferably merge it upstream (yahoo/kafka-manager).
I am quite new to Scala/Akka so I would appreciate if you could let me know what changes you'd like to see in this patch and how it can be best used to improve Kafka Manager.