Repository: hbase Updated Branches: refs/heads/branch-2 ec7bca176 -> 08212e50f
HBASE-18647 Parameter cacheBlocks does not take effect in REST API for scan Signed-off-by: tedyu <yuzhih...@gmail.com> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/08212e50 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/08212e50 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/08212e50 Branch: refs/heads/branch-2 Commit: 08212e50fff0ed61d6038d20dfdb7ceaf477420f Parents: ec7bca1 Author: Guangxu Cheng <guangxuch...@gmail.com> Authored: Tue Aug 22 11:29:32 2017 +0800 Committer: tedyu <yuzhih...@gmail.com> Committed: Thu Aug 24 08:09:25 2017 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/rest/Constants.java | 1 + .../apache/hadoop/hbase/rest/TableResource.java | 5 ++--- .../hadoop/hbase/rest/TableScanResource.java | 19 ++++++++----------- 3 files changed, 11 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/08212e50/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java index 3326f2f..e8502e7 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/Constants.java @@ -78,6 +78,7 @@ public interface Constants { String SCAN_FETCH_SIZE = "hbase.rest.scan.fetchsize"; String SCAN_FILTER = "filter"; String SCAN_REVERSED = "reversed"; + String SCAN_CACHE_BLOCKS = "cacheblocks"; String CUSTOM_FILTERS = "hbase.rest.custom.filters"; String ROW_KEYS_PARAM_NAME = "row"; http://git-wip-us.apache.org/repos/asf/hbase/blob/08212e50/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java index 3019e40..1f56881 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableResource.java @@ -121,9 +121,7 @@ public class TableResource extends ResourceBase { @Path("{scanspec: .*[*]$}") public TableScanResource getScanResource( - final @Context UriInfo uriInfo, final @PathParam("scanspec") String scanSpec, - final @HeaderParam("Accept") String contentType, @DefaultValue(Integer.MAX_VALUE + "") @QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit, @DefaultValue("") @QueryParam(Constants.SCAN_START_ROW) String startRow, @@ -133,7 +131,7 @@ public class TableResource extends ResourceBase { @DefaultValue("-1") @QueryParam(Constants.SCAN_BATCH_SIZE) int batchSize, @DefaultValue("0") @QueryParam(Constants.SCAN_START_TIME) long startTime, @DefaultValue(Long.MAX_VALUE + "") @QueryParam(Constants.SCAN_END_TIME) long endTime, - @DefaultValue("true") @QueryParam(Constants.SCAN_BATCH_SIZE) boolean cacheBlocks, + @DefaultValue("true") @QueryParam(Constants.SCAN_CACHE_BLOCKS) boolean cacheBlocks, @DefaultValue("false") @QueryParam(Constants.SCAN_REVERSED) boolean reversed, @DefaultValue("") @QueryParam(Constants.SCAN_FILTER) String paramFilter) { try { @@ -201,6 +199,7 @@ public class TableResource extends ResourceBase { int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10); tableScan.setCaching(fetchSize); tableScan.setReversed(reversed); + tableScan.setCacheBlocks(cacheBlocks); return new TableScanResource(hTable.getScanner(tableScan), userRequestedLimit); } catch (IOException exp) { servlet.getMetrics().incrementFailedScanRequests(1); http://git-wip-us.apache.org/repos/asf/hbase/blob/08212e50/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java ---------------------------------------------------------------------- diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java index 5cc2c7b..3effc01 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/TableScanResource.java @@ -67,6 +67,9 @@ public class TableScanResource extends ResourceBase { @GET @Produces({ Constants.MIMETYPE_XML, Constants.MIMETYPE_JSON }) public CellSetModelStream get(final @Context UriInfo uriInfo) { + if (LOG.isTraceEnabled()) { + LOG.trace("GET " + uriInfo.getAbsolutePath()); + } servlet.getMetrics().incrementRequests(1); final int rowsToSend = userRequestedLimit; servlet.getMetrics().incrementSucessfulScanRequests(1); @@ -116,17 +119,11 @@ public class TableScanResource extends ResourceBase { @Produces({ Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF }) public Response getProtobuf( final @Context UriInfo uriInfo, - final @PathParam("scanspec") String scanSpec, - final @HeaderParam("Accept") String contentType, - @DefaultValue(Integer.MAX_VALUE + "") @QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit, - @DefaultValue("") @QueryParam(Constants.SCAN_START_ROW) String startRow, - @DefaultValue("") @QueryParam(Constants.SCAN_END_ROW) String endRow, - @DefaultValue("column") @QueryParam(Constants.SCAN_COLUMN) List<String> column, - @DefaultValue("1") @QueryParam(Constants.SCAN_MAX_VERSIONS) int maxVersions, - @DefaultValue("-1") @QueryParam(Constants.SCAN_BATCH_SIZE) int batchSize, - @DefaultValue("0") @QueryParam(Constants.SCAN_START_TIME) long startTime, - @DefaultValue(Long.MAX_VALUE + "") @QueryParam(Constants.SCAN_END_TIME) long endTime, - @DefaultValue("true") @QueryParam(Constants.SCAN_BATCH_SIZE) boolean cacheBlocks) { + final @HeaderParam("Accept") String contentType) { + if (LOG.isTraceEnabled()) { + LOG.trace("GET " + uriInfo.getAbsolutePath() + " as " + + MIMETYPE_BINARY); + } servlet.getMetrics().incrementRequests(1); try { int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10);