mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fix bug: 并行解析模式下,开启gtid 会导致解析错误
This commit is contained in:
@@ -170,15 +170,13 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
||||
return entryBuilder.build();
|
||||
}
|
||||
|
||||
private Entry parseGTIDLogEvent(GtidLogEvent logEvent) {
|
||||
public Entry parseGTIDLogEvent(GtidLogEvent logEvent) {
|
||||
LogHeader logHeader = logEvent.getHeader();
|
||||
String value = logEvent.getSid().toString() + ":" + logEvent.getGno();
|
||||
Pair.Builder builder = Pair.newBuilder();
|
||||
builder.setKey("gtid");
|
||||
builder.setValue(value);
|
||||
if (gtidSet != null) {
|
||||
gtidSet.update(value);
|
||||
}
|
||||
|
||||
if (logEvent.getLastCommitted() != null) {
|
||||
builder.setKey("lastCommitted");
|
||||
builder.setValue(String.valueOf(logEvent.getLastCommitted()));
|
||||
@@ -845,9 +843,8 @@ public class LogEventConvert extends AbstractCanalLifeCycle implements BinlogPar
|
||||
}
|
||||
headerBuilder.setEventLength(logHeader.getEventLen());
|
||||
// enable gtid position
|
||||
if (gtidSet != null) {
|
||||
String gtid = gtidSet.toString();
|
||||
headerBuilder.setGtid(gtid);
|
||||
if (StringUtils.isNotEmpty(logHeader.getGtidStr())) {
|
||||
headerBuilder.setGtid(logHeader.getGtidStr());
|
||||
}
|
||||
|
||||
// add rowsCount suppport
|
||||
|
||||
Reference in New Issue
Block a user