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

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

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

TableName.equals介绍

暂无

代码示例

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

/**
 * Drop this instance's tablename byte array and instead
 * hold a reference to the provided tablename. This is not
 * meant to be a general purpose setter - it's only used
 * to collapse references to conserve memory.
 */
void internTableName(TableName tablename) {
 // We should not use this as a setter - only to swap
 // in a new reference to the same table name.
 assert tablename.equals(this.tablename);
 this.tablename = tablename;
}

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

@Override
public boolean equals(Object o) {
 if (!(o instanceof CacheKey)) {
  return false;
 }
 CacheKey other = (CacheKey) o;
 // TableName should be the only thing differing..
 return tn.equals(other.tn) && conn.equals(other.conn) && conf.equals(other.conf)
   && fs.equals(other.fs);
}

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

@Override
 public boolean apply(Entry<RegionInfo,Long> input) {
  return table.equals(input.getKey().getTable());
 }
});

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

/** @return true if this region is a meta region */
@Override
public boolean isMetaRegion() {
  return tableName.equals(FIRST_META_REGIONINFO.getTable());
}

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

@Override
public boolean equals(Object o) {
 if (o == null || !(o instanceof TableSplit)) {
  return false;
 }
 return tableName.equals(((TableSplit)o).tableName) &&
  Bytes.equals(startRow, ((TableSplit)o).startRow) &&
  Bytes.equals(endRow, ((TableSplit)o).endRow) &&
  regionLocation.equals(((TableSplit)o).regionLocation);
}

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

@Override
public CompletableFuture<List<RegionInfo>> getRegions(TableName tableName) {
 if (tableName.equals(META_TABLE_NAME)) {
  return connection.getLocator().getRegionLocation(tableName, null, null, operationTimeoutNs)
    .thenApply(loc -> Collections.singletonList(loc.getRegion()));
 } else {
  return AsyncMetaTableAccessor.getTableHRegionLocations(metaTable, Optional.of(tableName))
    .thenApply(
     locs -> locs.stream().map(loc -> loc.getRegion()).collect(Collectors.toList()));
 }
}

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

/**
 * Returns {@code true} if the given region is part of the {@code _acl_}
 * metadata table.
 */
static boolean isAclRegion(Region region) {
 return ACL_TABLE_NAME.equals(region.getTableDescriptor().getTableName());
}

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

ArrayList<RegionStateNode> getTableRegionStateNodes(final TableName tableName) {
 final ArrayList<RegionStateNode> regions = new ArrayList<RegionStateNode>();
 for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  if (!node.getTable().equals(tableName)) break;
  regions.add(node);
 }
 return regions;
}

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

ArrayList<RegionInfo> getTableRegionsInfo(final TableName tableName) {
 final ArrayList<RegionInfo> regions = new ArrayList<RegionInfo>();
 for (RegionStateNode node: regionsMap.tailMap(tableName.getName()).values()) {
  if (!node.getTable().equals(tableName)) break;
  regions.add(node.getRegionInfo());
 }
 return regions;
}

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

private int countRegionsForTable(TableName tn, Map<RegionInfo,Long> regionSizes) {
 int size = 0;
 for (RegionInfo regionInfo : regionSizes.keySet()) {
  if (tn.equals(regionInfo.getTable())) {
   size++;
  }
 }
 return size;
}

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

@Override
public Optional<Pair<String, String>> getPeerIdAndRemoteWALDir(TableName table) {
 if (table != null && table.equals(TABLE)) {
  return Optional.of(Pair.newPair(PEER_ID, REMOTE_WAL_DIR));
 } else {
  return Optional.empty();
 }
}

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

private int getRegionReportsForTable(Map<RegionInfo,Long> reports, TableName tn) {
  int numReports = 0;
  for (Entry<RegionInfo,Long> entry : reports.entrySet()) {
   if (tn.equals(entry.getKey().getTable())) {
    numReports++;
   }
  }
  return numReports;
 }
}

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

private List<HRegion> getRegionInfo(HRegionServer rs) {
  return rs.getRegions().stream()
   .filter(v -> v.getTableDescriptor().getTableName().equals(tableName))
   .collect(Collectors.toList());
 }
}

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

@Override
 public boolean visit(Result r) throws IOException {
  if (MetaTableAccessor.getRegionInfo(r).getTable().equals(table)) count.incrementAndGet();
  return true;
 }
};

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

@Override
public void preCreateTable(ObserverContext<MasterCoprocessorEnvironment> env,
  TableDescriptor desc, RegionInfo[] regions) throws IOException {
 if (desc.getTableName().equals(TABLE)) {
  throw new AccessDeniedException("Don't allow creation of table");
 }
}

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

@Override
public void preCreateTableAction(
  final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableDescriptor desc,
  final RegionInfo[] regions) throws IOException {
 if (desc.getTableName().equals(TABLE)) {
  throw new AccessDeniedException("Don't allow creation of table");
 }
}

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

@Override
 public void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx,
              RegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
  // only keep primary region's edits
  if (logKey.getTableName().equals(tableName) && info.getReplicaId() == 0) {
   // Presume type is a WALKeyImpl
   entries.add(new Entry((WALKeyImpl)logKey, logEdit));
  }
 }
}

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

protected boolean isTestTable(FakeRSRpcServices rpcServices,
               HBaseProtos.RegionSpecifier regionSpec) throws ServiceException {
 try {
  return TABLE_NAME.equals(
    rpcServices.getRegion(regionSpec).getTableDescriptor().getTableName());
 } catch (IOException ioe) {
  throw new ServiceException(ioe);
 }
}

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

@Override
public void init(RegionCoprocessorEnvironment e) throws IOException {
 this.scanLabelGenerators = VisibilityUtils.getScanLabelGenerators(this.conf);
 if (e.getRegion().getRegionInfo().getTable().equals(LABELS_TABLE_NAME)) {
  this.labelsRegion = e.getRegion();
 }
}

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

@Test
public void testGetTableDescriptor() throws Exception {
 ThriftHBaseServiceHandler handler = createHandler();
 TTableDescriptor tableDescriptor = handler
   .getTableDescriptor(ThriftUtilities.tableNameFromHBase(TableName.valueOf(tableAname)));
 TableDescriptor table = ThriftUtilities.tableDescriptorFromThrift(tableDescriptor);
 assertTrue(table.getTableName().equals(TableName.valueOf(tableAname)));
 assertTrue(table.getColumnFamilies().length == 2);
 assertTrue(table.getColumnFamily(familyAname).getMaxVersions() == 3);
 assertTrue(table.getColumnFamily(familyBname).getMaxVersions() == 2);
}

相关文章