@Test public void testAddRegionToMeta() throws Exception { RegionInfo regionInfo = createTableAnddeleteFirstRegion(); HBCKMetaTableAccessor.addRegionToMeta(TEST_UTIL.getConnection(), regionInfo); Connection connection = TEST_UTIL.getConnection(); Table meta = connection.getTable(TableName.META_TABLE_NAME); Get get = new Get(regionInfo.getRegionName()); Result r = meta.get(get); assertNotNull(r); assertFalse(r.isEmpty()); RegionInfo returnedRI = RegionInfo.parseFrom(r.getValue(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER)); assertEquals(regionInfo, returnedRI); String state = Bytes.toString(r.getValue(HConstants.CATALOG_FAMILY, HConstants.STATE_QUALIFIER)); assertEquals(RegionState.State.valueOf(state), RegionState.State.CLOSED); }
public static void addRegionToMeta(Connection conn, RegionInfo region) throws IOException { Put put = makePutFromRegionInfo(region, System.currentTimeMillis()); addRegionStateToPut(put, RegionState.State.CLOSED); conn.getTable(TableName.META_TABLE_NAME).put(put); }
HBCKMetaTableAccessor { public static void addRegionToMeta(Connection conn, RegionInfo region) throws IOException { Put put = makePutFromRegionInfo(region, System.currentTimeMillis()); addRegionStateToPut(put, RegionState.State.CLOSED); conn.getTable(TableName.META_TABLE_NAME).put(put); } }
HBCKMetaTableAccessor { public static void addRegionToMeta(Connection conn, RegionInfo region) throws IOException { Put put = makePutFromRegionInfo(region, System.currentTimeMillis()); addRegionStateToPut(put, RegionState.State.CLOSED); conn.getTable(TableName.META_TABLE_NAME).put(put); } private  HBCKMetaTableAccessor(); }
HBCKMetaTableAccessor { public static void addRegionToMeta(Connection conn, RegionInfo region) throws IOException { Put put = makePutFromRegionInfo(region, System.currentTimeMillis()); addRegionStateToPut(put, RegionState.State.CLOSED); conn.getTable(TableName.META_TABLE_NAME).put(put); } private  HBCKMetaTableAccessor(); static List<RegionInfo> getMergeRegions(Cell[] cells); static void deleteRegionInfo(Connection connection, RegionInfo regionInfo); static List<RegionInfo> getTableRegions(final Connection conn, final TableName table); static List<TableName> getTables(final Connection conn); static void addRegionToMeta(Connection conn, RegionInfo region); static List<RegionInfo> getAllRegions(Connection conn); static Map<TableName, TableState> getAllTablesStates(Connection conn); static byte[] getTableStartRowForMeta(TableName tableName); static byte[] getTableStopRowForMeta(TableName tableName); static byte[] getMetaKeyForRegion(RegionInfo regionInfo); static Put addLocation(Put p, ServerName sn, long openSeqNum, int replicaId); static int getRegionCount(final Connection connection, final TableName tableName); static TableState getTableState(Result r); static TableState getTableState(Connection conn, TableName tableName); static Put makePutFromTableState(TableState state, long ts); static Put makePutFromRegionInfo(RegionInfo region, long ts); static void deleteTableState(Connection connection, TableName table); static void updateTableState(Connection conn, TableName tableName,
    TableState.State actual); static RegionInfo getRegionInfo(final Result r, byte [] qualifier); @InterfaceAudience.Private // for use by HMaster#getTableRegionRow which is used for testing only static ServerName getServerName(final Result r, final int replicaId); static RegionLocations getRegionLocations(final Result r); static PairOfSameType<RegionInfo> getDaughterRegions(Result data); @VisibleForTesting static byte[] getServerColumn(int replicaId); @VisibleForTesting static byte[] getStartCodeColumn(int replicaId); @VisibleForTesting static byte[] getSeqNumColumn(int replicaId); }
HBCKMetaTableAccessor { public static void addRegionToMeta(Connection conn, RegionInfo region) throws IOException { Put put = makePutFromRegionInfo(region, System.currentTimeMillis()); addRegionStateToPut(put, RegionState.State.CLOSED); conn.getTable(TableName.META_TABLE_NAME).put(put); } private  HBCKMetaTableAccessor(); static List<RegionInfo> getMergeRegions(Cell[] cells); static void deleteRegionInfo(Connection connection, RegionInfo regionInfo); static List<RegionInfo> getTableRegions(final Connection conn, final TableName table); static List<TableName> getTables(final Connection conn); static void addRegionToMeta(Connection conn, RegionInfo region); static List<RegionInfo> getAllRegions(Connection conn); static Map<TableName, TableState> getAllTablesStates(Connection conn); static byte[] getTableStartRowForMeta(TableName tableName); static byte[] getTableStopRowForMeta(TableName tableName); static byte[] getMetaKeyForRegion(RegionInfo regionInfo); static Put addLocation(Put p, ServerName sn, long openSeqNum, int replicaId); static int getRegionCount(final Connection connection, final TableName tableName); static TableState getTableState(Result r); static TableState getTableState(Connection conn, TableName tableName); static Put makePutFromTableState(TableState state, long ts); static Put makePutFromRegionInfo(RegionInfo region, long ts); static void deleteTableState(Connection connection, TableName table); static void updateTableState(Connection conn, TableName tableName,
    TableState.State actual); static RegionInfo getRegionInfo(final Result r, byte [] qualifier); @InterfaceAudience.Private // for use by HMaster#getTableRegionRow which is used for testing only static ServerName getServerName(final Result r, final int replicaId); static RegionLocations getRegionLocations(final Result r); static PairOfSameType<RegionInfo> getDaughterRegions(Result data); @VisibleForTesting static byte[] getServerColumn(int replicaId); @VisibleForTesting static byte[] getStartCodeColumn(int replicaId); @VisibleForTesting static byte[] getSeqNumColumn(int replicaId);  }