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");
}
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());
}
}
Aggregations