Search in sources :

Example 6 with INcApplicationContext

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();
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) NCServiceContext(org.apache.hyracks.control.nc.application.NCServiceContext) HashMap(java.util.HashMap) ILifeCycleComponentManager(org.apache.hyracks.api.lifecycle.ILifeCycleComponentManager) AsterixStateDumpHandler(org.apache.asterix.hyracks.bootstrap.AsterixStateDumpHandler) MetadataProperties(org.apache.asterix.common.config.MetadataProperties)

Example 7 with INcApplicationContext

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);
    }
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) IReplicationManager(org.apache.asterix.common.replication.IReplicationManager) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 8 with INcApplicationContext

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);
    }
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) SystemState(org.apache.asterix.common.transactions.IRecoveryManager.SystemState) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException)

Example 9 with INcApplicationContext

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);
    }
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) INCServiceContext(org.apache.hyracks.api.application.INCServiceContext) GenericAdapter(org.apache.asterix.external.dataset.adapter.GenericAdapter) FeedAdapter(org.apache.asterix.external.dataset.adapter.FeedAdapter) IDataFlowController(org.apache.asterix.external.api.IDataFlowController) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)

Example 10 with INcApplicationContext

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);
    }
}
Also used : INcApplicationContext(org.apache.asterix.common.api.INcApplicationContext) FrameTupleAppender(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender) FrameTupleReference(org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference) PrimaryIndexLogMarkerCallback(org.apache.asterix.common.transactions.PrimaryIndexLogMarkerCallback) VSizeFrame(org.apache.hyracks.api.comm.VSizeFrame) HyracksDataException(org.apache.hyracks.api.exceptions.HyracksDataException) FrameTupleAccessor(org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)

Aggregations

INcApplicationContext (org.apache.asterix.common.api.INcApplicationContext)16 HyracksDataException (org.apache.hyracks.api.exceptions.HyracksDataException)8 ACIDException (org.apache.asterix.common.exceptions.ACIDException)4 ITransactionContext (org.apache.asterix.common.transactions.ITransactionContext)3 ITransactionManager (org.apache.asterix.common.transactions.ITransactionManager)3 IDatasetLifecycleManager (org.apache.asterix.common.api.IDatasetLifecycleManager)2 ILibraryManager (org.apache.asterix.common.library.ILibraryManager)2 PrimaryIndexLogMarkerCallback (org.apache.asterix.common.transactions.PrimaryIndexLogMarkerCallback)2 VSizeFrame (org.apache.hyracks.api.comm.VSizeFrame)2 IJobletEventListener (org.apache.hyracks.api.job.IJobletEventListener)2 JobStatus (org.apache.hyracks.api.job.JobStatus)2 NodeControllerService (org.apache.hyracks.control.nc.NodeControllerService)2 FrameTupleAccessor (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor)2 FrameTupleAppender (org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender)2 FrameTupleReference (org.apache.hyracks.dataflow.common.data.accessors.FrameTupleReference)2 DataOutput (java.io.DataOutput)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1