-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
canal.mq.partitionsNum 配置后,rocketmq的queue都发了消息,现象好像是广播 #3267
Comments
原因应该找到了 // 并发构造
源码中 这个是上面的2个for循环导致的 |
改了源码,修复了此bug了
改动的第二个地方
|
最近同样也遇到了这个问题,采用的是RocketMQ,flatMessage=true,将partitionsNum设置为16,根据记录主键Hash分区,每次修改一条数据以后,根据hash策略会往一个队列里面塞入一条数据,但是其它15个队列,会发送15条消息体为"null"的数据,其根本原因在于 FlatMessage[] partitionFlatMessage = MQMessageUtils.messagePartition(flatMessage,
partitionNum,
destination.getPartitionHash(),
mqProperties.isDatabaseHash());
List<Message> messages = flatMessagePart.stream()
.map(flatMessage -> new Message(topicName, JSON.toJSONBytes(flatMessage,
SerializerFeature.WriteMapNullValue)))
.collect(Collectors.toList()); 在循环构建的过程中, List<Message> messages = flatMessagePart.stream().filter(Objects::nonNull)
.map(flatMessage -> new Message(topicName, JSON.toJSONBytes(flatMessage,
SerializerFeature.WriteMapNullValue)))
.collect(Collectors.toList()); 重新打包部署以后,问题就解决了 |
我也遇到了。感觉是突然出来的。好好的,就突然不行了。就是因为重启了一下 |
canal server 版本为 1.1.5-snapshot
canal中的instance配置文件中,配置了
mq config
canal.mq.topic=customer_info
canal.mq.partitionsNum=4
canal.mq.partitionHash=scb_customer.customer_info:sid,scb_customer.label_customer:sid
新增customer_info表一条记录
Broker | 队列 | 消费者终端 | 代理者位点 | 消费者位点 | 差值 | 上次时间
broker-a | 0 | | 2 | 0 | 2 | 2020-12-10 22:34:24
broker-a | 1 | | 2 | 0 | 2 | 1970-01-01 08:00:00
broker-a | 2 | | 2 | 0 | 2 | 1970-01-01 08:00:00
broker-a | 3 | | 2 | 0 | 2 | 1970-01-01 08:00:00
上面的4个队列 都增加了消息;;;每新增一条记录,4个队列都插入消息
也就是会产生4个消息(只有1个消息的消息body里面的内容是正确的;其他3个消息 MessageBody 为 null )
The text was updated successfully, but these errors were encountered: