use of org.apache.asterix.common.api.INcApplicationContext 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.api.INcApplicationContext in project asterixdb by apache.
the class StartReplicationServiceTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext appContext = (INcApplicationContext) cs.getApplicationContext();
try {
//Open replication channel
appContext.getReplicationChannel().start();
final IReplicationManager replicationManager = appContext.getReplicationManager();
//Check the state of remote replicas
replicationManager.initializeReplicasState();
//Start replication after the state of remote replicas has been initialized.
replicationManager.startReplicationThreads();
} catch (Exception e) {
throw HyracksDataException.create(e);
}
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class MetadataBootstrapTask method perform.
@Override
public void perform(IControllerService cs) throws HyracksDataException {
INcApplicationContext appContext = (INcApplicationContext) cs.getApplicationContext();
try {
SystemState state = appContext.getTransactionSubsystem().getRecoveryManager().getSystemState();
appContext.initializeMetadata(state == SystemState.PERMANENT_DATA_LOSS);
} catch (Exception e) {
throw HyracksDataException.create(e);
}
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class GenericAdapterFactory method createAdapter.
/**
* Runs on each node controller (after serialization-deserialization)
*/
@Override
public synchronized IDataSourceAdapter createAdapter(IHyracksTaskContext ctx, int partition) throws HyracksDataException {
INCServiceContext serviceCtx = ctx.getJobletContext().getServiceContext();
INcApplicationContext appCtx = (INcApplicationContext) serviceCtx.getApplicationContext();
try {
restoreExternalObjects(serviceCtx, appCtx.getLibraryManager());
} catch (Exception e) {
LOGGER.log(Level.INFO, "Failure restoring external objects", e);
throw HyracksDataException.create(e);
}
if (isFeed) {
if (feedLogManager == null) {
feedLogManager = FeedUtils.getFeedLogManager(ctx, partition, feedLogFileSplits);
}
feedLogManager.touch();
}
IDataFlowController controller = DataflowControllerProvider.getDataflowController(recordType, ctx, partition, dataSourceFactory, dataParserFactory, configuration, indexingOp, isFeed, feedLogManager);
if (isFeed) {
return new FeedAdapter((AbstractFeedDataFlowController) controller);
} else {
return new GenericAdapter(controller);
}
}
use of org.apache.asterix.common.api.INcApplicationContext in project asterixdb by apache.
the class LSMInsertDeleteOperatorNodePushable method open.
@Override
public void open() throws HyracksDataException {
accessor = new FrameTupleAccessor(inputRecDesc);
writeBuffer = new VSizeFrame(ctx);
appender = new FrameTupleAppender(writeBuffer);
indexHelper.open();
lsmIndex = (AbstractLSMIndex) indexHelper.getIndexInstance();
try {
if (isPrimary && ctx.getSharedObject() != null) {
PrimaryIndexLogMarkerCallback callback = new PrimaryIndexLogMarkerCallback(lsmIndex);
TaskUtil.putInSharedMap(ILogMarkerCallback.KEY_MARKER_CALLBACK, callback, ctx);
}
writer.open();
modCallback = modOpCallbackFactory.createModificationOperationCallback(indexHelper.getResource(), ctx, this);
indexAccessor = lsmIndex.createAccessor(modCallback, NoOpOperationCallback.INSTANCE);
if (tupleFilterFactory != null) {
tupleFilter = tupleFilterFactory.createTupleFilter(ctx);
frameTuple = new FrameTupleReference();
}
INcApplicationContext runtimeCtx = (INcApplicationContext) ctx.getJobletContext().getServiceContext().getApplicationContext();
LSMIndexUtil.checkAndSetFirstLSN(lsmIndex, runtimeCtx.getTransactionSubsystem().getLogManager());
} catch (Throwable th) {
throw new HyracksDataException(th);
}
}
Aggregations