HBASE-18647 Parameter cacheBlocks does not take effect in REST API for scan
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
ec7bca1769
commit
08212e50ff
|
@ -78,6 +78,7 @@ public interface Constants {
|
||||||
String SCAN_FETCH_SIZE = "hbase.rest.scan.fetchsize";
|
String SCAN_FETCH_SIZE = "hbase.rest.scan.fetchsize";
|
||||||
String SCAN_FILTER = "filter";
|
String SCAN_FILTER = "filter";
|
||||||
String SCAN_REVERSED = "reversed";
|
String SCAN_REVERSED = "reversed";
|
||||||
|
String SCAN_CACHE_BLOCKS = "cacheblocks";
|
||||||
String CUSTOM_FILTERS = "hbase.rest.custom.filters";
|
String CUSTOM_FILTERS = "hbase.rest.custom.filters";
|
||||||
|
|
||||||
String ROW_KEYS_PARAM_NAME = "row";
|
String ROW_KEYS_PARAM_NAME = "row";
|
||||||
|
|
|
@ -121,9 +121,7 @@ public class TableResource extends ResourceBase {
|
||||||
|
|
||||||
@Path("{scanspec: .*[*]$}")
|
@Path("{scanspec: .*[*]$}")
|
||||||
public TableScanResource getScanResource(
|
public TableScanResource getScanResource(
|
||||||
final @Context UriInfo uriInfo,
|
|
||||||
final @PathParam("scanspec") String scanSpec,
|
final @PathParam("scanspec") String scanSpec,
|
||||||
final @HeaderParam("Accept") String contentType,
|
|
||||||
@DefaultValue(Integer.MAX_VALUE + "")
|
@DefaultValue(Integer.MAX_VALUE + "")
|
||||||
@QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit,
|
@QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit,
|
||||||
@DefaultValue("") @QueryParam(Constants.SCAN_START_ROW) String startRow,
|
@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("-1") @QueryParam(Constants.SCAN_BATCH_SIZE) int batchSize,
|
||||||
@DefaultValue("0") @QueryParam(Constants.SCAN_START_TIME) long startTime,
|
@DefaultValue("0") @QueryParam(Constants.SCAN_START_TIME) long startTime,
|
||||||
@DefaultValue(Long.MAX_VALUE + "") @QueryParam(Constants.SCAN_END_TIME) long endTime,
|
@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("false") @QueryParam(Constants.SCAN_REVERSED) boolean reversed,
|
||||||
@DefaultValue("") @QueryParam(Constants.SCAN_FILTER) String paramFilter) {
|
@DefaultValue("") @QueryParam(Constants.SCAN_FILTER) String paramFilter) {
|
||||||
try {
|
try {
|
||||||
|
@ -201,6 +199,7 @@ public class TableResource extends ResourceBase {
|
||||||
int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10);
|
int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10);
|
||||||
tableScan.setCaching(fetchSize);
|
tableScan.setCaching(fetchSize);
|
||||||
tableScan.setReversed(reversed);
|
tableScan.setReversed(reversed);
|
||||||
|
tableScan.setCacheBlocks(cacheBlocks);
|
||||||
return new TableScanResource(hTable.getScanner(tableScan), userRequestedLimit);
|
return new TableScanResource(hTable.getScanner(tableScan), userRequestedLimit);
|
||||||
} catch (IOException exp) {
|
} catch (IOException exp) {
|
||||||
servlet.getMetrics().incrementFailedScanRequests(1);
|
servlet.getMetrics().incrementFailedScanRequests(1);
|
||||||
|
|
|
@ -67,6 +67,9 @@ public class TableScanResource extends ResourceBase {
|
||||||
@GET
|
@GET
|
||||||
@Produces({ Constants.MIMETYPE_XML, Constants.MIMETYPE_JSON })
|
@Produces({ Constants.MIMETYPE_XML, Constants.MIMETYPE_JSON })
|
||||||
public CellSetModelStream get(final @Context UriInfo uriInfo) {
|
public CellSetModelStream get(final @Context UriInfo uriInfo) {
|
||||||
|
if (LOG.isTraceEnabled()) {
|
||||||
|
LOG.trace("GET " + uriInfo.getAbsolutePath());
|
||||||
|
}
|
||||||
servlet.getMetrics().incrementRequests(1);
|
servlet.getMetrics().incrementRequests(1);
|
||||||
final int rowsToSend = userRequestedLimit;
|
final int rowsToSend = userRequestedLimit;
|
||||||
servlet.getMetrics().incrementSucessfulScanRequests(1);
|
servlet.getMetrics().incrementSucessfulScanRequests(1);
|
||||||
|
@ -116,17 +119,11 @@ public class TableScanResource extends ResourceBase {
|
||||||
@Produces({ Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF })
|
@Produces({ Constants.MIMETYPE_PROTOBUF, Constants.MIMETYPE_PROTOBUF_IETF })
|
||||||
public Response getProtobuf(
|
public Response getProtobuf(
|
||||||
final @Context UriInfo uriInfo,
|
final @Context UriInfo uriInfo,
|
||||||
final @PathParam("scanspec") String scanSpec,
|
final @HeaderParam("Accept") String contentType) {
|
||||||
final @HeaderParam("Accept") String contentType,
|
if (LOG.isTraceEnabled()) {
|
||||||
@DefaultValue(Integer.MAX_VALUE + "") @QueryParam(Constants.SCAN_LIMIT) int userRequestedLimit,
|
LOG.trace("GET " + uriInfo.getAbsolutePath() + " as " +
|
||||||
@DefaultValue("") @QueryParam(Constants.SCAN_START_ROW) String startRow,
|
MIMETYPE_BINARY);
|
||||||
@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) {
|
|
||||||
servlet.getMetrics().incrementRequests(1);
|
servlet.getMetrics().incrementRequests(1);
|
||||||
try {
|
try {
|
||||||
int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10);
|
int fetchSize = this.servlet.getConfiguration().getInt(Constants.SCAN_FETCH_SIZE, 10);
|
||||||
|
|
Loading…
Reference in New Issue