Class MetaBrowser

java.lang.Object
org.apache.hadoop.hbase.master.http.MetaBrowser

@Private public class MetaBrowser extends Object

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 RegionReplicaInfo objects produced by MetaBrowser.Results.iterator(). When a value for scan_limit is 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.