当前位置: 首页>>代码示例>>Java>>正文


Java TableName.compareTo方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.TableName.compareTo方法的典型用法代码示例。如果您正苦于以下问题:Java TableName.compareTo方法的具体用法?Java TableName.compareTo怎么用?Java TableName.compareTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.TableName的用法示例。


在下文中一共展示了TableName.compareTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generatePuts

import org.apache.hadoop.hbase.TableName; //导入方法依赖的package包/类
/**
 * Generate set of puts to add to new meta.  This expects the tables to be
 * clean with no overlaps or holes.  If there are any problems it returns null.
 *
 * @return An array list of puts to do in bulk, null if tables have problems
 */
private ArrayList<Put> generatePuts(
    SortedMap<TableName, TableInfo> tablesInfo) throws IOException {
  ArrayList<Put> puts = new ArrayList<Put>();
  boolean hasProblems = false;
  for (Entry<TableName, TableInfo> e : tablesInfo.entrySet()) {
    TableName name = e.getKey();

    // skip "hbase:meta"
    if (name.compareTo(TableName.META_TABLE_NAME) == 0) {
      continue;
    }

    TableInfo ti = e.getValue();
    for (Entry<byte[], Collection<HbckInfo>> spl : ti.sc.getStarts().asMap()
        .entrySet()) {
      Collection<HbckInfo> his = spl.getValue();
      int sz = his.size();
      if (sz != 1) {
        // problem
        LOG.error("Split starting at " + Bytes.toStringBinary(spl.getKey())
            + " had " +  sz + " regions instead of exactly 1." );
        hasProblems = true;
        continue;
      }

      // add the row directly to meta.
      HbckInfo hi = his.iterator().next();
      HRegionInfo hri = hi.getHdfsHRI(); // hi.metaEntry;
      Put p = MetaTableAccessor.makePutFromRegionInfo(hri);
      puts.add(p);
    }
  }
  return hasProblems ? null : puts;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:41,代码来源:HBaseFsck.java

示例2: isTableAvailable

import org.apache.hadoop.hbase.TableName; //导入方法依赖的package包/类
@Override
public boolean isTableAvailable(final TableName tableName) throws IOException {
  final AtomicBoolean available = new AtomicBoolean(true);
  final AtomicInteger regionCount = new AtomicInteger(0);
  MetaScannerVisitor visitor = new MetaScannerVisitorBase() {
    @Override
    public boolean processRow(Result row) throws IOException {
      HRegionInfo info = MetaScanner.getHRegionInfo(row);
      if (info != null && !info.isSplitParent()) {
        if (tableName.equals(info.getTable())) {
          ServerName server = HRegionInfo.getServerName(row);
          if (server == null) {
            available.set(false);
            return false;
          }
          regionCount.incrementAndGet();
        } else if (tableName.compareTo(info.getTable()) < 0) {
          // Return if we are done with the current table
          return false;
        }
      }
      return true;
    }
  };
  MetaScanner.metaScan(this, visitor, tableName);
  return available.get() && (regionCount.get() > 0);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:ConnectionManager.java


注:本文中的org.apache.hadoop.hbase.TableName.compareTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。