use of org.apache.asterix.common.config.MetadataProperties in project asterixdb by apache.
the class StartLifecycleComponentsTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext applicationContext = (INcApplicationContext) cs.getApplicationContext();
NCServiceContext serviceCtx = (NCServiceContext) cs.getContext();
MetadataProperties metadataProperties = applicationContext.getMetadataProperties();
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Starting lifecycle components");
}
Map<String, String> lifecycleMgmtConfiguration = new HashMap<>();
String dumpPathKey = LifeCycleComponentManager.Config.DUMP_PATH_KEY;
String dumpPath = metadataProperties.getCoredumpPath(serviceCtx.getNodeId());
lifecycleMgmtConfiguration.put(dumpPathKey, dumpPath);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Coredump directory for NC is: " + dumpPath);
}
ILifeCycleComponentManager lccm = serviceCtx.getLifeCycleComponentManager();
lccm.configure(lifecycleMgmtConfiguration);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Configured:" + lccm);
}
serviceCtx.setStateDumpHandler(new AsterixStateDumpHandler(serviceCtx.getNodeId(), lccm.getDumpPath(), lccm));
lccm.startAll();
}
use of org.apache.asterix.common.config.MetadataProperties in project asterixdb by apache.
the class NCApplication method updateOnNodeJoin.
private void updateOnNodeJoin() {
MetadataProperties metadataProperties = runtimeContext.getMetadataProperties();
if (!metadataProperties.getNodeNames().contains(nodeId)) {
Cluster cluster = ClusterProperties.INSTANCE.getCluster();
if (cluster == null) {
throw new IllegalStateException("No cluster configuration found for this instance");
}
NCConfig ncConfig = ((NodeControllerService) ncServiceCtx.getControllerService()).getConfiguration();
ncConfig.getConfigManager().registerVirtualNode(nodeId);
String asterixInstanceName = metadataProperties.getInstanceName();
TransactionProperties txnProperties = runtimeContext.getTransactionProperties();
Node self = null;
List<Node> nodes;
if (cluster.getSubstituteNodes() != null) {
nodes = cluster.getSubstituteNodes().getNode();
} else {
throw new IllegalStateException("Unknown node joining the cluster");
}
for (Node node : nodes) {
String ncId = asterixInstanceName + "_" + node.getId();
if (ncId.equalsIgnoreCase(nodeId)) {
String storeDir = ClusterProperties.INSTANCE.getStorageDirectoryName();
String nodeIoDevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
String[] ioDevicePaths = nodeIoDevices.trim().split(",");
for (int i = 0; i < ioDevicePaths.length; i++) {
// construct full store path
ioDevicePaths[i] += File.separator + storeDir;
}
metadataProperties.getStores().put(nodeId, ioDevicePaths);
String coredumpPath = node.getLogDir() == null ? cluster.getLogDir() : node.getLogDir();
metadataProperties.getCoredumpPaths().put(nodeId, coredumpPath);
String txnLogDir = node.getTxnLogDir() == null ? cluster.getTxnLogDir() : node.getTxnLogDir();
txnProperties.getLogDirectories().put(nodeId, txnLogDir);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Store set to : " + storeDir);
LOGGER.info("Coredump dir set to : " + coredumpPath);
LOGGER.info("Transaction log dir set to :" + txnLogDir);
}
self = node;
break;
}
}
if (self != null) {
cluster.getSubstituteNodes().getNode().remove(self);
cluster.getNode().add(self);
} else {
throw new IllegalStateException("Unknown node joining the cluster");
}
}
}
Aggregations