use of com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta in project x-pipe by ctripcorp.
the class SimpleTest method testJson.
@Test
public void testJson() {
ReplicationStoreMeta meta = new ReplicationStoreMeta();
meta.setBeginOffset(100L);
String json = JSON.toJSONString(meta);
System.out.println(json);
meta = JSON.parseObject(null, ReplicationStoreMeta.class);
System.out.println(meta);
}
use of com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta in project x-pipe by ctripcorp.
the class AbstractMetaStore method rdbUpdated.
@Override
public ReplicationStoreMeta rdbUpdated(String rdbFile, EofType eofType, long rdbOffset) throws IOException {
synchronized (metaRef) {
ReplicationStoreMeta metaDup = dupReplicationStoreMeta();
metaDup.setRdbFile(rdbFile);
setRdbFileInfo(metaDup, eofType);
metaDup.setRdbLastOffset(rdbOffset);
logger.info("[rdbUpdated] update rdbLastOffset to {}", rdbOffset);
saveMeta(metaDup);
return metaDup;
}
}
use of com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta in project x-pipe by ctripcorp.
the class AbstractMetaStore method updateKeeperRunid.
@Override
public void updateKeeperRunid(String keeperRunid) throws IOException {
synchronized (metaRef) {
ReplicationStoreMeta metaDup = dupReplicationStoreMeta();
if (metaDup.getKeeperRunid() != null && !metaDup.getKeeperRunid().equals(keeperRunid)) {
logger.warn("[keeperRunIdChanged]{}->{}", metaDup.getKeeperRunid(), keeperRunid);
}
metaDup.setKeeperRunid(keeperRunid);
saveMeta(metaDup);
}
}
use of com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta in project x-pipe by ctripcorp.
the class DefaultMetaStore method shiftReplicationId.
@Override
public ReplicationStoreMeta shiftReplicationId(String newReplId, Long currentOffset) throws IOException {
synchronized (metaRef) {
ReplicationStoreMeta metaDup = dupReplicationStoreMeta();
String currentReplId = metaDup.getReplId();
if (ObjectUtils.equals(currentReplId, newReplId)) {
logger.info("[shiftReplicationId][repidEqual]{}", newReplId);
return metaDup;
}
metaDup.setReplId(newReplId);
metaDup.setReplId2(currentReplId);
metaDup.setSecondReplIdOffset(currentOffset + 1);
saveMeta(metaDup);
return metaDup;
}
}
use of com.ctrip.xpipe.redis.core.store.ReplicationStoreMeta in project x-pipe by ctripcorp.
the class DefaultMetaStore method rdbBegun.
@Override
public ReplicationStoreMeta rdbBegun(String replId, long beginOffset, String rdbFile, EofType eofType, String cmdFilePrefix) throws IOException {
synchronized (metaRef) {
ReplicationStoreMeta metaDup = dupReplicationStoreMeta();
metaDup.setReplId(replId);
metaDup.setBeginOffset(beginOffset);
metaDup.setRdbFile(rdbFile);
setRdbFileInfo(metaDup, eofType);
metaDup.setCmdFilePrefix(cmdFilePrefix);
metaDup.setRdbLastOffset(beginOffset - 1);
clearReplicationId2(metaDup);
saveMeta(metaDup);
return metaDup;
}
}
Aggregations