@Override public void rethrowException() throws ForeignException { monitor.rethrowException(); }
@Override public void rethrowExceptionIfFailed() throws ForeignException { monitor.rethrowException(); }
private void rethrowException() throws ForeignException { monitor.rethrowException(); }
/** * Check if the entire procedure has globally completed, or has been aborted. * @throws ForeignException */ public boolean isCompleted() throws ForeignException { // Rethrow exception if any monitor.rethrowException(); return (completedLatch.getCount() == 0); }
private void rolllog() throws ForeignException { monitor.rethrowException(); taskManager.submitTask(new RSRollLogTask()); monitor.rethrowException(); // wait for everything to complete. taskManager.waitForOutstandingTasks(); monitor.rethrowException(); }
/** * Takes a snapshot of the mob region */ private void snapshotMobRegion(final RegionInfo regionInfo) throws IOException { snapshotManifest.addMobRegion(regionInfo); monitor.rethrowException(); status.setStatus("Completed referencing HFiles for the mob region of table: " + snapshotTable); }
/** * Take a snapshot of the specified disabled region */ protected void snapshotDisabledRegion(final RegionInfo regionInfo) throws IOException { snapshotManifest.addRegion(FSUtils.getTableDir(rootDir, snapshotTable), regionInfo); monitor.rethrowException(); status.setStatus("Completed referencing HFiles for offline region " + regionInfo.toString() + " of table: " + snapshotTable); }
private void execute() throws ForeignException { monitor.rethrowException(); // running a task (e.g., roll log, flush table) on region server taskManager.submitTask(new RSSimpleTask()); monitor.rethrowException(); // wait for everything to complete. taskManager.waitForOutstandingTasks(); monitor.rethrowException(); }
private void flushRegions() throws ForeignException { if (regions.isEmpty()) { // No regions on this RS, we are basically done. return; } monitor.rethrowException(); // assert that the taskManager is empty. if (taskManager.hasTasks()) { throw new IllegalStateException("Attempting to flush " + table + " but we currently have outstanding tasks"); } // Add all hfiles already existing in region. for (HRegion region : regions) { // submit one task per region for parallelize by region. taskManager.submitTask(new RegionFlushTask(region)); monitor.rethrowException(); } // wait for everything to complete. LOG.debug("Flush region tasks submitted for " + regions.size() + " regions"); try { taskManager.waitForOutstandingTasks(); } catch (InterruptedException e) { throw new ForeignException(getMemberName(), e); } }
monitor.rethrowException(); LOG.debug("Procedure '" + procName + "' starting 'acquire'"); sendGlobalBarrierStart(); monitor.rethrowException(); monitor.rethrowException(); LOG.info("Procedure '" + procName + "' execution completed"); } catch (Exception e) {
private void flushSnapshot() throws ForeignException { if (regions.isEmpty()) { // No regions on this RS, we are basically done. return; } monitor.rethrowException(); // assert that the taskManager is empty. if (taskManager.hasTasks()) { throw new IllegalStateException("Attempting to take snapshot " + ClientSnapshotDescriptionUtils.toString(snapshot) + " but we currently have outstanding tasks"); } // Add all hfiles already existing in region. for (HRegion region : regions) { // submit one task per region for parallelize by region. taskManager.submitTask(new RegionSnapshotTask(region, snapshot, snapshotSkipFlush, monitor)); monitor.rethrowException(); } // wait for everything to complete. LOG.debug("Flush Snapshot Tasks submitted for " + regions.size() + " regions"); try { taskManager.waitForOutstandingTasks(); } catch (InterruptedException e) { LOG.error("got interrupted exception for " + getMemberName()); throw new ForeignException(getMemberName(), e); } }
monitor.rethrowException(); status.setStatus("Restoring mob region..."); List<RegionInfo> mobRegions = new ArrayList<>(1); monitor.rethrowException(); status.setStatus("Cloning mob region..."); cloneHdfsMobRegion(regionManifests, mobRegion); monitor.rethrowException(); for (RegionInfo regionInfo: tableRegions) { String regionName = regionInfo.getEncodedName(); monitor.rethrowException(); for (String regionName: regionNames) { LOG.info("region to add: " + regionName); monitor.rethrowException(); status.setStatus("Cloning regions..."); RegionInfo[] clonedRegions = cloneHdfsRegions(exec, regionManifests, regionsToAdd); monitor.rethrowException(); status.setStatus("Restoring table regions..."); restoreHdfsRegions(exec, regionManifests, metaChanges.getRegionsToRestore()); monitor.rethrowException(); status.setStatus("Starting to delete excess regions from table"); removeHdfsRegions(exec, metaChanges.getRegionsToRemove());
monitor.receive(ee); monitor.rethrowException();
monitor.rethrowException(); if (proc == null) { String msg = "Failed to submit distributed procedure " + desc.getSignature() + " for '" monitor.receive(ee); monitor.rethrowException();
/** * Tests that a dispatcher only dispatches only the first exception, and does not propagate * subsequent exceptions. */ @Test public void testErrorPropagation() { ForeignExceptionListener listener1 = Mockito.mock(ForeignExceptionListener.class); ForeignExceptionListener listener2 = Mockito.mock(ForeignExceptionListener.class); ForeignExceptionDispatcher dispatcher = new ForeignExceptionDispatcher(); // add the listeners dispatcher.addListener(listener1); dispatcher.addListener(listener2); // create an artificial error dispatcher.receive(EXTEXN); // make sure the listeners got the error Mockito.verify(listener1, Mockito.times(1)).receive(EXTEXN); Mockito.verify(listener2, Mockito.times(1)).receive(EXTEXN); // make sure that we get an exception try { dispatcher.rethrowException(); fail("Monitor should have thrown an exception after getting error."); } catch (ForeignException ex) { assertTrue("Got an unexpected exception:" + ex, ex.getCause() == EXTEXN.getCause()); LOG.debug("Got the testing exception!"); } // push another error, which should be not be passed to listeners dispatcher.receive(EXTEXN2); Mockito.verify(listener1, Mockito.never()).receive(EXTEXN2); Mockito.verify(listener2, Mockito.never()).receive(EXTEXN2); }
monitor.rethrowException(); monitor.rethrowException();
@Override public void rethrowExceptionIfFailed() throws ForeignException { monitor.rethrowException(); } }
/** * Check if the entire procedure has globally completed, or has been aborted. * @throws ForeignException */ public boolean isCompleted() throws ForeignException { // Rethrow exception if any monitor.rethrowException(); return (completedLatch.getCount() == 0); }
private void execute() throws ForeignException { monitor.rethrowException(); // running a task (e.g., roll log, flush table) on region server taskManager.submitTask(new RSSimpleTask()); monitor.rethrowException(); // wait for everything to complete. taskManager.waitForOutstandingTasks(); monitor.rethrowException(); }
/** * Take a snapshot of the specified disabled region */ protected void snapshotDisabledRegion(final HRegionInfo regionInfo) throws IOException { snapshotManifest.addRegion(FSUtils.getTableDir(rootDir, snapshotTable), regionInfo); monitor.rethrowException(); status.setStatus("Completed referencing HFiles for offline region " + regionInfo.toString() + " of table: " + snapshotTable); }