mergingComponents.get(i).schedule(LSMIOOperationType.MERGE); ioOpCallback.scheduled(mergeOp); return mergeOp;
@Override public void scheduled(ILSMIOOperation operation) throws HyracksDataException { scheduledCallback.before(operation); encapsulated.scheduled(operation); scheduledCallback.after(operation); }
@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; }
relMergeFileRefs.getInsertIndexFileReference(), relMergeFileRefs.getBloomFilterFileReference(), ioOpCallback, fileManager.getBaseDir().getAbsolutePath()); ioOpCallback.scheduled(mergeOp); return mergeOp;
@Override public ILSMIOOperation createMergeOperation(ILSMIndexOperationContext ctx) throws HyracksDataException { ILSMIndexOperationContext rctx = createOpContext(NoOpOperationCallback.INSTANCE, -1); rctx.setOperation(IndexOperation.MERGE); List<ILSMComponent> mergingComponents = ctx.getComponentHolder(); LSMRTreeSortedCursor cursor = new LSMRTreeSortedCursor(rctx, linearizer, buddyBTreeFields); LSMComponentFileReferences relMergeFileRefs = getMergeFileReferences((ILSMDiskComponent) mergingComponents.get(mergingComponents.size() - 1), (ILSMDiskComponent) mergingComponents.get(0)); ILSMIndexAccessor accessor = new LSMRTreeAccessor(getHarness(), rctx, buddyBTreeFields); // create the merge operation. LSMRTreeMergeOperation mergeOp = new LSMRTreeMergeOperation(accessor, cursor, relMergeFileRefs.getInsertIndexFileReference(), relMergeFileRefs.getDeleteIndexFileReference(), relMergeFileRefs.getBloomFilterFileReference(), ioOpCallback, fileManager.getBaseDir().getAbsolutePath()); ioOpCallback.scheduled(mergeOp); return mergeOp; }
@Override public ILSMIOOperation createFlushOperation(ILSMIndexOperationContext ctx) throws HyracksDataException { ILSMMemoryComponent flushingComponent = getCurrentMemoryComponent(); if (flushingComponent.getWriterCount() > 0) { throw new IllegalStateException( "createFlushOperation is called on a component with writers: " + flushingComponent); } // take care of the flush cycling ILSMIOOperation flushOp = TracedIOOperation.wrap(createFlushOperation(createOpContext(NoOpIndexAccessParameters.INSTANCE), fileManager.getRelFlushFileReference(), ioOpCallback), tracer); // Changing the flush status should *always* precede changing the mutable component. flushingComponent.schedule(LSMIOOperationType.FLUSH); numScheduledFlushes++; changeFlushStatusForCurrentMutableCompoent(false); changeMutableComponent(); ILSMIndexAccessor accessor = flushOp.getAccessor(); ILSMIndexOperationContext flushCtx = accessor.getOpContext(); flushCtx.setOperation(ctx.getOperation()); // Could be component delete flushCtx.getComponentHolder().add(flushingComponent); flushCtx.setIoOperation(flushOp); propagateMap(ctx, flushCtx); ioOpCallback.scheduled(flushOp); return flushOp; }
public IIndexBulkLoader createBulkLoader(float fillLevel, boolean verifyInput, long numElementsHint, Map<String, Object> parameters) throws HyracksDataException { AbstractLSMIndexOperationContext opCtx = createOpContext(NoOpIndexAccessParameters.INSTANCE); opCtx.setParameters(parameters); LSMComponentFileReferences componentFileRefs = fileManager.getRelFlushFileReference(); LoadOperation loadOp = new LoadOperation(componentFileRefs, ioOpCallback, getIndexIdentifier(), parameters); loadOp.setNewComponent(createDiskComponent(bulkLoadComponentFactory, componentFileRefs.getInsertIndexFileReference(), componentFileRefs.getDeleteIndexFileReference(), componentFileRefs.getBloomFilterFileReference(), true)); ioOpCallback.scheduled(loadOp); opCtx.setIoOperation(loadOp); return new LSMIndexDiskComponentBulkLoader(this, opCtx, fillLevel, verifyInput, numElementsHint); }
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); }
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); }
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); }