mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
删除操作计算hash值的情况没有考虑,导致删除时的分区和插入时的分区不一致 (#1848)
This commit is contained in:
@@ -230,10 +230,25 @@ public class MQMessageUtils {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (CanalEntry.Column column : rowData.getAfterColumnsList()) {
|
||||
if (checkPkNamesHasContain(hashMode.pkNames, column.getName())) {
|
||||
hashCode = hashCode ^ column.getValue().hashCode();
|
||||
try {
|
||||
CanalEntry.EventType eventType = RowChange.parseFrom(entry.getStoreValue()).getEventType();
|
||||
if(eventType == CanalEntry.EventType.DELETE){
|
||||
for (CanalEntry.Column column : rowData.getBeforeColumnsList()) {
|
||||
if (checkPkNamesHasContain(hashMode.pkNames, column.getName())) {
|
||||
hashCode = hashCode ^ column.getValue().hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (CanalEntry.Column column : rowData.getAfterColumnsList()) {
|
||||
if (checkPkNamesHasContain(hashMode.pkNames, column.getName())) {
|
||||
hashCode = hashCode ^ column.getValue().hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user