Refine search
@Override public void notifyFinal(ReturnCode code, HRegionLocation loc, long heapSizeOfRow) { if (code == ReturnCode.INCLUDE) { regionsIncluded.add(loc.getRegionInfo()); serversIncluded.add(loc.getServerName()); } busyRegions.add(loc.getRegionInfo().getRegionName()); } }
private CompletableFuture<Message> rpcCall(MethodDescriptor method, Message request, Message responsePrototype, HBaseRpcController controller, HRegionLocation loc, ClientService.Interface stub) { CompletableFuture<Message> future = new CompletableFuture<>(); if (region != null && !Bytes.equals(loc.getRegionInfo().getRegionName(), region.getRegionName())) { future.completeExceptionally(new DoNotRetryIOException( "Region name is changed, expected " + region.getRegionNameAsString() + ", actual " + loc.getRegionInfo().getRegionNameAsString())); return future; } CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request, row, loc.getRegionInfo().getRegionName()); stub.execService(controller, csr, new org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<CoprocessorServiceResponse>() { @Override public void run(CoprocessorServiceResponse resp) { if (controller.failed()) { future.completeExceptionally(controller.getFailed()); } else { try { future.complete(CoprocessorRpcUtils.getResponse(resp, responsePrototype)); } catch (IOException e) { future.completeExceptionally(e); } } } }); return future; }
@Override public void throwable(Throwable t, boolean retrying) { if (location != null) { connection.updateCachedLocations(tableName, location.getRegionInfo().getRegionName(), row, t, location.getServerName()); } }
HRegionInfo info = region.getRegionInfo(); LOG.info("Region info is "+info.getRegionNameAsString()); assertTrue(results.containsKey(info.getRegionName())); assertNull(results.get(info.getRegionName()));
public static <T> T updateStats(T r, ServerStatisticTracker stats, HRegionLocation regionLocation) { byte[] regionName = null; ServerName server = null; if (regionLocation != null) { server = regionLocation.getServerName(); regionName = regionLocation.getRegionInfo().getRegionName(); } return updateStats(r, stats, server, regionName); } }
public ReturnCode canTakeOperation(HRegionLocation loc, long heapSizeOfRow) { HRegionInfo regionInfo = loc.getRegionInfo(); if (regionsIncluded.contains(regionInfo)) { AtomicInteger regionCnt = taskCounterPerRegion.get(loc.getRegionInfo().getRegionName()); if (regionCnt != null && regionCnt.get() >= maxConcurrentTasksPerRegion) {
@Override public void throwable(Throwable t, boolean retrying) { if (location != null) { getConnection().updateCachedLocations(tableName, location.getRegionInfo().getRegionName(), row, t, location.getServerName()); } }
@Override protected Void rpcCall() throws Exception { MutateRequest request = RequestConverter .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), delete); doMutate(request); return null; } };
@Override protected Void rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest(getLocation().getRegionInfo().getRegionName(), put); doMutate(request); return null; } };
@Override protected Boolean rpcCall() throws Exception { CompareType compareType = CompareType.valueOf(opName); MutateRequest request = RequestConverter.buildMutateRequest( getLocation().getRegionInfo().getRegionName(), row, family, qualifier, new BinaryComparator(value), compareType, timeRange, put); MutateResponse response = doMutate(request); return Boolean.valueOf(response.getProcessed()); } };
@Override protected CoprocessorServiceResponse rpcCall() throws Exception { byte [] regionName = getLocation().getRegionInfo().getRegionName(); CoprocessorServiceRequest csr = CoprocessorRpcUtils.getCoprocessorServiceRequest(method, request, row, regionName); return getStub().execService(getRpcController(), csr); } };
@Override protected Long rpcCall() throws Exception { MutateRequest request = RequestConverter.buildIncrementRequest( getLocation().getRegionInfo().getRegionName(), row, family, qualifier, amount, durability, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); Result result = ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); return Long.valueOf(Bytes.toLong(result.getValue(family, qualifier))); } };
/** * Closes the region containing the given row. * * @param row The row to find the containing region. * @param table The table to find the region. * @throws IOException */ public void unassignRegionByRow(byte[] row, RegionLocator table) throws IOException { HRegionLocation hrl = table.getRegionLocation(row); unassignRegion(hrl.getRegionInfo().getRegionName()); }
@Override protected Result rpcCall() throws Exception { ClientProtos.GetRequest request = RequestConverter.buildGetRequest( getLocation().getRegionInfo().getRegionName(), configuredGet); ClientProtos.GetResponse response = doGet(request); return response == null? null: ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); } };
@Override protected FlushRegionResponse call(HBaseRpcController controller) throws Exception { // Check whether we should still do the flush to this region. If the regions are changed due // to splits or merges, etc return success if (!Bytes.equals(location.getRegionInfo().getRegionName(), regionName)) { if (!reload) { throw new IOException("Cached location seems to be different than requested region."); } LOG.info("Skipping flush region, because the located region " + Bytes.toStringBinary(location.getRegionInfo().getRegionName()) + " is different than " + " requested region " + Bytes.toStringBinary(regionName)); return FlushRegionResponse.newBuilder() .setLastFlushTime(EnvironmentEdgeManager.currentTime()) .setFlushed(false) .setWroteFlushWalMarker(false) .build(); } FlushRegionRequest request = RequestConverter.buildFlushRegionRequest(regionName, writeFlushWalMarker); return stub.flushRegion(controller, request); } }
@Override protected SingleResponse rpcCall() throws Exception { CompareType compareType = CompareType.valueOf(opName); MutateRequest request = RequestConverter .buildMutateRequest(getLocation().getRegionInfo().getRegionName(), row, family, qualifier, new BinaryComparator(value), compareType, timeRange, delete); MutateResponse response = doMutate(request); return ResponseConverter.getResult(request, response, getRpcControllerCellScanner()); } };
@Override protected Void rpcCall() throws Exception { byte[] regionName = getLocation().getRegionInfo().getRegionName(); RegionSpecifier region = RequestConverter.buildRegionSpecifier( RegionSpecifierType.REGION_NAME, regionName); CleanupBulkLoadRequest request = CleanupBulkLoadRequest.newBuilder().setRegion(region).setBulkToken(bulkToken).build(); getStub().cleanupBulkLoad(null, request); return null; } };
private void verifyRegionResults(RegionLocator regionLocator, Map<byte[], String> results, String expected, byte[] row) throws Exception { for (Map.Entry<byte [], String> e: results.entrySet()) { LOG.info("row=" + Bytes.toString(row) + ", expected=" + expected + ", result key=" + Bytes.toString(e.getKey()) + ", value=" + e.getValue()); } HRegionLocation loc = regionLocator.getRegionLocation(row, true); byte[] region = loc.getRegionInfo().getRegionName(); assertTrue("Results should contain region " + Bytes.toStringBinary(region) + " for row '" + Bytes.toStringBinary(row)+ "'", results.containsKey(region)); assertEquals("Invalid result for row '"+Bytes.toStringBinary(row)+"'", expected, results.get(region)); } }
@Override protected Result rpcCall() throws Exception { MutateRequest request = RequestConverter.buildMutateRequest( getLocation().getRegionInfo().getRegionName(), increment, getNonceGroup(), getNonce()); MutateResponse response = doMutate(request); // Should this check for null like append does? return ProtobufUtil.toResult(response.getResult(), getRpcControllerCellScanner()); } };
@Override protected Void rpcCall() throws Exception { LOG.info("Non-secure old client"); byte[] regionName = getLocation().getRegionInfo().getRegionName(); BulkLoadHFileRequest request = RequestConverter .buildBulkLoadHFileRequest(famPaths, regionName, true, null, null); getStub().bulkLoadHFile(null, request); return null; } };