Search in sources :

Example 1 with ITwoPCIndex

use of org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex in project asterixdb by apache.

the class ExternalDatasetIndexesCommitOperatorDescriptor method performOpOnIndex.

@Override
protected void performOpOnIndex(IIndexDataflowHelper indexHelper, IHyracksTaskContext ctx) throws HyracksDataException {
    String path = indexHelper.getResource().getPath();
    IIOManager ioManager = ctx.getIoManager();
    FileReference file = ioManager.resolve(path);
    LOGGER.warn("performing the operation on " + file.getFile().getAbsolutePath());
    // Get index
    IIndex index = indexHelper.getIndexInstance();
    // commit transaction
    ((ITwoPCIndex) index).commitTransaction();
    LOGGER.warn("operation on " + file.getFile().getAbsolutePath() + " Succeded");
}
Also used : IIndex(org.apache.hyracks.storage.common.IIndex) FileReference(org.apache.hyracks.api.io.FileReference) IIOManager(org.apache.hyracks.api.io.IIOManager) ITwoPCIndex(org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex)

Example 2 with ITwoPCIndex

use of org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex in project asterixdb by apache.

the class ExternalIndexHarness method addTransactionComponents.

// Three differences from  addBulkLoadedComponent
// 1. this needs synchronization since others might be accessing the index (specifically merge operations that might change the lists of components)
// 2. the actions taken by the index itself are different
// 3. the component has already been marked valid by the bulk update operation
public void addTransactionComponents(ILSMDiskComponent newComponent) throws HyracksDataException {
    ITwoPCIndex index = (ITwoPCIndex) lsmIndex;
    synchronized (opTracker) {
        List<ILSMDiskComponent> newerList;
        List<ILSMDiskComponent> olderList;
        if (index.getCurrentVersion() == 0) {
            newerList = index.getFirstComponentList();
            olderList = index.getSecondComponentList();
        } else {
            newerList = index.getSecondComponentList();
            olderList = index.getFirstComponentList();
        }
        // deleted if they are not needed anymore
        for (ILSMDiskComponent c : olderList) {
            exitComponent(c);
        }
        // Enter components in the newer list
        for (ILSMDiskComponent c : newerList) {
            enterComponent(c);
        }
        if (newComponent != null) {
            // Enter new component
            enterComponent(newComponent);
        }
        index.commitTransactionDiskComponent(newComponent);
        mergePolicy.diskComponentAdded(lsmIndex, fullMergeIsRequested.get());
    }
}
Also used : ILSMDiskComponent(org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent) ITwoPCIndex(org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex)

Aggregations

ITwoPCIndex (org.apache.hyracks.storage.am.lsm.common.api.ITwoPCIndex)2 FileReference (org.apache.hyracks.api.io.FileReference)1 IIOManager (org.apache.hyracks.api.io.IIOManager)1 ILSMDiskComponent (org.apache.hyracks.storage.am.lsm.common.api.ILSMDiskComponent)1 IIndex (org.apache.hyracks.storage.common.IIndex)1