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


Java ModifyRegionUtils.assignRegions方法代码示例

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


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

示例1: assignRegions

import org.apache.hadoop.hbase.util.ModifyRegionUtils; //导入方法依赖的package包/类
protected static void assignRegions(final MasterProcedureEnv env,
    final TableName tableName, final List<HRegionInfo> regions)
    throws HBaseException, IOException {
  ProcedureSyncWait.waitRegionServers(env);

  final AssignmentManager assignmentManager = env.getMasterServices().getAssignmentManager();

  // Mark the table as Enabling
  assignmentManager.getTableStateManager().setTableState(tableName,
      ZooKeeperProtos.Table.State.ENABLING);

  // Trigger immediate assignment of the regions in round-robin fashion
  ModifyRegionUtils.assignRegions(assignmentManager, regions);

  // Enable table
  assignmentManager.getTableStateManager()
    .setTableState(tableName, ZooKeeperProtos.Table.State.ENABLED);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:CreateTableProcedure.java

示例2: handleCreateTable

import org.apache.hadoop.hbase.util.ModifyRegionUtils; //导入方法依赖的package包/类
/**
 * Responsible of table creation (on-disk and META) and assignment.
 * - Create the table directory and descriptor (temp folder)
 * - Create the on-disk regions (temp folder)
 *   [If something fails here: we've just some trash in temp]
 * - Move the table from temp to the root directory
 *   [If something fails here: we've the table in place but some of the rows required
 *    present in META. (hbck needed)]
 * - Add regions to META
 *   [If something fails here: we don't have regions assigned: table disabled]
 * - Assign regions to Region Servers
 *   [If something fails here: we still have the table in disabled state]
 * - Update ZooKeeper with the enabled state
 */
private void handleCreateTable(TableName tableName)
    throws IOException, CoordinatedStateException {
  Path tempdir = fileSystemManager.getTempDir();
  FileSystem fs = fileSystemManager.getFileSystem();

  // 1. Create Table Descriptor
  Path tempTableDir = FSUtils.getTableDir(tempdir, tableName);
  new FSTableDescriptors(this.conf).createTableDescriptorForTableDirectory(
    tempTableDir, this.hTableDescriptor, false);
  Path tableDir = FSUtils.getTableDir(fileSystemManager.getRootDir(), tableName);

  // 2. Create Regions
  List<HRegionInfo> regionInfos = handleCreateHdfsRegions(tempdir, tableName);
  // 3. Move Table temp directory to the hbase root location
  if (!fs.rename(tempTableDir, tableDir)) {
    throw new IOException("Unable to move table from temp=" + tempTableDir +
      " to hbase root=" + tableDir);
  }

  if (regionInfos != null && regionInfos.size() > 0) {
    // 4. Add regions to META
    addRegionsToMeta(this.catalogTracker, regionInfos);

    // 5. Trigger immediate assignment of the regions in round-robin fashion
    ModifyRegionUtils.assignRegions(assignmentManager, regionInfos);
  }

  // 6. Set table enabled flag up in zk.
  try {
    assignmentManager.getTableStateManager().setTableState(tableName,
      ZooKeeperProtos.Table.State.ENABLED);
  } catch (CoordinatedStateException e) {
    throw new IOException("Unable to ensure that " + tableName + " will be" +
      " enabled because of a ZooKeeper issue", e);
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:51,代码来源:CreateTableHandler.java

示例3: handleCreateTable

import org.apache.hadoop.hbase.util.ModifyRegionUtils; //导入方法依赖的package包/类
/**
 * Responsible of table creation (on-disk and META) and assignment.
 * - Create the table directory and descriptor (temp folder)
 * - Create the on-disk regions (temp folder)
 *   [If something fails here: we've just some trash in temp]
 * - Move the table from temp to the root directory
 *   [If something fails here: we've the table in place but some of the rows required
 *    present in META. (hbck needed)]
 * - Add regions to META
 *   [If something fails here: we don't have regions assigned: table disabled]
 * - Assign regions to Region Servers
 *   [If something fails here: we still have the table in disabled state]
 * - Update ZooKeeper with the enabled state
 */
private void handleCreateTable(TableName tableName)
    throws IOException, CoordinatedStateException {
  Path tempdir = fileSystemManager.getTempDir();
  FileSystem fs = fileSystemManager.getFileSystem();

  // 1. Create Table Descriptor
  Path tempTableDir = FSUtils.getTableDir(tempdir, tableName);
  new FSTableDescriptors(this.conf).createTableDescriptorForTableDirectory(
    tempTableDir, this.hTableDescriptor, false);
  Path tableDir = FSUtils.getTableDir(fileSystemManager.getRootDir(), tableName);

  // 2. Create Regions
  List<HRegionInfo> regionInfos = handleCreateHdfsRegions(tempdir, tableName);
  // 3. Move Table temp directory to the hbase root location
  if (!fs.rename(tempTableDir, tableDir)) {
    throw new IOException("Unable to move table from temp=" + tempTableDir +
      " to hbase root=" + tableDir);
  }

  if (regionInfos != null && regionInfos.size() > 0) {
    // 4. Add regions to META
    addRegionsToMeta(regionInfos, hTableDescriptor.getRegionReplication());
    // 5. Add replicas if needed
    regionInfos = addReplicas(hTableDescriptor, regionInfos);

    // 6. Setup replication for region replicas if needed
    if (hTableDescriptor.getRegionReplication() > 1) {
      ServerRegionReplicaUtil.setupRegionReplicaReplication(conf);
    }

    // 7. Trigger immediate assignment of the regions in round-robin fashion
    ModifyRegionUtils.assignRegions(assignmentManager, regionInfos);
  }

  // 8. Set table enabled flag up in zk.
  try {
    assignmentManager.getTableStateManager().setTableState(tableName,
      ZooKeeperProtos.Table.State.ENABLED);
  } catch (CoordinatedStateException e) {
    throw new IOException("Unable to ensure that " + tableName + " will be" +
      " enabled because of a ZooKeeper issue", e);
  }

  // 8. Update the tabledescriptor cache.
  ((HMaster) this.server).getTableDescriptors().get(tableName);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:61,代码来源:CreateTableHandler.java

示例4: handleCreateTable

import org.apache.hadoop.hbase.util.ModifyRegionUtils; //导入方法依赖的package包/类
/**
 * Responsible of table creation (on-disk and META) and assignment.
 * - Create the table directory and descriptor (temp folder)
 * - Create the on-disk regions (temp folder)
 *   [If something fails here: we've just some trash in temp]
 * - Move the table from temp to the root directory
 *   [If something fails here: we've the table in place but some of the rows required
 *    present in META. (hbck needed)]
 * - Add regions to META
 *   [If something fails here: we don't have regions assigned: table disabled]
 * - Assign regions to Region Servers
 *   [If something fails here: we still have the table in disabled state]
 * - Update ZooKeeper with the enabled state
 */
private void handleCreateTable(TableName tableName)
    throws IOException, CoordinatedStateException {
  Path tempdir = fileSystemManager.getTempDir();
  FileSystem fs = fileSystemManager.getFileSystem();

  // 1. Create Table Descriptor
  Path tempTableDir = FSUtils.getTableDir(tempdir, tableName);
  new FSTableDescriptors(this.conf).createTableDescriptorForTableDirectory(
    tempTableDir, this.hTableDescriptor, false);
  Path tableDir = FSUtils.getTableDir(fileSystemManager.getRootDir(), tableName);

  // 2. Create Regions
  List<HRegionInfo> regionInfos = handleCreateHdfsRegions(tempdir, tableName);
  // 3. Move Table temp directory to the hbase root location
  if (!fs.rename(tempTableDir, tableDir)) {
    throw new IOException("Unable to move table from temp=" + tempTableDir +
      " to hbase root=" + tableDir);
  }

  if (regionInfos != null && regionInfos.size() > 0) {
    // 4. Add regions to META
    addRegionsToMeta(regionInfos);
    // 5. Add replicas if needed
    regionInfos = addReplicas(hTableDescriptor, regionInfos);

    // 6. Trigger immediate assignment of the regions in round-robin fashion
    ModifyRegionUtils.assignRegions(assignmentManager, regionInfos);
  }

  // 7. Set table enabled flag up in zk.
  try {
    assignmentManager.getTableStateManager().setTableState(tableName,
      ZooKeeperProtos.Table.State.ENABLED);
  } catch (CoordinatedStateException e) {
    throw new IOException("Unable to ensure that " + tableName + " will be" +
      " enabled because of a ZooKeeper issue", e);
  }

  // 8. Update the tabledescriptor cache.
  ((HMaster) this.server).getTableDescriptors().get(tableName);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:56,代码来源:CreateTableHandler.java


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