didi / didi/KnowStreaming

低版本(modifyThrottleTaskByZKClient)执行后导致限流丢失follower.replication.throttled.replicas

Open
#922 1 comment 0 reactions 0 assignees View on GitHub
dev: backend type: bug
Dominant language
Java
Stars
7.2k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

###问题代码段

```
// 当前ZK上的迁移信息
scala.collection.Map> currentParts = kafkaZkClient.getReplicaAssignmentForTopics(
proposedParts.keySet().map(elem -> elem.topic()).toSet()
);

// 转为moveMap格式
scala.collection.mutable.Map> moveMap =
ReassignPartitionsCommand.calculateProposedMoveMap(new scala.collection.mutable.HashMap<>(), proposedParts, currentParts);

// 对Topic进行限流
scala.collection.Map leaderThrottles = ReassignPartitionsCommand.calculateLeaderThrottles(moveMap);
scala.collection.Map followerThrottles = ReassignPartitionsCommand.calculateFollowerThrottles(moveMap);
ReassignPartitionsCommand.modifyTopicThrottles(kafkaZkClient, leaderThrottles, followerThrottles);
```
### 问题描述

1. 当前ZK上的迁移信息这里获取的是topic的所有分区的副本信息 对于已经开始迁移任务,返回结果中开始迁移的分区副本会包含未完成的broker 即不再是迁移前的副本列表了
2. 这里转为moveMap格式时模仿启动迁移任务时的逻辑,但是方法calculateProposedMoveMap第一个参数依然传递的为空的Map,
3. 传递空Map 这样导致calculateProposedMoveMap方法内部diff后的结果为空

### 预期结果

处理掉这个bug

### 实际结果

修改限流信息 不再影响follower.replication.throttled.replicas

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.