@Override protected void handleException(Throwable t) { if (t instanceof InterruptedIOException || t instanceof InterruptedException) { LOG.error("Caught throwable while processing event " + eventType, t); } else if (t instanceof RuntimeException) { server.abort("ServerAborting because a runtime exception was thrown", t); } else { // something fishy since we cannot flush the primary region until all retries (retries from // rpc times 35 trigger). We cannot close the region since there is no such mechanism to // close a region without master triggering it. We just abort the server for now. server.abort("ServerAborting because an exception was thrown", t); } }
/** * Event exception handler, may be overridden * @param t Throwable object */ protected void handleException(Throwable t) { String msg = "Caught throwable while processing event " + eventType; LOG.error(msg, t); if (server != null && (t instanceof Error || t instanceof RuntimeException)) { server.abort(msg, t); } } }
private void abortWhenFail(ReplicationQueueOperation op) { try { op.exec(); } catch (ReplicationException e) { server.abort("Failed to operate on replication queue", e); } }
private void abortAndThrowIOExceptionWhenFail(ReplicationQueueOperation op) throws IOException { try { op.exec(); } catch (ReplicationException e) { server.abort("Failed to operate on replication queue", e); throw new IOException(e); } }
private void abort(String reason, Throwable cause) { // close all WALs before calling abort on RS. // This is because AsyncFSWAL replies on us for rolling a new writer to make progress, and if we // failed, AsyncFSWAL may be stuck, so we need to close it to let the upper layer know that it // is already broken. for (WAL wal : walNeedsRoll.keySet()) { // shutdown rather than close here since we are going to abort the RS and the wals need to be // split when recovery try { wal.shutdown(); } catch (IOException e) { LOG.warn("Failed to shutdown wal", e); } } server.abort(reason, cause); }
protected final void uncaughtException(Thread t, Throwable e) { RSRpcServices.exitIfOOME(e); LOG.error("Unexpected exception in " + t.getName() + " currentPath=" + getCurrentPath(), e); server.abort("Unexpected exception in " + t.getName(), e); }
private void adoptAbandonedQueues() { List<ServerName> currentReplicators = null; try { currentReplicators = queueStorage.getListOfReplicators(); } catch (ReplicationException e) { server.abort("Failed to get all replicators", e); return; } if (currentReplicators == null || currentReplicators.isEmpty()) { return; } List<ServerName> otherRegionServers = replicationTracker.getListOfRegionServers().stream() .map(ServerName::valueOf).collect(Collectors.toList()); LOG.info( "Current list of replicators: " + currentReplicators + " other RSs: " + otherRegionServers); // Look if there's anything to process after a restart for (ServerName rs : currentReplicators) { if (!otherRegionServers.contains(rs)) { transferQueues(rs); } } }
master.abort("Received an unexpected KeeperException, aborting", ke);
@Override public boolean evaluate() throws Exception { try { verify(server, times(1)).abort(anyString(), (Throwable) anyObject()); return true; } catch (Throwable t) { return false; } } });
/** * Refresh replication source will terminate the old source first, then the source thread will be * interrupted. Need to handle it instead of abort the region server. */ private void interruptOrAbortWhenFail(ReplicationQueueOperation op) { try { op.exec(); } catch (ReplicationException e) { if (e.getCause() != null && e.getCause() instanceof KeeperException.SystemErrorException && e.getCause().getCause() != null && e.getCause() .getCause() instanceof InterruptedException) { throw new RuntimeException( "Thread is interrupted, the replication source may be terminated"); } server.abort("Failed to operate on replication queue", e); } }
@Override public void run() { try { this.services.postOpenDeployTasks(new PostOpenDeployContext(region, masterSystemTime)); } catch (Throwable e) { String msg = "Exception running postOpenDeployTasks; region=" + this.region.getRegionInfo().getEncodedName(); this.exception = e; if (e instanceof IOException && isRegionStillOpening(region.getRegionInfo(), services)) { server.abort(msg, e); } else { LOG.warn(msg, e); } } // We're done. Set flag then wake up anyone waiting on thread to complete. this.signaller.set(true); synchronized (this.signaller) { this.signaller.notify(); } }
private void watchAndCheckExists(String node) { try { if (ZKUtil.watchAndCheckExists(watcher, node)) { byte[] data = ZKUtil.getDataAndWatch(watcher, node); if (data != null) { // put the data into queue upsertQueue(node, data); } else { // It existed but now does not, should has been tracked by our watcher, ignore LOG.debug("Found no data from " + node); watchAndCheckExists(node); } } else { // cleanup stale ZNodes on client ZK to avoid invalid requests to server ZKUtil.deleteNodeFailSilent(clientZkWatcher, node); } } catch (KeeperException e) { server.abort("Unexpected exception during initialization, aborting", e); } }
server.abort("Unrecoverable exception while closing region " + regionInfo.getRegionNameAsString() + ", still finishing close", ioe); throw new RuntimeException(ioe);
" If so, increase it for both client and server side." + e), deadRS, queueStorage.getRsNode(deadRS)); server.abort("Failed to claim queue from dead regionserver.", e); return;
@Override public void run() { try { logZnodesMap = new HashMap<>(); List<String> queues = rq.getAllQueues(deadRS); for (String queue : queues) { Pair<String, SortedSet<String>> pair = rq.claimQueue(deadRS, queue, server.getServerName()); if (pair != null) { logZnodesMap.put(pair.getFirst(), pair.getSecond()); } } server.abort("Done with testing", null); } catch (Exception e) { LOG.error("Got exception while running NodeFailoverWorker", e); } finally { latch.countDown(); } }
startupStatus.setStatus(msg); } catch (KeeperException ke) { master.abort("Received an unexpected KeeperException, aborting", ke); return false;
+ w3.isLogZnodesMapPopulated(); assertEquals(1, populatedMap); server.abort("", null);
protected void abortServer(final String service, final Server server, final CoprocessorEnvironment environment, final Throwable e) { String coprocessorName = (environment.getInstance()).toString(); server.abort("Aborting service: " + service + " running on : " + server.getServerName() + " because coprocessor: " + coprocessorName + " threw an exception.", e); }
@Override public boolean evaluate() throws Exception { try { verify(server, times(1)).abort(anyString(), (Throwable) anyObject()); return true; } catch (Throwable t) { return false; } } });