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

Score on partition #303

Merged
merged 10 commits into from
Apr 21, 2022
Merged

Conversation

chinghongfang
Copy link
Collaborator

#289 (comment)
需要對partition進行打分。更甚者,包括replica也要打分。
更改CostFunction的回傳值,CostFunction將會對org.apache.kafka.common.TopicPartitionReplica做打分。

原本有許多cost function都是以broker進行打分的,目前我不做更動,只有讓它們符合現在的介面,本質仍然是對broker打分,以後也許可以做更精準的打分(對partition打分)。

另外,在進行修改的過程中發現,partitioner 會希望 cost function 知道發送到哪個 topic,之後要討論"新增topic 到cost function 參數中"。

@chinghongfang
Copy link
Collaborator Author

這裡新增介面,TopicPartitionReplica內含有 1) topic name, 2) partition number, 3) broker id,並提供回傳TopicPartitionReplica物件的方法。

包含4種建立方法,

  1. 使用三個參數topic name, partition number, broker id 建立。
  2. 使用org.apache.kafka.common.TopicPartitionReplica建立。
  3. 使用PartitionInfo建立leader TopicPartitionReplica
  4. 使用PartitionInfo建立leader, followers 的 TopicPartitionReplica

Move `leaderOf` to PartitionInfo and rename.
Remove unused method.
@chinghongfang
Copy link
Collaborator Author

@chia7712 可以麻煩您再review一次PR嘛?感謝您。

Copy link
Contributor

@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.

@chinghongfang 感謝這個patch,看起來很棒

有幾個小建議請看一下

@wycccccc wycccccc mentioned this pull request Apr 20, 2022
Copy link
Contributor

@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.

我覺得很棒,可以前進了。

@chinghongfang chinghongfang merged commit 1ab0cd4 into opensource4you:main Apr 21, 2022
@chinghongfang chinghongfang deleted the scorePartition branch August 3, 2022 02:15
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.

4 participants