use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DirectoryInf in project dble by actiontech.
the class SequenceTopropertiesLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf sequenceDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.SEQUENCES, sequenceDirectory);
sequenceDirectory = (DirectoryInf) sequenceDirectory.getSubordinateInfo().get(0);
this.sequenceZkToProperties(PROPERTIES_SEQUENCE_CONF, sequenceDirectory);
this.sequenceZkToProperties(PROPERTIES_SEQUENCE_DB_CONF, sequenceDirectory);
this.sequenceZkToProperties(PROPERTIES_SEQUENCE_DISTRIBUTED_CONF, sequenceDirectory);
return true;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DirectoryInf in project dble by actiontech.
the class BinlogPauseStatusListener method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf statusDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.BINLOG_PAUSE_STATUS, statusDirectory);
ZkDataImpl zkDdata = (ZkDataImpl) statusDirectory.getSubordinateInfo().get(0);
String strPauseInfo = zkDdata.getDataValue();
LOGGER.info("BinlogPauseStatusListener notifyProcess zk to object :" + strPauseInfo);
BinlogPause pauseInfo = new BinlogPause(strPauseInfo);
String myID = ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID);
if (pauseInfo.getFrom().equals(myID)) {
// self node
return true;
}
String instancePath = ZKPaths.makePath(KVPathUtil.getBinlogPauseInstance(), myID);
if (pauseInfo.getStatus() == BinlogPause.BinlogPauseStatus.ON) {
DbleServer.getInstance().getBackupLocked().compareAndSet(false, true);
boolean isPaused = ShowBinlogStatus.waitAllSession();
if (!isPaused) {
cleanResource(instancePath);
}
try {
ZKUtils.createTempNode(KVPathUtil.getBinlogPauseInstance(), myID, String.valueOf(isPaused).getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
cleanResource(instancePath);
LOGGER.warn(AlarmCode.CORE_ZK_WARN + "create binlogPause instance failed", e);
}
} else if (pauseInfo.getStatus() == BinlogPause.BinlogPauseStatus.OFF) {
cleanResource(instancePath);
}
return true;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.DirectoryInf in project dble by actiontech.
the class ZkMultiLoader method getTreeDirectory.
/**
* getTreeDirectory
*
* @param path
* @param zkDirectory
* @throws Exception
* @Created 2016/9/15
*/
public void getTreeDirectory(String path, String name, DirectoryInf zkDirectory) throws Exception {
boolean check = this.checkPathExists(path);
if (check) {
String currDate = this.getDataToString(path);
List<String> childPathList = this.getChildNames(path);
if (null != childPathList && !childPathList.isEmpty()) {
DirectoryInf directory = new ZkDirectoryImpl(name, currDate);
zkDirectory.add(directory);
for (String childPath : childPathList) {
this.getTreeDirectory(ZKPaths.makePath(path, childPath), childPath, directory);
}
} else {
zkDirectory.add(new ZkDataImpl(name, currDate));
}
}
}
Aggregations