Class MetaBrowser
Support class for the "Meta Entries" section in resources/hbase-webapps/master/table.jsp.
Interface. This class's intended consumer is table.jsp. As such, it's primary
interface is the active HttpServletRequest, from which it uses the scan_* request
parameters. This class supports paging through an optionally filtered view of the contents of
hbase:meta. Those filters and the pagination offset are specified via these request
parameters. It provides helper methods for constructing pagination links.
- "name" - the name of the table requested. The only table of our concern here is
hbase:meta; any other value is effectively ignored by the giant conditional in the jsp. - "scan_limit" - specifies a limit on the number of region (replicas) rendered on
the by the table in a single request -- a limit on page size. This corresponds to the number of
RegionReplicaInfoobjects produced byMetaBrowser.Results.iterator(). When a value forscan_limitis invalid or not specified, the default value of 10 is used. In order to avoid excessive resource consumption, a maximum value of 10000 is enforced. - "scan_region_state" - an optional filter on
RegionState. - "scan_start" - specifies the rowkey at which a scan should start. For usage details, see the below section on Pagination.
- "scan_table" - specifies a filter on the values returned, limiting them to
regions from a specified table. This parameter is implemented as a prefix filter on the
Scan, so in effect it can be used for simple namespace and multi-table matches.
Pagination. A single page of results are made available via getResults() / an
instance of MetaBrowser.Results. Callers use its Iterator consume the page of
RegionReplicaInfo instances, each of which represents a region or region replica. Helper
methods are provided for building page navigation controls preserving the user's selected filter
set: buildFirstPageUrl(), buildNextPageUrl(byte[]). Pagination is implemented
using a simple offset + limit system. Offset is provided by the "scan_start", limit
via "scan_limit". Under the hood, the Scan is constructed with
Scan.setMaxResultSize(long) set to ("scan_limit" +1), while the
MetaBrowser.Results Iterator honors "scan_limit". The +1 allows the caller to
know if a "next page" is available via MetaBrowser.Results.hasMoreResults(). Note that this
pagination strategy is incomplete when it comes to region replicas and can potentially omit
rendering replicas that fall between the last rowkey offset and replicaCount % page size.
Error Messages. Any time there's an error parsing user input, a message will be populated
in getErrorMessages(). Any fields which produce an error will have their filter values
set to the default, except for a value of "scan_limit" that exceeds
10000, in which case 10000 is used.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classEncapsulates the results produced by thisMetaBrowserinstance. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AsyncConnectionprivate final Stringstatic final Stringprivate final javax.servlet.http.HttpServletRequeststatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate final Integerprivate final RegionState.Stateprivate final byte[]private final TableName -
Constructor Summary
ConstructorsConstructorDescriptionMetaBrowser(AsyncConnection connection, javax.servlet.http.HttpServletRequest request) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddParam(org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder encoder, String paramName, Object value) AddsvaluetoencoderunderparamNamewhenvalueis non-null.private org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoderbuildNextPageUrl(byte[] lastRow) private Scanprivate Filterprivate static StringbuildScanLimitExceededErrorMessage(int requestValue) private static StringbuildScanLimitLTEQZero(int requestValue) private static StringbuildScanLimitMalformedErrorMessage(String requestValue) private static Filterprivate static StringbuildScanRegionStateMalformedErrorMessage(String requestValue) (package private) static StringbuildStartParamFrom(byte[] lastRow) private static FilterbuildTableFilter(TableName tableName) getName()byte[]private static StringresolveName(javax.servlet.http.HttpServletRequest request) private static StringresolveRequestParameter(javax.servlet.http.HttpServletRequest request, String param) private IntegerresolveScanLimit(javax.servlet.http.HttpServletRequest request) private RegionState.StateresolveScanRegionState(javax.servlet.http.HttpServletRequest request) private static byte[]resolveScanStart(javax.servlet.http.HttpServletRequest request) private static TableNameresolveScanTable(javax.servlet.http.HttpServletRequest request) toString()private static IntegertryParseInt(String val) private static <T extends Enum<T>>
TtryValueOf(Class<T> clazz, String value) private static Stringprivate static String
-
Field Details
-
NAME_PARAM
- See Also:
-
SCAN_LIMIT_PARAM
- See Also:
-
SCAN_REGION_STATE_PARAM
- See Also:
-
SCAN_START_PARAM
- See Also:
-
SCAN_TABLE_PARAM
- See Also:
-
SCAN_LIMIT_DEFAULT
- See Also:
-
SCAN_LIMIT_MAX
- See Also:
-
connection
-
request
-
errorMessages
-
name
-
scanLimit
-
scanRegionState
-
scanStart
-
scanTable
-
-
Constructor Details
-
MetaBrowser
-
-
Method Details
-
getErrorMessages
-
getName
-
getScanLimit
-
getScanStart
-
getScanRegionState
-
getScanTable
-
getResults
-
toString
-
resolveName
-
resolveScanLimit
-
resolveScanRegionState
-
resolveScanStart
-
resolveScanTable
-
resolveRequestParameter
private static String resolveRequestParameter(javax.servlet.http.HttpServletRequest request, String param) -
buildTableFilter
-
buildScanRegionStateFilter
-
buildScanFilter
-
buildScan
-
addParam
private void addParam(org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder encoder, String paramName, Object value) AddsvaluetoencoderunderparamNamewhenvalueis non-null. -
buildFirstPageEncoder
private org.apache.hbase.thirdparty.io.netty.handler.codec.http.QueryStringEncoder buildFirstPageEncoder() -
buildFirstPageUrl
-
buildStartParamFrom
-
buildNextPageUrl
-
urlEncode
-
urlDecode
-
tryParseInt
-
tryValueOf
-
buildScanLimitExceededErrorMessage
-
buildScanLimitMalformedErrorMessage
-
buildScanLimitLTEQZero
-
buildScanRegionStateMalformedErrorMessage
-