@Override public void setFailure(Throwable failure) { ioOp.setFailure(failure); }
@SuppressWarnings("squid:S1181") @Override public void add(ITupleReference tuple) throws HyracksDataException { try { componentBulkLoader.add(tuple); } catch (Throwable th) { opCtx.getIoOperation().setFailure(th); throw th; } }
@SuppressWarnings("squid:S1181") public void delete(ITupleReference tuple) throws HyracksDataException { try { componentBulkLoader.delete(tuple); } catch (Throwable th) { opCtx.getIoOperation().setFailure(th); throw th; } }
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); } } }
@SuppressWarnings("squid:S1181") @Override @CriticalPath public void delete(ITupleReference tuple) throws HyracksDataException { try { ITupleReference t = tuple; final int bulkloadersCount = bulkloaderChain.size(); for (int i = 0; i < bulkloadersCount; i++) { t = bulkloaderChain.get(i).delete(t); } } catch (Throwable e) { operation.setFailure(e); cleanupArtifacts(); throw e; } if (isEmptyComponent) { isEmptyComponent = false; } }
@SuppressWarnings("squid:S1181") @Override @CriticalPath public void add(ITupleReference tuple) throws HyracksDataException { try { ITupleReference t = tuple; final int bulkloadersCount = bulkloaderChain.size(); for (int i = 0; i < bulkloadersCount; i++) { t = bulkloaderChain.get(i).add(t); } } catch (Throwable e) { operation.setFailure(e); cleanupArtifacts(); throw e; } if (isEmptyComponent) { isEmptyComponent = false; } }
private void fail(Throwable th) { if (!failed) { failed = true; final ILSMIOOperation loadOp = opCtx.getIoOperation(); loadOp.setFailure(th); loadOp.cleanup(lsmIndex.getBufferCache()); } } }
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()); } }
@SuppressWarnings("squid:S1181") @Override public void addBulkLoadedComponent(ILSMIOOperation ioOperation) throws HyracksDataException { ILSMDiskComponent c = ioOperation.getNewComponent(); try { c.markAsValid(lsmIndex.isDurable(), ioOperation); } catch (Throwable th) { ioOperation.setFailure(th); } if (ioOperation.hasFailed()) { throw HyracksDataException.create(ioOperation.getFailure()); } synchronized (opTracker) { lsmIndex.addDiskComponent(c); if (replicationEnabled) { componentsToBeReplicated.clear(); componentsToBeReplicated.add(c); triggerReplication(componentsToBeReplicated, LSMOperationType.LOAD); } mergePolicy.diskComponentAdded(lsmIndex, false); } }
@SuppressWarnings("squid:S1181") @Override public void addBulkLoadedComponent(ILSMIOOperation ioOperation) throws HyracksDataException { ILSMDiskComponent c = ioOperation.getNewComponent(); try { c.markAsValid(lsmIndex.isDurable(), ioOperation); } catch (Throwable th) { ioOperation.setFailure(th); } if (ioOperation.hasFailed()) { throw HyracksDataException.create(ioOperation.getFailure()); } synchronized (opTracker) { lsmIndex.addDiskComponent(c); if (replicationEnabled) { componentsToBeReplicated.clear(); componentsToBeReplicated.add(c); triggerReplication(componentsToBeReplicated, LSMOperationType.LOAD); } // Enter the component enterComponent(c); mergePolicy.diskComponentAdded(lsmIndex, false); } }
operation.setFailure(e); if (LOGGER.isErrorEnabled()) { LOGGER.log(Level.ERROR, "{} operation failed on {}", operation.getIOOpertionType(), lsmIndex, e); } catch (Throwable th) {// NOSONAR Must catch all operation.setStatus(LSMIOOperationStatus.FAILURE); operation.setFailure(th); if (LOGGER.isErrorEnabled()) { LOGGER.log(Level.ERROR, "{} operation.afterFinalize failed on {}", operation.getIOOpertionType(),