mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed issue #172, 精确识别主备切换,尝试基于时间戳重新定位位点,确保不丢数据
This commit is contained in:
@@ -15,6 +15,8 @@ public class EntryPosition extends TimePosition {
|
||||
private boolean included = false;
|
||||
private String journalName;
|
||||
private Long position;
|
||||
// add by agapple at 2016-06-28
|
||||
private Long serverId = null; // 记录一下位点对应的serverId
|
||||
|
||||
public EntryPosition(){
|
||||
super(null);
|
||||
@@ -34,6 +36,11 @@ public class EntryPosition extends TimePosition {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public EntryPosition(String journalName, Long position, Long timestamp, Long serverId){
|
||||
this(journalName, position, timestamp);
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
public String getJournalName() {
|
||||
return journalName;
|
||||
}
|
||||
@@ -58,6 +65,14 @@ public class EntryPosition extends TimePosition {
|
||||
this.included = included;
|
||||
}
|
||||
|
||||
public Long getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
public void setServerId(Long serverId) {
|
||||
this.serverId = serverId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
||||
Reference in New Issue
Block a user