org.apache.hadoop.hbase.TableName.isMetaTableName()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(181)

本文整理了Java中org.apache.hadoop.hbase.TableName.isMetaTableName()方法的一些代码示例,展示了TableName.isMetaTableName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TableName.isMetaTableName()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.TableName
类名称:TableName
方法名:isMetaTableName

TableName.isMetaTableName介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

private boolean isMeta(TableName tableName) {
 return TableName.isMetaTableName(tableName);
}

代码示例来源:origin: apache/hbase

@Override
public CompletableFuture<Boolean> tableExists(TableName tableName) {
 if (TableName.isMetaTableName(tableName)) {
  return CompletableFuture.completedFuture(true);
 }
 return AsyncMetaTableAccessor.tableExists(metaTable, tableName);
}

代码示例来源:origin: apache/hbase

@Override
public List<RegionInfo> getRegions(TableName tableName) throws IOException {
 if (TableName.isMetaTableName(tableName)) {
  return Arrays.asList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  return MetaTableAccessor.getTableRegions(connection, tableName, true);
 }
}

代码示例来源:origin: apache/hbase

/**
 * Return the priority for the given table. Now meta table is 3, other system tables are 2, and
 * user tables are 1.
 */
public static int getTablePriority(TableName tableName) {
 if (TableName.isMetaTableName(tableName)) {
  return 3;
 } else if (tableName.isSystemTable()) {
  return 2;
 } else {
  return 1;
 }
}

代码示例来源:origin: apache/hbase

public boolean isMeta() {
 return TableName.isMetaTableName(getTableName());
}

代码示例来源:origin: apache/hbase

@Override
public CompletableFuture<List<HRegionLocation>> getAllRegionLocations() {
 if (TableName.isMetaTableName(tableName)) {
  return conn.registry.getMetaRegionLocation()
   .thenApply(locs -> Arrays.asList(locs.getRegionLocations()));
 }
 return AsyncMetaTableAccessor.getTableHRegionLocations(conn.getTable(TableName.META_TABLE_NAME),
  Optional.of(tableName));
}

代码示例来源:origin: apache/hbase

private long getPrimaryTimeoutNs() {
 return TableName.isMetaTableName(tableName) ? conn.connConf.getPrimaryMetaScanTimeoutNs()
  : conn.connConf.getPrimaryScanTimeoutNs();
}

代码示例来源:origin: apache/hbase

@Override
public CompletableFuture<Boolean> isTableDisabled(TableName tableName) {
 if (TableName.isMetaTableName(tableName)) {
  return CompletableFuture.completedFuture(false);
 }
 CompletableFuture<Boolean> future = new CompletableFuture<>();
 addListener(AsyncMetaTableAccessor.getTableState(metaTable, tableName), (state, error) -> {
  if (error != null) {
   future.completeExceptionally(error);
   return;
  }
  if (state.isPresent()) {
   future.complete(state.get().inStates(TableState.State.DISABLED));
  } else {
   future.completeExceptionally(new TableNotFoundException(tableName));
  }
 });
 return future;
}

代码示例来源:origin: apache/hbase

private List<RegionLocations> listRegionLocations() throws IOException {
  if (TableName.isMetaTableName(tableName)) {
   return Collections
    .singletonList(connection.locateRegion(tableName, HConstants.EMPTY_START_ROW, false, true));
  }
  final List<RegionLocations> regions = new ArrayList<>();
  MetaTableAccessor.Visitor visitor = new MetaTableAccessor.TableVisitorBase(tableName) {
   @Override
   public boolean visitInternal(Result result) throws IOException {
    RegionLocations locations = MetaTableAccessor.getRegionLocations(result);
    if (locations == null) {
     return true;
    }
    regions.add(locations);
    return true;
   }
  };
  MetaTableAccessor.scanMetaForTableRegions(connection, visitor, tableName);
  return regions;
 }
}

代码示例来源:origin: apache/hbase

@Override
public CompletableFuture<Boolean> isTableEnabled(TableName tableName) {
 if (TableName.isMetaTableName(tableName)) {
  return CompletableFuture.completedFuture(true);
 }
 CompletableFuture<Boolean> future = new CompletableFuture<>();
 addListener(AsyncMetaTableAccessor.getTableState(metaTable, tableName), (state, error) -> {
  if (error != null) {
   future.completeExceptionally(error);
   return;
  }
  if (state.isPresent()) {
   future.complete(state.get().inStates(TableState.State.ENABLED));
  } else {
   future.completeExceptionally(new TableNotFoundException(tableName));
  }
 });
 return future;
}

代码示例来源:origin: apache/hbase

private CompletableFuture<Boolean> isTableAvailable(TableName tableName,
  Optional<byte[][]> splitKeys) {
 if (TableName.isMetaTableName(tableName)) {
  return connection.registry.getMetaRegionLocation().thenApply(locs -> Stream
   .of(locs.getRegionLocations()).allMatch(loc -> loc != null && loc.getServerName() != null));

代码示例来源:origin: apache/hbase

@Override
public List<HRegionLocation> locateRegions(TableName tableName, boolean useCache,
  boolean offlined) throws IOException {
 List<RegionInfo> regions;
 if (TableName.isMetaTableName(tableName)) {
  regions = Collections.singletonList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  regions = MetaTableAccessor.getTableRegions(this, tableName, !offlined);
 }
 List<HRegionLocation> locations = new ArrayList<>();
 for (RegionInfo regionInfo : regions) {
  if (!RegionReplicaUtil.isDefaultReplica(regionInfo)) {
   continue;
  }
  RegionLocations list = locateRegion(tableName, regionInfo.getStartKey(), useCache, true);
  if (list != null) {
   for (HRegionLocation loc : list.getRegionLocations()) {
    if (loc != null) {
     locations.add(loc);
    }
   }
  }
 }
 return locations;
}

代码示例来源:origin: apache/hbase

@Override
protected boolean waitInitialized(MasterProcedureEnv env) {
 if (TableName.isMetaTableName(getTableName())) {
  return false;
 }
 // First we need meta to be loaded, and second, if meta is not online then we will likely to
 // fail when updating meta so we wait until it is assigned.
 AssignmentManager am = env.getAssignmentManager();
 return am.waitMetaLoaded(this) || am.waitMetaAssigned(this, region);
}

代码示例来源:origin: apache/hbase

for (Map.Entry<String, TableDescriptor> entry : allDescriptors.entrySet()) {
 TableName tableName = TableName.valueOf(entry.getKey());
 if (TableName.isMetaTableName(tableName)) {

代码示例来源:origin: apache/hbase

@Override
protected boolean waitInitialized(MasterProcedureEnv env) {
 if (TableName.isMetaTableName(getTableName())) {
  return false;
 }
 // First we need meta to be loaded, and second, if meta is not online then we will likely to
 // fail when updating meta so we wait until it is assigned.
 AssignmentManager am = env.getAssignmentManager();
 return am.waitMetaLoaded(this) || am.waitMetaAssigned(this, getRegion());
}

代码示例来源:origin: apache/hbase

if (!TableName.isMetaTableName(tableName)) {
 try (final Table meta = getConnection().getTable(TableName.META_TABLE_NAME)) {
  LOG.debug("Waiting until all regions of table " + tableName + " get assigned. Timeout = " +

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public List<RegionInfo> getRegions(TableName tableName) throws IOException {
 if (TableName.isMetaTableName(tableName)) {
  return Arrays.asList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  return MetaTableAccessor.getTableRegions(connection, tableName, true);
 }
}

代码示例来源:origin: org.apache.hbase/hbase-client

@Override
public List<HRegionLocation> locateRegions(TableName tableName, boolean useCache,
  boolean offlined) throws IOException {
 List<RegionInfo> regions;
 if (TableName.isMetaTableName(tableName)) {
  regions = Collections.singletonList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  regions = MetaTableAccessor.getTableRegions(this, tableName, !offlined);
 }
 List<HRegionLocation> locations = new ArrayList<>();
 for (RegionInfo regionInfo : regions) {
  if (!RegionReplicaUtil.isDefaultReplica(regionInfo)) {
   continue;
  }
  RegionLocations list = locateRegion(tableName, regionInfo.getStartKey(), useCache, true);
  if (list != null) {
   for (HRegionLocation loc : list.getRegionLocations()) {
    if (loc != null) {
     locations.add(loc);
    }
   }
  }
 }
 return locations;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

@Override
public List<RegionInfo> getRegions(TableName tableName) throws IOException {
 if (TableName.isMetaTableName(tableName)) {
  return Arrays.asList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  return MetaTableAccessor.getTableRegions(connection, tableName, true);
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-client

@Override
public List<HRegionLocation> locateRegions(TableName tableName, boolean useCache,
  boolean offlined) throws IOException {
 List<RegionInfo> regions;
 if (TableName.isMetaTableName(tableName)) {
  regions = Collections.singletonList(RegionInfoBuilder.FIRST_META_REGIONINFO);
 } else {
  regions = MetaTableAccessor.getTableRegions(this, tableName, !offlined);
 }
 List<HRegionLocation> locations = new ArrayList<>();
 for (RegionInfo regionInfo : regions) {
  if (!RegionReplicaUtil.isDefaultReplica(regionInfo)) {
   continue;
  }
  RegionLocations list = locateRegion(tableName, regionInfo.getStartKey(), useCache, true);
  if (list != null) {
   for (HRegionLocation loc : list.getRegionLocations()) {
    if (loc != null) {
     locations.add(loc);
    }
   }
  }
 }
 return locations;
}

相关文章