opensource4you / astraea

釋放kafka的無限潛能
Apache License 2.0
125 stars 45 forks source link

[BALANCER] Expose internal topic to Balancer #1767

Closed garyparrot closed 1 year ago

garyparrot commented 1 year ago

Resolve #1747.

這個 PR 暴露 internal topic 給 Balancer,Balancer 現在可以對 internal topic 做搬移,幾個重要的變更:

測試:demote 節點

這個測試 1:demoted,2:demoted,3:demoted

image

image

注意到現在 internal topic 也被轉移了

測試:demote 節點,但節點上有 disallowed topics

"balancer.broker.balancing.mode": "1:demoted,2:demoted,3:demoted",
"balancer.allowed.topics.regex": "^(?!__).*"

image

image

這邊可能看起來和上面一樣,但主要的差異是現在只有 1,2,3 節點的 __consumer_offsets 被移動,其他 4,5,6 節點上的 __consumer_offsets 並非 allow 所以沒有和他們相關的變更。

{
  "after": [ { "brokerId": 4, "directory": "/tmp/log-folder-2" } ],
  "before": [ { "brokerId": 2, "directory": "/tmp/log-folder-1", "size": 0 } ],
  "topic": "__consumer_offsets",
  "partition": 14
},

測試 demote & excluded 節點,外加 disallow internal

"balancer.broker.balancing.mode": "1:demoted,2:balancing,3:excluded,4:excluded,5:excluded,6:excluded",
"balancer.allowed.topics.regex": "^(?!__).*"

image

image

第一個節點 demote,第二個節點 balancing,其他 excluded。

目前 demote 和 excluded 一起使用會有點問題,這個是把 https://github.com/skiptests/astraea/pull/1737/files#r1201617351 提到的程式碼刪掉的情況下進行的測試,沒有刪掉的話找不到解。

chia7712 commented 1 year ago

麻煩修正一下衝突

garyparrot commented 1 year ago

@chia7712 抱歉剛剛發現文件裡面的 regex 結尾少了 $