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


Java HTableDescriptor.equals方法代码示例

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


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

示例1: modifyTableSync

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
private void modifyTableSync(Admin admin, TableName tableName, HTableDescriptor htd)
    throws IOException {
  admin.modifyTable(tableName, htd);
  //wait until modify table finishes
  for (int t = 0; t < 100; t++) { //10 sec timeout
    HTableDescriptor td = admin.getTableDescriptor(htd.getTableName());
    if (td.equals(htd)) {
      break;
    }
    Threads.sleep(100);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:13,代码来源:TestMasterObserver.java

示例2: checkAndSyncTableDescToPeers

import org.apache.hadoop.hbase.HTableDescriptor; //导入方法依赖的package包/类
/**
 * Connect to peer and check the table descriptor on peer:
 * <ol>
 * <li>Create the same table on peer when not exist.</li>
 * <li>Throw exception if the table exists on peer cluster but descriptors are not same.</li>
 * </ol>
 * @param tableName name of the table to sync to the peer
 * @param splits table split keys
 * @throws IOException
 */
private void checkAndSyncTableDescToPeers(final TableName tableName, final byte[][] splits)
    throws IOException {
  List<ReplicationPeer> repPeers = listReplicationPeers();
  if (repPeers == null || repPeers.size() <= 0) {
    throw new IllegalArgumentException("Found no peer cluster for replication.");
  }
  
  final TableName onlyTableNameQualifier = TableName.valueOf(tableName.getQualifierAsString());
  
  for (ReplicationPeer repPeer : repPeers) {
    Map<TableName, List<String>> tableCFMap = repPeer.getTableCFs();
    // TODO Currently peer TableCFs will not include namespace so we need to check only for table
    // name without namespace in it. Need to correct this logic once we fix HBASE-11386.
    if (tableCFMap != null && !tableCFMap.containsKey(onlyTableNameQualifier)) {
      continue;
    }

    Configuration peerConf = repPeer.getConfiguration();
    HTableDescriptor htd = null;
    try (Connection conn = ConnectionFactory.createConnection(peerConf);
        Admin admin = this.connection.getAdmin();
        Admin repHBaseAdmin = conn.getAdmin()) {
      htd = admin.getTableDescriptor(tableName);
      HTableDescriptor peerHtd = null;
      if (!repHBaseAdmin.tableExists(tableName)) {
        repHBaseAdmin.createTable(htd, splits);
      } else {
        peerHtd = repHBaseAdmin.getTableDescriptor(tableName);
        if (peerHtd == null) {
          throw new IllegalArgumentException("Failed to get table descriptor for table "
              + tableName.getNameAsString() + " from peer cluster " + repPeer.getId());
        } else if (!peerHtd.equals(htd)) {
          throw new IllegalArgumentException("Table " + tableName.getNameAsString()
              + " exists in peer cluster " + repPeer.getId()
              + ", but the table descriptors are not same when comapred with source cluster."
              + " Thus can not enable the table's replication switch.");
        }
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:52,代码来源:ReplicationAdmin.java


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