@Override public void setStatus(LSMIOOperationStatus status) { ioOp.setStatus(status); }
@Override public void abort() throws HyracksDataException { operation.setStatus(LSMIOOperationStatus.FAILURE); final int bulkloadersCount = bulkloaderChain.size(); for (int i = 0; i < bulkloadersCount; i++) { bulkloaderChain.get(i).abort(); } }
private void before(ILSMIOOperation operation) throws InterruptedException { String id = operation.getIndexIdentifier(); if (operation.getIOOpertionType() == LSMIOOperationType.FLUSH) { synchronized (runningFlushOperations) { while (true) { if (failedGroups.containsKey(id)) { operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(new RuntimeException("Operation group " + id + " has permanently failed", failedGroups.get(id))); return; } if (runningFlushOperations.containsKey(id)) { runningFlushOperations.wait(); } else { runningFlushOperations.put(id, operation); break; } } } } } }
private void scheduleFlush(ILSMIOOperation operation) { String id = operation.getIndexIdentifier(); synchronized (executor) { if (failedGroups.containsKey(id)) { // Group failure. Fail the operation right away operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(new RuntimeException("Operation group " + id + " has permanently failed", failedGroups.get(id))); operation.complete(); return; } if (runningFlushOperations.containsKey(id)) { if (waitingFlushOperations.containsKey(id)) { waitingFlushOperations.get(id).offer(operation); } else { Deque<ILSMIOOperation> q = new ArrayDeque<>(); q.offer(operation); waitingFlushOperations.put(id, q); } } else { runningFlushOperations.put(id, operation); executor.submit(operation); } } }
private void fail(ILSMIOOperation executedOp, Throwable t) throws HyracksDataException { callback.operationFailed(executedOp, t); if (executedOp.getIOOpertionType() == LSMIOOperationType.FLUSH) { executedOp.complete(); // Doesn't make sense to process further flush requests... Mark the operation group permanently failed // Fail other scheduled operations synchronized (this) { String id = executedOp.getIndexIdentifier(); failedGroups.put(id, t); runningFlushOperations.remove(id); if (waitingFlushOperations.containsKey(id)) { Deque<ILSMIOOperation> ops = waitingFlushOperations.remove(id); ILSMIOOperation next = ops.poll(); while (next != null) { next.setFailure(new RuntimeException("Operation group " + id + " has permanently failed", t)); next.setStatus(LSMIOOperationStatus.FAILURE); next.complete(); next = ops.poll(); } } } } } }
private void run(ILSMIOOperation operation) { try { operation.call(); } catch (Throwable th) { // NOSONAR Must catch all LOGGER.log(Level.ERROR, "IO Operation failed", th); operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(th); } if (operation.getStatus() == LSMIOOperationStatus.FAILURE) { failureCallback.operationFailed(operation, operation.getFailure()); } }
@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()); } }
operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(e); if (LOGGER.isErrorEnabled()) { operation.getCallback().afterFinalize(operation); } catch (Throwable th) {// NOSONAR Must catch all operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(th); if (LOGGER.isErrorEnabled()) {