@Override public FileReference getTarget() { return ioOp.getTarget(); }
@Override public void completed(ILSMIOOperation operation) { synchronized (scheduledFlushes) { scheduledFlushes.remove(operation.getTarget().getRelativePath()); } }
private void addComponentToCheckpoint(ILSMIOOperation operation) throws HyracksDataException { // will always update the checkpoint file even if no new component was created FileReference target = operation.getTarget(); Map<String, Object> map = operation.getParameters(); final Long lsn = operation.getIOOpertionType() == LSMIOOperationType.FLUSH ? (Long) map.get(KEY_FLUSH_LOG_LSN) : 0L; final LSMComponentId id = (LSMComponentId) map.get(KEY_FLUSHED_COMPONENT_ID); final ResourceReference ref = ResourceReference.of(target.getAbsolutePath()); final long componentSequence = IndexComponentFileReference.of(ref.getName()).getSequenceEnd(); indexCheckpointManagerProvider.get(ref).flushed(componentSequence, lsn, id.getMaxId()); }
@Override public LSMIOOperationStatus call() throws HyracksDataException { final String name = getTarget().getRelativePath(); final long tid = tracer.durationB(name, traceCategory, null); try { return ioOp.call(); } finally { tracer.durationE(ioOp.getIOOpertionType().name().toLowerCase(), traceCategory, tid, "{\"size\":" + getTarget().getFile().length() + ", \"path\": \"" + ioOp.getTarget().getRelativePath() + "\"}"); } }
public static ILSMIOOperation wrap(final ILSMIOOperation ioOp, final ITracer tracer) { final String ioOpName = ioOp.getIOOpertionType().name().toLowerCase(); final long traceCategory = tracer.getRegistry().get(TraceUtils.INDEX_IO_OPERATIONS); if (tracer.isEnabled(traceCategory)) { tracer.instant("schedule-" + ioOpName, traceCategory, Scope.p, "{\"path\": \"" + ioOp.getTarget().getRelativePath() + "\"}"); return new TracedIOOperation(ioOp, tracer, traceCategory); } return ioOp; }
ILSMIOOperation flush = accessor.scheduleFlush(); lastFlushTime = System.nanoTime(); scheduledFlushes.put(flush.getTarget().getRelativePath(), (FlushOperation) flush); flush.addCompleteListener(this);
private void deleteComponentsFromCheckpoint(ILSMIOOperation operation) throws HyracksDataException { // component was deleted... if a flush, do nothing.. if a merge, must update the checkpoint file if (operation.getIOOpertionType() == LSMIOOperationType.MERGE) { // Get component id of the last disk component LSMComponentId mostRecentComponentId = getMostRecentComponentId(operation.getAccessor().getOpContext().getComponentsToBeMerged()); // Update the checkpoint file FileReference target = operation.getTarget(); final ResourceReference ref = ResourceReference.of(target.getAbsolutePath()); indexCheckpointManagerProvider.get(ref).setLastComponentId(mostRecentComponentId.getMaxId()); } else if (operation.getIOOpertionType() != LSMIOOperationType.FLUSH) { throw new IllegalStateException("Unexpected IO operation: " + operation.getIOOpertionType()); } }