protected void doCrash(final ServerName serverName) { this.master.getServerManager().moveFromOnlineToDeadServers(serverName); this.am.submitServerCrash(serverName, false/* No WALs here */); // add a new server to avoid killing all the region servers which may hang the UTs ServerName newSn = ServerName.valueOf("localhost", 10000 + newRsAdded, 1); newRsAdded++; try { this.master.getServerManager().regionServerReport(newSn, ServerMetricsBuilder.of(newSn)); } catch (YouAreDeadException e) { // should not happen throw new UncheckedIOException(e); } }
@Override public ExecuteProceduresResponse sendRequest(ServerName server, ExecuteProceduresRequest req) throws IOException { // SocketTimeoutException should be a temporary problem // unless the server will be declared dead. if (sockTimeoutRetries++ < maxSocketTimeoutRetries) { if (sockTimeoutRetries == 1) { assertNotEquals(lastServer, server); } lastServer = server; LOG.debug("Socket timeout for server=" + server + " retries=" + sockTimeoutRetries); throw new SocketTimeoutException("simulate socket timeout"); } else if (serverRetries++ < maxServerRetries) { LOG.info("Mark server=" + server + " as dead. serverRetries=" + serverRetries); master.getServerManager().moveFromOnlineToDeadServers(server); sockTimeoutRetries = 0; throw new SocketTimeoutException("simulate socket timeout"); } else { return super.sendRequest(server, req); } } }
@Override public ExecuteProceduresResponse sendRequest(ServerName server, ExecuteProceduresRequest req) throws IOException { // SocketTimeoutException should be a temporary problem // unless the server will be declared dead. if (sockTimeoutRetries++ < maxSocketTimeoutRetries) { if (sockTimeoutRetries == 1) assertNotEquals(lastServer, server); lastServer = server; LOG.debug("Socket timeout for server=" + server + " retries=" + sockTimeoutRetries); throw new SocketTimeoutException("simulate socket timeout"); } else if (serverRetries++ < maxServerRetries) { LOG.info("Mark server=" + server + " as dead. serverRetries=" + serverRetries); master.getServerManager().moveFromOnlineToDeadServers(server); sockTimeoutRetries = 0; throw new SocketTimeoutException("simulate socket timeout"); } else { return super.sendRequest(server, req); } } }