@Override public void end() throws HyracksDataException { try { ioOpCallback.afterOperation(loadOp); componentBulkLoader.end(); if (component.getComponentSize() > 0) { if (isTransaction) { // Since this is a transaction component, validate and // deactivate. it could later be added or deleted try { component.markAsValid(durable, loadOp); } finally { ioOpCallback.afterFinalize(loadOp); } component.deactivate(); } else { ioOpCallback.afterFinalize(loadOp); getHarness().addBulkLoadedComponent(loadOp); } } } finally { ioOpCallback.completed(loadOp); } }
@Override public void allocated(ILSMMemoryComponent component) throws HyracksDataException { encapsulated.allocated(component); }
private void activeate() throws HyracksDataException { if (state == ComponentState.INACTIVE) { state = ComponentState.READABLE_WRITABLE; lsmIndex.getIOOperationCallback().recycled(this); } }
@Override public void abort() throws HyracksDataException { try { try { componentBulkLoader.abort(); } finally { ioOpCallback.afterFinalize(loadOp); } } finally { ioOpCallback.completed(loadOp); } }
public void doIo(ILSMIOOperation operation) { try { operation.getCallback().beforeOperation(operation); ILSMDiskComponent newComponent = operation.getIOOpertionType() == LSMIOOperationType.FLUSH ? lsmIndex.flush(operation) : lsmIndex.merge(operation); operation.setNewComponent(newComponent); operation.getCallback().afterOperation(operation); if (newComponent != null) { newComponent.markAsValid(lsmIndex.isDurable(), operation); operation.getCallback().afterFinalize(operation); } catch (Throwable th) {// NOSONAR Must catch all operation.setStatus(LSMIOOperationStatus.FAILURE);
public LSMTwoPCBTreeBulkLoader(float fillFactor, boolean verifyInput, long numElementsHint, boolean isTransaction, Map<String, Object> parameters) throws HyracksDataException { this.isTransaction = isTransaction; // Create the appropriate target LSMComponentFileReferences componentFileRefs; if (isTransaction) { try { componentFileRefs = fileManager.getNewTransactionFileReference(); } catch (IOException e) { throw HyracksDataException.create(e); } component = createDiskComponent(transactionComponentFactory, componentFileRefs.getInsertIndexFileReference(), null, componentFileRefs.getBloomFilterFileReference(), true); } else { componentFileRefs = fileManager.getRelFlushFileReference(); component = createDiskComponent(bulkLoadComponentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true); } loadOp = new LoadOperation(componentFileRefs, ioOpCallback, getIndexIdentifier(), parameters); loadOp.setNewComponent(component); ioOpCallback.scheduled(loadOp); ioOpCallback.beforeOperation(loadOp); componentBulkLoader = component.createBulkLoader(loadOp, fillFactor, verifyInput, numElementsHint, false, true, true); }
mergingComponents.get(i).schedule(LSMIOOperationType.MERGE); ioOpCallback.scheduled(mergeOp); return mergeOp;
private void presistComponentToDisk() throws HyracksDataException { try { lsmIndex.getIOOperationCallback().afterOperation(opCtx.getIoOperation()); componentBulkLoader.end(); } catch (Throwable th) { // NOSONAR Must not call afterFinalize without setting failure fail(th); throw th; } finally { lsmIndex.getIOOperationCallback().afterFinalize(opCtx.getIoOperation()); } if (opCtx.getIoOperation().getStatus() == LSMIOOperationStatus.SUCCESS && opCtx.getIoOperation().getNewComponent().getComponentSize() > 0) { lsmIndex.getHarness().addBulkLoadedComponent(opCtx.getIoOperation()); } }
@Override public void abort() throws HyracksDataException { try { componentBulkLoader.abort(); } finally { ioOpCallback.completed(loadOp); } }
@Override public void afterFinalize(ILSMIOOperation operation) throws HyracksDataException { afterFinalizeCallback.before(operation); encapsulated.afterFinalize(operation); afterFinalizeCallback.after(operation); }
@Override public void beforeOperation(ILSMIOOperation operation) throws HyracksDataException { beforeOperationCallback.before(operation); encapsulated.beforeOperation(operation); beforeOperationCallback.after(operation); }
@Override public void afterOperation(ILSMIOOperation operation) throws HyracksDataException { afterOperationCallback.before(operation); encapsulated.afterOperation(operation); afterOperationCallback.after(operation); }
@Override public void abort() throws HyracksDataException { try { try { componentBulkLoader.abort(); } finally { ioOpCallback.afterFinalize(loadOp); } } finally { ioOpCallback.completed(loadOp); } }
public LSMTwoPCRTreeBulkLoader(float fillFactor, boolean verifyInput, long numElementsHint, boolean isTransaction, Map<String, Object> parameters) throws HyracksDataException { this.isTransaction = isTransaction; // Create the appropriate target LSMComponentFileReferences componentFileRefs; if (isTransaction) { try { componentFileRefs = fileManager.getNewTransactionFileReference(); } catch (IOException e) { throw HyracksDataException.create(e); } component = createDiskComponent(componentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true); } else { componentFileRefs = fileManager.getRelFlushFileReference(); component = createDiskComponent(bulkLoadComponentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true); } loadOp = new LoadOperation(componentFileRefs, ioOpCallback, getIndexIdentifier(), parameters); loadOp.setNewComponent(component); ioOpCallback.scheduled(loadOp); ioOpCallback.beforeOperation(loadOp); componentBulkLoader = component.createBulkLoader(loadOp, fillFactor, verifyInput, numElementsHint, false, true, false); }
@Override public void scheduled(ILSMIOOperation operation) throws HyracksDataException { scheduledCallback.before(operation); encapsulated.scheduled(operation); scheduledCallback.after(operation); }
@Override public synchronized void complete() { if (completed) { throw new IllegalStateException("Multiple destroy calls"); } callback.completed(this); completed = true; if (completeListeners != null) { for (IoOperationCompleteListener listener : completeListeners) { listener.completed(this); } completeListeners = null; } notifyAll(); }
@Override public void end() throws HyracksDataException { try { ioOpCallback.afterOperation(loadOp); componentBulkLoader.end(); if (component.getComponentSize() > 0) { if (isTransaction) { // Since this is a transaction component, validate and // deactivate. it could later be added or deleted try { component.markAsValid(durable, loadOp); } finally { ioOpCallback.afterFinalize(loadOp); } component.deactivate(); } else { ioOpCallback.afterFinalize(loadOp); getHarness().addBulkLoadedComponent(loadOp); } } } finally { ioOpCallback.completed(loadOp); } }
@Override public void abort() throws HyracksDataException { opCtx.getIoOperation().setStatus(LSMIOOperationStatus.FAILURE); try { try { componentBulkLoader.abort(); } finally { lsmIndex.getIOOperationCallback().afterFinalize(opCtx.getIoOperation()); } } finally { lsmIndex.getIOOperationCallback().completed(opCtx.getIoOperation()); } }
public LSMTwoPCBTreeWithBuddyBulkLoader(float fillFactor, boolean verifyInput, long numElementsHint, boolean isTransaction, Map<String, Object> parameters) throws HyracksDataException { this.isTransaction = isTransaction; // Create the appropriate target LSMComponentFileReferences componentFileRefs; if (isTransaction) { try { componentFileRefs = fileManager.getNewTransactionFileReference(); } catch (IOException e) { throw HyracksDataException.create(e); } component = createDiskComponent(bulkLoadComponentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true); } else { componentFileRefs = fileManager.getRelFlushFileReference(); component = createDiskComponent(bulkLoadComponentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true); } loadOp = new LoadOperation(componentFileRefs, ioOpCallback, getIndexIdentifier(), parameters); loadOp.setNewComponent(component); ioOpCallback.scheduled(loadOp); ioOpCallback.beforeOperation(loadOp); componentBulkLoader = component.createBulkLoader(loadOp, fillFactor, verifyInput, numElementsHint, false, true, false); }
@Override public LSMBTreeWithBuddyMergeOperation createMergeOperation(ILSMIndexOperationContext ctx) throws HyracksDataException { ILSMIndexOperationContext bctx = createOpContext(NoOpOperationCallback.INSTANCE, 0); bctx.setOperation(IndexOperation.MERGE); List<ILSMComponent> mergingComponents = ctx.getComponentHolder(); LSMBTreeWithBuddySortedCursor cursor = new LSMBTreeWithBuddySortedCursor(bctx, buddyBTreeFields); LSMComponentFileReferences relMergeFileRefs = getMergeTargetFileName(mergingComponents); ILSMIndexAccessor accessor = new LSMTreeIndexAccessor(getHarness(), bctx, opCtx -> new LSMBTreeWithBuddySearchCursor(opCtx, buddyBTreeFields)); // Since we have two lists of components, to tell whether we need to // keep deleted tuples, we need to know // which list to check against and we need to synchronize for this boolean keepDeleteTuples = false; if (version == 0) { keepDeleteTuples = mergingComponents.get(mergingComponents.size() - 1) != diskComponents .get(diskComponents.size() - 1); } else { keepDeleteTuples = mergingComponents.get(mergingComponents.size() - 1) != secondDiskComponents .get(secondDiskComponents.size() - 1); } LSMBTreeWithBuddyMergeOperation mergeOp = new LSMBTreeWithBuddyMergeOperation(accessor, cursor, relMergeFileRefs.getInsertIndexFileReference(), relMergeFileRefs.getDeleteIndexFileReference(), relMergeFileRefs.getBloomFilterFileReference(), ioOpCallback, fileManager.getBaseDir().getAbsolutePath(), keepDeleteTuples); ioOpCallback.scheduled(mergeOp); return mergeOp; }