Class MetaTableAccessor

java.lang.Object
org.apache.hadoop.hbase.MetaTableAccessor

@Private public class MetaTableAccessor extends Object

Read/write operations on hbase:meta region as well as assignment information stored to hbase:meta.

Some of the methods of this class take ZooKeeperWatcher as a param. The only reason for this is when this class is used on client-side (e.g. HBaseAdmin), we want to use short-lived connection (opened before each operation, closed right after), while when used on HM or HRS (like in AssignmentManager) we want permanent connection.

HBASE-10070 adds a replicaId to HRI, meaning more than one HRI can be defined for the same table range (table, startKey, endKey). For every range, there will be at least one HRI defined which is called default replica.

Meta layout

 For each table there is single row named for the table with a 'table' column family.
 The column family currently has one column in it, the 'state' column:

 table:state             => contains table state

 Then for each table range ('Region'), there is a single row, formatted as:
 <tableName>,<startKey>,<regionId>,<encodedRegionName>.
 This row is the serialized regionName of the default region replica.
 Columns are:
 info:regioninfo         => contains serialized HRI for the default region replica
 info:server             => contains hostname:port (in string form) for the server hosting
                            the default regionInfo replica
 info:server_<replicaId&gt => contains hostname:port (in string form) for the server hosting
                                 the regionInfo replica with replicaId
 info:serverstartcode    => contains server start code (in binary long form) for the server
                            hosting the default regionInfo replica
 info:serverstartcode_<replicaId&gt => contains server start code (in binary long form) for
                                          the server hosting the regionInfo replica with
                                          replicaId
 info:seqnumDuringOpen   => contains seqNum (in binary long form) for the region at the time
                             the server opened the region with default replicaId
 info:seqnumDuringOpen_<replicaId&gt => contains seqNum (in binary long form) for the region
                                           at the time the server opened the region with
                                           replicaId
 info:splitA             => contains a serialized HRI for the first daughter region if the
                             region is split
 info:splitB             => contains a serialized HRI for the second daughter region if the
                             region is split
 info:merge*             => contains a serialized HRI for a merge parent region. There will be two
                             or more of these columns in a row. A row that has these columns is
                             undergoing a merge and is the result of the merge. Columns listed
                             in marge* columns are the parents of this merged region. Example
                             columns: info:merge0001, info:merge0002. You make also see 'mergeA',
                             and 'mergeB'. This is old form replaced by the new format that allows
                             for more than two parents to be merged at a time.
 TODO: Add rep_barrier for serial replication explaination. See SerialReplicationChecker.
 

The actual layout of meta should be encapsulated inside MetaTableAccessor methods, and should not leak out of it (through Result objects, etc)