mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fix filter transaction entry logic in EntryEventSink
This commit is contained in:
@@ -100,11 +100,12 @@ public class EntryEventSink extends AbstractCanalEventSink<List<CanalEntry.Entry
|
|||||||
&& (entry.getEntryType() == EntryType.TRANSACTIONBEGIN || entry.getEntryType() == EntryType.TRANSACTIONEND)) {
|
&& (entry.getEntryType() == EntryType.TRANSACTIONBEGIN || entry.getEntryType() == EntryType.TRANSACTIONEND)) {
|
||||||
long currentTimestamp = entry.getHeader().getExecuteTime();
|
long currentTimestamp = entry.getHeader().getExecuteTime();
|
||||||
// 基于一定的策略控制,放过空的事务头和尾,便于及时更新数据库位点,表明工作正常
|
// 基于一定的策略控制,放过空的事务头和尾,便于及时更新数据库位点,表明工作正常
|
||||||
if (Math.abs(currentTimestamp - lastTransactionTimestamp) > emptyTransactionInterval
|
if (lastTransactionCount.incrementAndGet() <= emptyTransctionThresold
|
||||||
|| lastTransactionCount.incrementAndGet() > emptyTransctionThresold) {
|
&& Math.abs(currentTimestamp - lastTransactionTimestamp) <= emptyTransactionInterval) {
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
lastTransactionCount.set(0L);
|
lastTransactionCount.set(0L);
|
||||||
lastTransactionTimestamp = currentTimestamp;
|
lastTransactionTimestamp = currentTimestamp;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user