You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2017/08/24 15:09:04 UTC
hbase git commit: HBASE-18647 Parameter cacheBlocks does not take
effect in REST API for scan
Repository: hbase
Updated Branches:
refs/heads/master 6e7baa07f -> 321bc55f9
HBASE-18647 Parameter cacheBlocks does not take effect in REST API for scan
Signed-off-by: tedyu <yu...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/321bc55f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/321bc55f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/321bc55f
Branch: refs/heads/master
Commit: 321bc55f91507491ad65b07fae9f3543451a2aeb
Parents: 6e7baa0
Author: Guangxu Cheng <gu...@gmail.com>
Authored: Tue Aug 22 11:29:32 2017 +0800
Committer: tedyu <yu...@gmail.com>
Committed: Thu Aug 24 08:08:54 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/321bc55f/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/321bc55f/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/321bc55f/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);