From 912f5db2c70eece6263e84e9f0c8316798d1955b Mon Sep 17 00:00:00 2001 From: agapple Date: Fri, 8 Dec 2017 23:20:15 +0800 Subject: [PATCH] fixed issue #440, for null position --- .../canal/parse/inbound/mysql/MysqlEventParser.java | 9 +++++++-- pom.xml | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java index efee2b71..c840829b 100644 --- a/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java +++ b/parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java @@ -385,10 +385,15 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE if (tableMetaTSDB != null && (fixedPosition.getTimestamp() == null || fixedPosition.getTimestamp() <= 0)) { // 使用一个未来极大的时间,基于位点进行定位 long startTimestamp = System.currentTimeMillis() + 102L * 365 * 24 * 3600 * 1000; // 当前时间的未来102年 - return findAsPerTimestampInSpecificLogFile(mysqlConnection, + EntryPosition entryPosition = findAsPerTimestampInSpecificLogFile(mysqlConnection, startTimestamp, fixedPosition, fixedPosition.getJournalName()); + if (entryPosition == null) { + throw new CanalParseException("[fixed timestamp] can't found begin/commit position before with fixed position" + + fixedPosition.getJournalName() + ":" + fixedPosition.getPosition()); + } + return entryPosition; } else { return fixedPosition; } @@ -767,7 +772,7 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE } if (StringUtils.equals(endPosition.getJournalName(), logfilename) - && endPosition.getPosition() <= logfileoffset) { + && endPosition.getPosition() < logfileoffset) { return false; } diff --git a/pom.xml b/pom.xml index c0a3c04e..a951f42c 100644 --- a/pom.xml +++ b/pom.xml @@ -254,7 +254,7 @@ com.alibaba druid - 1.1.6 + 1.1.7-preview_0