Java Code Examples for org.apache.hadoop.hbase.TableName#META_TABLE_NAME

The following examples show how to use org.apache.hadoop.hbase.TableName#META_TABLE_NAME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestReplicationWALEntryFilters.java    From hbase with Apache License 2.0 6 votes vote down vote up
@Test
public void testSystemTableWALEntryFilter() {
  SystemTableWALEntryFilter filter = new SystemTableWALEntryFilter();

  // meta
  WALKeyImpl key1 =
    new WALKeyImpl(RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
      TableName.META_TABLE_NAME, System.currentTimeMillis());
  Entry metaEntry = new Entry(key1, null);

  assertNull(filter.filter(metaEntry));

  // user table
  WALKeyImpl key3 = new WALKeyImpl(new byte[0], TableName.valueOf("foo"),
      System.currentTimeMillis());
  Entry userEntry = new Entry(key3, null);

  assertEquals(userEntry, filter.filter(userEntry));
}
 
Example 2
Source File: ThriftHBaseServiceHandler.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Override
public TRegionInfo getRegionInfo(ByteBuffer searchRow) throws IOError {
  try {
    byte[] row = getBytes(searchRow);
    Result startRowResult = getReverseScanResult(TableName.META_TABLE_NAME.getName(), row,
        HConstants.CATALOG_FAMILY);

    if (startRowResult == null) {
      throw new IOException("Cannot find row in "+ TableName.META_TABLE_NAME+", row="
          + Bytes.toStringBinary(row));
    }

    // find region start and end keys
    RegionInfo regionInfo = CatalogFamilyFormat.getRegionInfo(startRowResult);
    if (regionInfo == null) {
      throw new IOException("RegionInfo REGIONINFO was null or " +
          " empty in Meta for row="
          + Bytes.toStringBinary(row));
    }
    TRegionInfo region = new TRegionInfo();
    region.setStartKey(regionInfo.getStartKey());
    region.setEndKey(regionInfo.getEndKey());
    region.id = regionInfo.getRegionId();
    region.setName(regionInfo.getRegionName());
    region.version = HREGION_VERSION; // version not used anymore, PB encoding used.

    // find region assignment to server
    ServerName serverName = CatalogFamilyFormat.getServerName(startRowResult, 0);
    if (serverName != null) {
      region.setServerName(Bytes.toBytes(serverName.getHostname()));
      region.port = serverName.getPort();
    }
    return region;
  } catch (IOException e) {
    LOG.warn(e.getMessage(), e);
    throw getIOError(e);
  }
}
 
Example 3
Source File: TestWALSplit.java    From hbase with Apache License 2.0 5 votes vote down vote up
private Path createRecoveredEditsPathForRegion() throws IOException {
  byte[] encoded = RegionInfoBuilder.FIRST_META_REGIONINFO.getEncodedNameAsBytes();
  long now = System.currentTimeMillis();
  Entry entry = new Entry(
      new WALKeyImpl(encoded, TableName.META_TABLE_NAME, 1, now, HConstants.DEFAULT_CLUSTER_ID),
      new WALEdit());
  Path p = WALSplitUtil
      .getRegionSplitEditsPath(TableName.META_TABLE_NAME, encoded, 1, FILENAME_BEING_SPLIT,
          TMPDIRNAME, conf);
  return p;
}
 
Example 4
Source File: TestSimpleRegionNormalizer.java    From hbase with Apache License 2.0 5 votes vote down vote up
@Test
public void testNoNormalizationForMetaTable() {
  TableName testTable = TableName.META_TABLE_NAME;
  List<RegionInfo> RegionInfo = new ArrayList<>();
  Map<byte[], Integer> regionSizes = new HashMap<>();

  setupMocksForNormalizer(regionSizes, RegionInfo);
  List<NormalizationPlan> plans = normalizer.computePlansForTable(testTable);
  assertThat(plans, empty());
}
 
Example 5
Source File: IntegrationTestMTTR.java    From hbase with Apache License 2.0 5 votes vote down vote up
private static void setupActions() throws IOException {
  // allow a little more time for RS restart actions because RS start depends on having a master
  // to report to and the master is also being monkeyed.
  util.getConfiguration().setLong(Action.START_RS_TIMEOUT_KEY, 3 * 60 * 1000);

  // Set up the action that will restart a region server holding a region from our table
  // because this table should only have one region we should be good.
  restartRSAction = new RestartRsHoldingTableAction(sleepTime,
      util.getConnection().getRegionLocator(tableName));

  // Set up the action that will kill the region holding meta.
  restartMetaAction = new RestartRsHoldingMetaAction(sleepTime);

  // Set up the action that will move the regions of meta.
  moveMetaRegionsAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, TableName.META_TABLE_NAME);

  // Set up the action that will move the regions of our table.
  moveRegionAction = new MoveRegionsOfTableAction(sleepTime,
      MonkeyConstants.DEFAULT_MOVE_REGIONS_MAX_TIME, tableName);

  // Kill the master
  restartMasterAction = new RestartActiveMasterAction(1000);

  // Give the action the access to the cluster.
  Action.ActionContext actionContext = new Action.ActionContext(util);
  restartRSAction.init(actionContext);
  restartMetaAction.init(actionContext);
  moveMetaRegionsAction.init(actionContext);
  moveRegionAction.init(actionContext);
  restartMasterAction.init(actionContext);
}
 
Example 6
Source File: MetaQueue.java    From hbase with Apache License 2.0 4 votes vote down vote up
protected MetaQueue(LockStatus lockStatus) {
  super(TableName.META_TABLE_NAME, 1, lockStatus);
}
 
Example 7
Source File: InitMetaProcedure.java    From hbase with Apache License 2.0 4 votes vote down vote up
@Override
public TableName getTableName() {
  return TableName.META_TABLE_NAME;
}