mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
修复最近位置被remove掉,导致重复消息的问题 (#3276)
This commit is contained in:
@@ -91,6 +91,8 @@ public class FileMixedMetaManager extends MemoryMetaManager implements CanalMeta
|
|||||||
for (ClientIdentity clientIdentity : tasks) {
|
for (ClientIdentity clientIdentity : tasks) {
|
||||||
MDC.put("destination", String.valueOf(clientIdentity.getDestination()));
|
MDC.put("destination", String.valueOf(clientIdentity.getDestination()));
|
||||||
try {
|
try {
|
||||||
|
updateCursorTasks.remove(clientIdentity);
|
||||||
|
|
||||||
// 定时将内存中的最新值刷到file中,多次变更只刷一次
|
// 定时将内存中的最新值刷到file中,多次变更只刷一次
|
||||||
if (logger.isInfoEnabled()) {
|
if (logger.isInfoEnabled()) {
|
||||||
LogPosition cursor = (LogPosition) getCursor(clientIdentity);
|
LogPosition cursor = (LogPosition) getCursor(clientIdentity);
|
||||||
@@ -100,7 +102,6 @@ public class FileMixedMetaManager extends MemoryMetaManager implements CanalMeta
|
|||||||
cursor.getIdentity().getSourceAddress().toString());
|
cursor.getIdentity().getSourceAddress().toString());
|
||||||
}
|
}
|
||||||
flushDataToFile(clientIdentity.getDestination());
|
flushDataToFile(clientIdentity.getDestination());
|
||||||
updateCursorTasks.remove(clientIdentity);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// ignore
|
// ignore
|
||||||
logger.error("period update" + clientIdentity.toString() + " curosr failed!", e);
|
logger.error("period update" + clientIdentity.toString() + " curosr failed!", e);
|
||||||
|
|||||||
@@ -79,9 +79,10 @@ public class PeriodMixedMetaManager extends MemoryMetaManager implements CanalMe
|
|||||||
List<ClientIdentity> tasks = new ArrayList<>(updateCursorTasks);
|
List<ClientIdentity> tasks = new ArrayList<>(updateCursorTasks);
|
||||||
for (ClientIdentity clientIdentity : tasks) {
|
for (ClientIdentity clientIdentity : tasks) {
|
||||||
try {
|
try {
|
||||||
|
updateCursorTasks.remove(clientIdentity);
|
||||||
|
|
||||||
// 定时将内存中的最新值刷到zookeeper中,多次变更只刷一次
|
// 定时将内存中的最新值刷到zookeeper中,多次变更只刷一次
|
||||||
zooKeeperMetaManager.updateCursor(clientIdentity, getCursor(clientIdentity));
|
zooKeeperMetaManager.updateCursor(clientIdentity, getCursor(clientIdentity));
|
||||||
updateCursorTasks.remove(clientIdentity);
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// ignore
|
// ignore
|
||||||
logger.error("period update" + clientIdentity.toString() + " curosr failed!", e);
|
logger.error("period update" + clientIdentity.toString() + " curosr failed!", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user