fixed issue #172, 精确识别主备切换,尝试基于时间戳重新定位位点,确保不丢数据

This commit is contained in:
agapple
2016-06-28 22:58:55 +08:00
parent 6eafc73a65
commit ae05a3f39f
6 changed files with 93 additions and 53 deletions

View File

@@ -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;