static ScanResponse doMetaScanResponse(final SortedMap<byte [], Pair<HRegionInfo, ServerName>> meta, final AtomicLong sequenceids, final ScanRequest request) { ScanResponse.Builder builder = ScanResponse.newBuilder(); int max = request.getNumberOfRows(); int count = 0; Map<byte [], Pair<HRegionInfo, ServerName>> tail = request.hasScan()? meta.tailMap(request.getScan().getStartRow().toByteArray()): meta; ClientProtos.Result.Builder resultBuilder = ClientProtos.Result.newBuilder(); for (Map.Entry<byte [], Pair<HRegionInfo, ServerName>> e: tail.entrySet()) { // Can be 0 on open of a scanner -- i.e. rpc to setup scannerid only. if (max <= 0) break; if (++count > max) break; HRegionInfo hri = e.getValue().getFirst(); ByteString row = UnsafeByteOperations.unsafeWrap(hri.getRegionName()); resultBuilder.clear(); resultBuilder.addCell(getRegionInfo(row, hri)); resultBuilder.addCell(getServer(row, e.getValue().getSecond())); resultBuilder.addCell(getStartCode(row)); builder.addResults(resultBuilder.build()); // Set more to false if we are on the last region in table. if (hri.getEndKey().length <= 0) builder.setMoreResults(false); else builder.setMoreResults(true); } // If no scannerid, set one. builder.setScannerId(request.hasScannerId()? request.getScannerId(): sequenceids.incrementAndGet()); return builder.build(); }
rejectIfInStandByState(region); ClientProtos.Scan protoScan = request.getScan(); boolean isLoadingCfsOnDemandSet = protoScan.hasLoadColumnFamiliesOnDemand(); Scan scan = ProtobufUtil.toScan(protoScan);
final Scan scan) throws IOException { ClientProtos.Scan.Builder scanBuilder = ClientProtos.Scan.newBuilder(); scanBuilder.setCacheBlocks(scan.getCacheBlocks()); if (scan.getBatch() > 0) {
final Scan scan) throws IOException { ClientProtos.Scan.Builder scanBuilder = ClientProtos.Scan.newBuilder(); scanBuilder.setCacheBlocks(scan.getCacheBlocks()); if (scan.getBatch() > 0) {
boolean includeStartRow = true; boolean includeStopRow = false; if (proto.hasStartRow()) { startRow = proto.getStartRow().toByteArray(); if (proto.hasStopRow()) { stopRow = proto.getStopRow().toByteArray(); if (proto.hasIncludeStartRow()) { includeStartRow = proto.getIncludeStartRow(); if (proto.hasIncludeStopRow()) { includeStopRow = proto.getIncludeStopRow(); } else { if (proto.hasCacheBlocks()) { scan.setCacheBlocks(proto.getCacheBlocks()); if (proto.hasMaxVersions()) { scan.setMaxVersions(proto.getMaxVersions()); if (proto.hasStoreLimit()) { scan.setMaxResultsPerColumnFamily(proto.getStoreLimit()); if (proto.hasStoreOffset()) { scan.setRowOffsetPerColumnFamily(proto.getStoreOffset()); if (proto.hasLoadColumnFamiliesOnDemand()) { scan.setLoadColumnFamiliesOnDemand(proto.getLoadColumnFamiliesOnDemand());
final Scan scan) throws IOException { ClientProtos.Scan.Builder scanBuilder = ClientProtos.Scan.newBuilder(); scanBuilder.setCacheBlocks(scan.getCacheBlocks()); if (scan.getBatch() > 0) {
boolean includeStartRow = true; boolean includeStopRow = false; if (proto.hasStartRow()) { startRow = proto.getStartRow().toByteArray(); if (proto.hasStopRow()) { stopRow = proto.getStopRow().toByteArray(); if (proto.hasIncludeStartRow()) { includeStartRow = proto.getIncludeStartRow(); if (proto.hasIncludeStopRow()) { includeStopRow = proto.getIncludeStopRow(); } else { if (proto.hasCacheBlocks()) { scan.setCacheBlocks(proto.getCacheBlocks()); if (proto.hasMaxVersions()) { scan.setMaxVersions(proto.getMaxVersions()); if (proto.hasStoreLimit()) { scan.setMaxResultsPerColumnFamily(proto.getStoreLimit()); if (proto.hasStoreOffset()) { scan.setRowOffsetPerColumnFamily(proto.getStoreOffset()); if (proto.hasLoadColumnFamiliesOnDemand()) { scan.setLoadColumnFamiliesOnDemand(proto.getLoadColumnFamiliesOnDemand());
ClientProtos.Scan.Builder scanBuilder = ClientProtos.Scan.newBuilder(); scanBuilder.setStartRow(ByteString.copyFromUtf8("row1")); scanBuilder.setStopRow(ByteString.copyFromUtf8("row2")); assertEquals(1, proto.getMaxVersions()); assertEquals(true, proto.getCacheBlocks()); scanBuilder = ClientProtos.Scan.newBuilder(proto); scanBuilder.setMaxVersions(2); scanBuilder.setCacheBlocks(false);
static ScanResponse doMetaScanResponse(final SortedMap<byte [], Pair<HRegionInfo, ServerName>> meta, final AtomicLong sequenceids, final ScanRequest request) { ScanResponse.Builder builder = ScanResponse.newBuilder(); int max = request.getNumberOfRows(); int count = 0; Map<byte [], Pair<HRegionInfo, ServerName>> tail = request.hasScan()? meta.tailMap(request.getScan().getStartRow().toByteArray()): meta; ClientProtos.Result.Builder resultBuilder = ClientProtos.Result.newBuilder(); for (Map.Entry<byte [], Pair<HRegionInfo, ServerName>> e: tail.entrySet()) { // Can be 0 on open of a scanner -- i.e. rpc to setup scannerid only. if (max <= 0) break; if (++count > max) break; HRegionInfo hri = e.getValue().getFirst(); ByteString row = UnsafeByteOperations.unsafeWrap(hri.getRegionName()); resultBuilder.clear(); resultBuilder.addCell(getRegionInfo(row, hri)); resultBuilder.addCell(getServer(row, e.getValue().getSecond())); resultBuilder.addCell(getStartCode(row)); builder.addResults(resultBuilder.build()); // Set more to false if we are on the last region in table. if (hri.getEndKey().length <= 0) builder.setMoreResults(false); else builder.setMoreResults(true); } // If no scannerid, set one. builder.setScannerId(request.hasScannerId()? request.getScannerId(): sequenceids.incrementAndGet()); return builder.build(); }
boolean includeStartRow = true; boolean includeStopRow = false; if (proto.hasStartRow()) { startRow = proto.getStartRow().toByteArray(); if (proto.hasStopRow()) { stopRow = proto.getStopRow().toByteArray(); if (proto.hasIncludeStartRow()) { includeStartRow = proto.getIncludeStartRow(); if (proto.hasIncludeStopRow()) { includeStopRow = proto.getIncludeStopRow(); } else { if (proto.hasCacheBlocks()) { scan.setCacheBlocks(proto.getCacheBlocks()); if (proto.hasMaxVersions()) { scan.setMaxVersions(proto.getMaxVersions()); if (proto.hasStoreLimit()) { scan.setMaxResultsPerColumnFamily(proto.getStoreLimit()); if (proto.hasStoreOffset()) { scan.setRowOffsetPerColumnFamily(proto.getStoreOffset()); if (proto.hasLoadColumnFamiliesOnDemand()) { scan.setLoadColumnFamiliesOnDemand(proto.getLoadColumnFamiliesOnDemand());
ClientProtos.Scan.Builder scanBuilder = ClientProtos.Scan.newBuilder(); scanBuilder.setStartRow(ByteString.copyFromUtf8("row1")); scanBuilder.setStopRow(ByteString.copyFromUtf8("row2")); assertEquals(1, proto.getMaxVersions()); assertEquals(true, proto.getCacheBlocks()); scanBuilder = ClientProtos.Scan.newBuilder(proto); scanBuilder.setMaxVersions(2); scanBuilder.setCacheBlocks(false);