private void getAndExitComponentsAndComplete(ILSMIndexOperationContext ctx, LSMOperationType op) throws HyracksDataException { validateOperationEnterComponentsState(ctx); synchronized (opTracker) { lsmIndex.getOperationalComponents(ctx); ctx.setAccessingComponents(true); exitAndComplete(ctx, op); } }
@Override protected boolean getAndEnterComponents(ILSMIndexOperationContext ctx, LSMOperationType opType, boolean isTryOperation) throws HyracksDataException { validateOperationEnterComponentsState(ctx); synchronized (opTracker) { while (true) { lsmIndex.getOperationalComponents(ctx); // Before entering the components, prune those corner cases that indeed should not proceed. switch (opType) { case MERGE: if (ctx.getComponentHolder().size() < 2) { // There is only a single component. There is nothing to merge. return false; } default: break; } if (enterComponents(ctx, opType)) { return true; } else if (isTryOperation) { return false; } } } }
protected boolean getAndEnterComponents(ILSMIndexOperationContext ctx, LSMOperationType opType, boolean isTryOperation) throws HyracksDataException { long before = 0L; if (ctx.isTracingEnabled()) { before = System.nanoTime(); } try { validateOperationEnterComponentsState(ctx); synchronized (opTracker) { while (true) { lsmIndex.getOperationalComponents(ctx); if (enterComponents(ctx, opType)) { return true; } else if (isTryOperation) { return false; } try { opTracker.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw HyracksDataException.create(e); } } } } finally { if (ctx.isTracingEnabled()) { ctx.incrementEnterExitTime(System.nanoTime() - before); } } }
private void assertCorrectSearchComponents(ILSMIndexOperationContext opCtx, ILSMIndex index, int numSuccesfullyCompletedFlushes) throws HyracksDataException { opCtx.reset(); opCtx.setOperation(IndexOperation.SEARCH); index.getOperationalComponents(opCtx); List<ILSMMemoryComponent> memComponents = index.getMemoryComponents(); int first = numSuccesfullyCompletedFlushes % memComponents.size(); Assert.assertEquals(memComponents.get(first), getFirstMemoryComponent(opCtx)); }