org.apache.hadoop.hbase.client
Class MetaScanner

java.lang.Object
  extended by org.apache.hadoop.hbase.client.MetaScanner

public class MetaScanner
extends Object

Scanner class that contains the .META. table scanning logic and uses a Retryable scanner. Provided visitors will be called for each row. Although public visibility, this is not a public-facing API and may evolve in minor releases.

Note that during concurrent region splits, the scanner might not see META changes across rows (for parent and daughter entries) consistently. see HBASE-5986, and MetaScanner.BlockingMetaScannerVisitor for details.


Nested Class Summary
static class MetaScanner.BlockingMetaScannerVisitor
          A MetaScannerVisitor that provides a consistent view of the table's META entries during concurrent splits (see HBASE-5986 for details).
static interface MetaScanner.MetaScannerVisitor
          Visitor class called to process each row of the .META.
static class MetaScanner.MetaScannerVisitorBase
           
static class MetaScanner.TableMetaScannerVisitor
          A MetaScannerVisitor for a table.
 
Constructor Summary
MetaScanner()
           
 
Method Summary
static NavigableMap<HRegionInfo,ServerName> allTableRegions(org.apache.hadoop.conf.Configuration conf, byte[] tablename, boolean offlined)
          Deprecated. 
static NavigableMap<HRegionInfo,ServerName> allTableRegions(org.apache.hadoop.conf.Configuration conf, HConnection connection, byte[] tablename, boolean offlined)
          Lists all of the table regions currently in META.
static List<HRegionInfo> listAllRegions(org.apache.hadoop.conf.Configuration conf, boolean offlined)
          Used in tests.
static void metaScan(org.apache.hadoop.conf.Configuration configuration, HConnection connection, MetaScanner.MetaScannerVisitor visitor, byte[] userTableName)
          Scans the meta table and calls a visitor on each RowResult and uses a empty start row value as table name.
static void metaScan(org.apache.hadoop.conf.Configuration configuration, HConnection connection, MetaScanner.MetaScannerVisitor visitor, byte[] tableName, byte[] row, int rowLimit, byte[] metaTableName)
          Scans the meta table and calls a visitor on each RowResult.
static void metaScan(org.apache.hadoop.conf.Configuration configuration, MetaScanner.MetaScannerVisitor visitor)
          Scans the meta table and calls a visitor on each RowResult and uses a empty start row value as table name.
static void metaScan(org.apache.hadoop.conf.Configuration configuration, MetaScanner.MetaScannerVisitor visitor, byte[] userTableName, byte[] row, int rowLimit)
          Scans the meta table and calls a visitor on each RowResult.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaScanner

public MetaScanner()
Method Detail

metaScan

public static void metaScan(org.apache.hadoop.conf.Configuration configuration,
                            MetaScanner.MetaScannerVisitor visitor)
                     throws IOException
Scans the meta table and calls a visitor on each RowResult and uses a empty start row value as table name.

Parameters:
configuration - conf
visitor - A custom visitor
Throws:
IOException - e

metaScan

public static void metaScan(org.apache.hadoop.conf.Configuration configuration,
                            HConnection connection,
                            MetaScanner.MetaScannerVisitor visitor,
                            byte[] userTableName)
                     throws IOException
Scans the meta table and calls a visitor on each RowResult and uses a empty start row value as table name.

Parameters:
configuration - conf
connection - connection to be used internally (null not allowed)
visitor - A custom visitor
Throws:
IOException - e

metaScan

public static void metaScan(org.apache.hadoop.conf.Configuration configuration,
                            MetaScanner.MetaScannerVisitor visitor,
                            byte[] userTableName,
                            byte[] row,
                            int rowLimit)
                     throws IOException
Scans the meta table and calls a visitor on each RowResult. Uses a table name and a row name to locate meta regions. And it only scans at most rowLimit of rows.

Parameters:
configuration - HBase configuration.
visitor - Visitor object.
userTableName - User table name in meta table to start scan at. Pass null if not interested in a particular table.
row - Name of the row at the user table. The scan will start from the region row where the row resides.
rowLimit - Max of processed rows. If it is less than 0, it will be set to default value Integer.MAX_VALUE.
Throws:
IOException - e

metaScan

public static void metaScan(org.apache.hadoop.conf.Configuration configuration,
                            HConnection connection,
                            MetaScanner.MetaScannerVisitor visitor,
                            byte[] tableName,
                            byte[] row,
                            int rowLimit,
                            byte[] metaTableName)
                     throws IOException
Scans the meta table and calls a visitor on each RowResult. Uses a table name and a row name to locate meta regions. And it only scans at most rowLimit of rows.

Parameters:
configuration - HBase configuration.
connection - connection to be used internally (null not allowed)
visitor - Visitor object. Closes the visitor before returning.
tableName - User table name in meta table to start scan at. Pass null if not interested in a particular table.
row - Name of the row at the user table. The scan will start from the region row where the row resides.
rowLimit - Max of processed rows. If it is less than 0, it will be set to default value Integer.MAX_VALUE.
metaTableName - Meta table to scan, root or meta.
Throws:
IOException - e

listAllRegions

public static List<HRegionInfo> listAllRegions(org.apache.hadoop.conf.Configuration conf,
                                               boolean offlined)
                                        throws IOException
Used in tests. Lists all of the regions currently in META.

Parameters:
conf -
offlined - True if we are to include offlined regions, false and we'll leave out offlined regions from returned list.
Returns:
List of all user-space regions.
Throws:
IOException

allTableRegions

@Deprecated
public static NavigableMap<HRegionInfo,ServerName> allTableRegions(org.apache.hadoop.conf.Configuration conf,
                                                                              byte[] tablename,
                                                                              boolean offlined)
                                                            throws IOException
Deprecated. 

Lists all of the table regions currently in META.

Parameters:
conf -
connection - connection to be used internally (null to create a new connection)
offlined - True if we are to include offlined regions, false and we'll leave out offlined regions from returned list.
Returns:
Map of all user-space regions to servers
Throws:
IOException

allTableRegions

public static NavigableMap<HRegionInfo,ServerName> allTableRegions(org.apache.hadoop.conf.Configuration conf,
                                                                   HConnection connection,
                                                                   byte[] tablename,
                                                                   boolean offlined)
                                                            throws IOException
Lists all of the table regions currently in META.

Parameters:
conf -
connection - connection to be used internally (null to create a new connection)
offlined - True if we are to include offlined regions, false and we'll leave out offlined regions from returned list.
Returns:
Map of all user-space regions to servers
Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All Rights Reserved.