mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed issue #440, for null position
This commit is contained in:
@@ -385,10 +385,15 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
|
|||||||
if (tableMetaTSDB != null && (fixedPosition.getTimestamp() == null || fixedPosition.getTimestamp() <= 0)) {
|
if (tableMetaTSDB != null && (fixedPosition.getTimestamp() == null || fixedPosition.getTimestamp() <= 0)) {
|
||||||
// 使用一个未来极大的时间,基于位点进行定位
|
// 使用一个未来极大的时间,基于位点进行定位
|
||||||
long startTimestamp = System.currentTimeMillis() + 102L * 365 * 24 * 3600 * 1000; // 当前时间的未来102年
|
long startTimestamp = System.currentTimeMillis() + 102L * 365 * 24 * 3600 * 1000; // 当前时间的未来102年
|
||||||
return findAsPerTimestampInSpecificLogFile(mysqlConnection,
|
EntryPosition entryPosition = findAsPerTimestampInSpecificLogFile(mysqlConnection,
|
||||||
startTimestamp,
|
startTimestamp,
|
||||||
fixedPosition,
|
fixedPosition,
|
||||||
fixedPosition.getJournalName());
|
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 {
|
} else {
|
||||||
return fixedPosition;
|
return fixedPosition;
|
||||||
}
|
}
|
||||||
@@ -767,7 +772,7 @@ public class MysqlEventParser extends AbstractMysqlEventParser implements CanalE
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.equals(endPosition.getJournalName(), logfilename)
|
if (StringUtils.equals(endPosition.getJournalName(), logfilename)
|
||||||
&& endPosition.getPosition() <= logfileoffset) {
|
&& endPosition.getPosition() < logfileoffset) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -254,7 +254,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>druid</artifactId>
|
<artifactId>druid</artifactId>
|
||||||
<version>1.1.6</version>
|
<version>1.1.7-preview_0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- log -->
|
<!-- log -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
Reference in New Issue
Block a user