private void completeWhenError(boolean closeScanner) { incRPCRetriesMetrics(scanMetrics, closeScanner); resultCache.clear(); if (closeScanner) { closeScanner(); } if (nextStartRowWhenError != null) { scan.withStartRow(nextStartRowWhenError, includeNextStartRowWhenError); } future.complete(true); }
private CompletableFuture<OpenScannerResponse> callOpenScanner(HBaseRpcController controller, HRegionLocation loc, ClientService.Interface stub) { boolean isRegionServerRemote = isRemote(loc.getHostname()); incRPCCallsMetrics(scanMetrics, isRegionServerRemote); if (openScannerTries.getAndIncrement() > 1) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } CompletableFuture<OpenScannerResponse> future = new CompletableFuture<>(); try { ScanRequest request = RequestConverter.buildScanRequest(loc.getRegion().getRegionName(), scan, scan.getCaching(), false); stub.scan(controller, request, resp -> { if (controller.failed()) { future.completeExceptionally(controller.getFailed()); return; } future.complete(new OpenScannerResponse(loc, isRegionServerRemote, stub, controller, resp)); }); } catch (IOException e) { future.completeExceptionally(e); } return future; }
private void call() { // As we have a call sequence for scan, it is useless to have a different rpc timeout which is // less than the scan timeout. If the server does not respond in time(usually this will not // happen as we have heartbeat now), we will get an OutOfOrderScannerNextException when // resending the next request and the only way to fix this is to close the scanner and open a // new one. long callTimeoutNs; if (scanTimeoutNs > 0) { long remainingNs = scanTimeoutNs - (System.nanoTime() - nextCallStartNs); if (remainingNs <= 0) { completeExceptionally(true); return; } callTimeoutNs = remainingNs; } else { callTimeoutNs = 0L; } incRPCCallsMetrics(scanMetrics, regionServerRemote); if (tries > 1) { incRPCRetriesMetrics(scanMetrics, regionServerRemote); } resetController(controller, callTimeoutNs); ScanRequest req = RequestConverter.buildScanRequest(scannerId, scan.getCaching(), false, nextCallSeq, false, false, scan.getLimit()); stub.scan(controller, req, resp -> onComplete(controller, resp)); }
/** * @param reload force reload of server location * @throws IOException */ @Override public void prepare(boolean reload) throws IOException { if (Thread.interrupted()) { throw new InterruptedIOException(); } RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), getRow()); location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { // With this exception, there will be a retry. The location can be null for a replica // when the table is created or after a split. throw new HBaseIOException("There is no location for replica id #" + id); } ServerName dest = location.getServerName(); setStub(super.getConnection().getClient(dest)); if (!instantiated || reload) { checkIfRegionServerIsRemote(); instantiated = true; } cursor = null; // check how often we retry. if (reload) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } }
incRPCRetriesMetrics(scanMetrics, isRegionServerRemote);
private void completeWhenError(boolean closeScanner) { incRPCRetriesMetrics(scanMetrics, closeScanner); resultCache.clear(); if (closeScanner) { closeScanner(); } if (nextStartRowWhenError != null) { scan.withStartRow(nextStartRowWhenError, includeNextStartRowWhenError); } future.complete(true); }
private CompletableFuture<OpenScannerResponse> callOpenScanner(HBaseRpcController controller, HRegionLocation loc, ClientService.Interface stub) { boolean isRegionServerRemote = isRemote(loc.getHostname()); incRPCCallsMetrics(scanMetrics, isRegionServerRemote); if (openScannerTries > 1) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } openScannerTries++; CompletableFuture<OpenScannerResponse> future = new CompletableFuture<>(); try { ScanRequest request = RequestConverter.buildScanRequest(loc.getRegionInfo().getRegionName(), scan, scan.getCaching(), false); stub.scan(controller, request, resp -> { if (controller.failed()) { future.completeExceptionally(controller.getFailed()); return; } future.complete(new OpenScannerResponse(loc, isRegionServerRemote, stub, controller, resp)); }); } catch (IOException e) { future.completeExceptionally(e); } return future; }
private void call() { // As we have a call sequence for scan, it is useless to have a different rpc timeout which is // less than the scan timeout. If the server does not respond in time(usually this will not // happen as we have heartbeat now), we will get an OutOfOrderScannerNextException when // resending the next request and the only way to fix this is to close the scanner and open a // new one. long callTimeoutNs; if (scanTimeoutNs > 0) { long remainingNs = scanTimeoutNs - (System.nanoTime() - nextCallStartNs); if (remainingNs <= 0) { completeExceptionally(true); return; } callTimeoutNs = remainingNs; } else { callTimeoutNs = 0L; } incRPCCallsMetrics(scanMetrics, regionServerRemote); if (tries > 1) { incRPCRetriesMetrics(scanMetrics, regionServerRemote); } resetController(controller, callTimeoutNs); ScanRequest req = RequestConverter.buildScanRequest(scannerId, scan.getCaching(), false, nextCallSeq, false, false, scan.getLimit()); stub.scan(controller, req, resp -> onComplete(controller, resp)); }
/** * @param reload force reload of server location * @throws IOException */ @Override public void prepare(boolean reload) throws IOException { if (Thread.interrupted()) { throw new InterruptedIOException(); } RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), getRow()); location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { // With this exception, there will be a retry. The location can be null for a replica // when the table is created or after a split. throw new HBaseIOException("There is no location for replica id #" + id); } ServerName dest = location.getServerName(); setStub(super.getConnection().getClient(dest)); if (!instantiated || reload) { checkIfRegionServerIsRemote(); instantiated = true; } cursor = null; // check how often we retry. if (reload) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } }
incRPCRetriesMetrics(scanMetrics, isRegionServerRemote);
private void completeWhenError(boolean closeScanner) { incRPCRetriesMetrics(scanMetrics, closeScanner); resultCache.clear(); if (closeScanner) { closeScanner(); } if (nextStartRowWhenError != null) { scan.withStartRow(nextStartRowWhenError, includeNextStartRowWhenError); } future.complete(true); }
private CompletableFuture<OpenScannerResponse> callOpenScanner(HBaseRpcController controller, HRegionLocation loc, ClientService.Interface stub) { boolean isRegionServerRemote = isRemote(loc.getHostname()); incRPCCallsMetrics(scanMetrics, isRegionServerRemote); if (openScannerTries > 1) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } openScannerTries++; CompletableFuture<OpenScannerResponse> future = new CompletableFuture<>(); try { ScanRequest request = RequestConverter.buildScanRequest(loc.getRegionInfo().getRegionName(), scan, scan.getCaching(), false); stub.scan(controller, request, resp -> { if (controller.failed()) { future.completeExceptionally(controller.getFailed()); return; } future.complete(new OpenScannerResponse(loc, isRegionServerRemote, stub, controller, resp)); }); } catch (IOException e) { future.completeExceptionally(e); } return future; }
private void call() { // As we have a call sequence for scan, it is useless to have a different rpc timeout which is // less than the scan timeout. If the server does not respond in time(usually this will not // happen as we have heartbeat now), we will get an OutOfOrderScannerNextException when // resending the next request and the only way to fix this is to close the scanner and open a // new one. long callTimeoutNs; if (scanTimeoutNs > 0) { long remainingNs = scanTimeoutNs - (System.nanoTime() - nextCallStartNs); if (remainingNs <= 0) { completeExceptionally(true); return; } callTimeoutNs = remainingNs; } else { callTimeoutNs = 0L; } incRPCCallsMetrics(scanMetrics, regionServerRemote); if (tries > 1) { incRPCRetriesMetrics(scanMetrics, regionServerRemote); } resetController(controller, callTimeoutNs); ScanRequest req = RequestConverter.buildScanRequest(scannerId, scan.getCaching(), false, nextCallSeq, false, false, scan.getLimit()); stub.scan(controller, req, resp -> onComplete(controller, resp)); }
/** * @param reload force reload of server location * @throws IOException */ @Override public void prepare(boolean reload) throws IOException { if (Thread.interrupted()) { throw new InterruptedIOException(); } RegionLocations rl = RpcRetryingCallerWithReadReplicas.getRegionLocations(!reload, id, getConnection(), getTableName(), getRow()); location = id < rl.size() ? rl.getRegionLocation(id) : null; if (location == null || location.getServerName() == null) { // With this exception, there will be a retry. The location can be null for a replica // when the table is created or after a split. throw new HBaseIOException("There is no location for replica id #" + id); } ServerName dest = location.getServerName(); setStub(super.getConnection().getClient(dest)); if (!instantiated || reload) { checkIfRegionServerIsRemote(); instantiated = true; } cursor = null; // check how often we retry. if (reload) { incRPCRetriesMetrics(scanMetrics, isRegionServerRemote); } }
incRPCRetriesMetrics(scanMetrics, isRegionServerRemote);