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


Java AssignmentManager类代码示例

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


AssignmentManager类属于org.apache.hadoop.hbase.master包,在下文中一共展示了AssignmentManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMoveToPreviouslyAssignedRS

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
@Test (timeout=300000)
public void testMoveToPreviouslyAssignedRS() throws IOException, InterruptedException {
  byte[] tableName = Bytes.toBytes("testMoveToPreviouslyAssignedRS");
  MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
  HMaster master = cluster.getMaster();
  HBaseAdmin localAdmin = createTable(tableName);
  List<HRegionInfo> tableRegions = localAdmin.getTableRegions(tableName);
  HRegionInfo hri = tableRegions.get(0);
  AssignmentManager am = master.getAssignmentManager();
  assertTrue("Region " + hri.getRegionNameAsString()
    + " should be assigned properly", am.waitForAssignment(hri));
  ServerName server = am.getRegionStates().getRegionServerOfRegion(hri);
  localAdmin.move(hri.getEncodedNameAsBytes(), Bytes.toBytes(server.getServerName()));
  assertEquals("Current region server and region server before move should be same.", server,
    am.getRegionStates().getRegionServerOfRegion(hri));
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:TestAdmin2.java

示例2: scheduleFullRefresh

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
/**
 * Refresh all the region locations.
 *
 * @return true if user created regions got refreshed.
 */
private boolean scheduleFullRefresh() {
  // Protect from anything being null while starting up.
  if (services == null) {
    return false;
  }
  AssignmentManager am = services.getAssignmentManager();

  if (am == null) {
    return false;
  }
  RegionStates regionStates = am.getRegionStates();
  if (regionStates == null) {
    return false;
  }

  Set<HRegionInfo> regions = regionStates.getRegionAssignments().keySet();
  boolean includesUserTables = false;
  for (final HRegionInfo hri : regions) {
    cache.refresh(hri);
    includesUserTables = includesUserTables || !hri.isSystemTable();
  }
  return includesUserTables;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:RegionLocationFinder.java

示例3: OpenedRegionHandler

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
public OpenedRegionHandler(Server server,
    AssignmentManager assignmentManager, HRegionInfo regionInfo,
    OpenRegionCoordination coordination,
    OpenRegionCoordination.OpenRegionDetails ord) {
  super(server, EventType.RS_ZK_REGION_OPENED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  this.coordination = coordination;
  this.ord = ord;
  if(regionInfo.isMetaRegion()) {
    priority = OpenedPriority.META;
  } else if(regionInfo.getTable()
      .getNamespaceAsString().equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
    priority = OpenedPriority.SYSTEM;
  } else {
    priority = OpenedPriority.USER;
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:OpenedRegionHandler.java

示例4: assignRegions

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的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

示例5: waitOnRegionToClearRegionsInTransition

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
/**
 * @return True if region cleared RIT, else false if we timed out waiting.
 * @throws InterruptedIOException
 */
private boolean waitOnRegionToClearRegionsInTransition(AssignmentManager am,
    final HRegionInfo hri, final int timeout)
throws InterruptedIOException {
  try {
    if (!am.waitOnRegionToClearRegionsInTransition(hri, timeout)) {
      // Wait here is to avoid log replay hits current dead server and incur a RPC timeout
      // when replay happens before region assignment completes.
      LOG.warn("Region " + hri.getEncodedName() + " didn't complete assignment in time");
      return false;
    }
  } catch (InterruptedException ie) {
    throw new InterruptedIOException("Caught " + ie +
      " during waitOnRegionToClearRegionsInTransition for " + hri);
  }
  return true;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:ServerCrashProcedure.java

示例6: waitRegionInTransition

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
protected static void waitRegionInTransition(final MasterProcedureEnv env,
    final List<HRegionInfo> regions) throws IOException, CoordinatedStateException {
  final AssignmentManager am = env.getMasterServices().getAssignmentManager();
  final RegionStates states = am.getRegionStates();
  for (final HRegionInfo region : regions) {
    ProcedureSyncWait.waitFor(env, "regions " + region.getRegionNameAsString() + " in transition",
        new ProcedureSyncWait.Predicate<Boolean>() {
      @Override
      public Boolean evaluate() throws IOException {
        if (states.isRegionInState(region, State.FAILED_OPEN)) {
          am.regionOffline(region);
        }
        return !states.isRegionInTransition(region);
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:ProcedureSyncWait.java

示例7: OpenedRegionHandler

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
public OpenedRegionHandler(Server server,
    AssignmentManager assignmentManager, HRegionInfo regionInfo,
    ServerName sn, int expectedVersion) {
  super(server, EventType.RS_ZK_REGION_OPENED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  this.sn = sn;
  this.expectedVersion = expectedVersion;
  if(regionInfo.isRootRegion()) {
    priority = OpenedPriority.ROOT;
  } else if(regionInfo.isMetaRegion()) {
    priority = OpenedPriority.META;
  } else {
    priority = OpenedPriority.USER;
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:OpenedRegionHandler.java

示例8: fixupDaughter

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
/**
 * Check individual daughter is up in .META.; fixup if its not.
 * @param result The contents of the parent row in .META.
 * @param qualifier Which daughter to check for.
 * @return 1 if the daughter is missing and fixed. Otherwise 0
 * @throws IOException
 */
static int fixupDaughter(final Result result, final byte [] qualifier,
    final AssignmentManager assignmentManager,
    final CatalogTracker catalogTracker)
throws IOException {
  HRegionInfo daughter =
    MetaReader.parseHRegionInfoFromCatalogResult(result, qualifier);
  if (daughter == null) return 0;
  if (isDaughterMissing(catalogTracker, daughter)) {
    LOG.info("Fixup; missing daughter " + daughter.getRegionNameAsString());
    MetaEditor.addDaughter(catalogTracker, daughter, null);

    // TODO: Log WARN if the regiondir does not exist in the fs.  If its not
    // there then something wonky about the split -- things will keep going
    // but could be missing references to parent region.

    // And assign it.
    assignmentManager.assign(daughter, true);
    return 1;
  } else {
    LOG.debug("Daughter " + daughter.getRegionNameAsString() + " present");
  }
  return 0;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:31,代码来源:ServerShutdownHandler.java

示例9: checkAndSetEnablingTable

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
static void checkAndSetEnablingTable(final AssignmentManager assignmentManager,
    final TableName tableName) throws IOException {
  // If we have multiple client threads trying to create the table at the
  // same time, given the async nature of the operation, the table
  // could be in a state where hbase:meta table hasn't been updated yet in
  // the process() function.
  // Use enabling state to tell if there is already a request for the same
  // table in progress. This will introduce a new zookeeper call. Given
  // createTable isn't a frequent operation, that should be ok.
  // TODO: now that we have table locks, re-evaluate above -- table locks are not enough.
  // We could have cleared the hbase.rootdir and not zk.  How can we detect this case?
  // Having to clean zk AND hdfs is awkward.
  try {
    if (!assignmentManager.getTableStateManager().setTableStateIfNotInStates(tableName,
      ZooKeeperProtos.Table.State.ENABLING,
      ZooKeeperProtos.Table.State.ENABLING,
      ZooKeeperProtos.Table.State.ENABLED)) {
      throw new TableExistsException(tableName);
    }
  } catch (CoordinatedStateException e) {
    throw new IOException("Unable to ensure that the table will be" +
      " enabling because of a ZooKeeper issue", e);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:25,代码来源:CreateTableHandler.java

示例10: setUpBeforeClass

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf.setInt("hbase.regionserver.handler.count", 2);
  conf.setInt("hbase.regionserver.metahandler.count", 2);

  conf.setInt("hbase.htable.threads.max", POOL_SIZE);
  conf.setInt("hbase.hconnection.threads.max", 2 * POOL_SIZE);
  conf.setInt("hbase.hconnection.threads.core", POOL_SIZE);
  conf.setInt("hbase.hbck.close.timeout", 2 * REGION_ONLINE_TIMEOUT);
  TEST_UTIL.startMiniCluster(3);

  tableExecutorService = new ThreadPoolExecutor(1, POOL_SIZE, 60, TimeUnit.SECONDS,
      new SynchronousQueue<Runnable>(), Threads.newDaemonThreadFactory("testhbck"));

  hbfsckExecutorService = new ScheduledThreadPoolExecutor(POOL_SIZE);

  AssignmentManager assignmentManager =
    TEST_UTIL.getHBaseCluster().getMaster().getAssignmentManager();
  regionStates = assignmentManager.getRegionStates();

  connection = (ClusterConnection) TEST_UTIL.getConnection();

  admin = connection.getAdmin();
  admin.setBalancerRunning(false, true);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:26,代码来源:TestHBaseFsck.java

示例11: OpenedRegionHandler

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
public OpenedRegionHandler(Server server,
    AssignmentManager assignmentManager, HRegionInfo regionInfo,
    ServerName sn, int expectedVersion) {
  super(server, EventType.RS_ZK_REGION_OPENED);
  this.assignmentManager = assignmentManager;
  this.regionInfo = regionInfo;
  this.sn = sn;
  this.expectedVersion = expectedVersion;
  if(regionInfo.isMetaRegion()) {
    priority = OpenedPriority.META;
  } else if(regionInfo.getTable()
      .getNamespaceAsString().equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) {
    priority = OpenedPriority.SYSTEM;
  } else {
    priority = OpenedPriority.USER;
  }
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:18,代码来源:OpenedRegionHandler.java

示例12: OpenRegionHandler

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
protected OpenRegionHandler(final Server server,
    final RegionServerServices rsServices, final HRegionInfo regionInfo,
    final HTableDescriptor htd, EventType eventType,
    final int versionOfOfflineNode) {
  super(server, eventType);
  this.rsServices = rsServices;
  this.regionInfo = regionInfo;
  this.htd = htd;
  this.versionOfOfflineNode = versionOfOfflineNode;
  tomActivated = this.server.getConfiguration().
    getBoolean(AssignmentManager.ASSIGNMENT_TIMEOUT_MANAGEMENT,
      AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_MANAGEMENT);
  assignmentTimeout = this.server.getConfiguration().
    getInt(AssignmentManager.ASSIGNMENT_TIMEOUT,
      AssignmentManager.DEFAULT_ASSIGNMENT_TIMEOUT_DEFAULT);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:17,代码来源:OpenRegionHandler.java

示例13: processDeadRegion

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
/**
 * Process a dead region from a dead RS.  Checks if the region is disabled
 * or if the region has a partially completed split.
 * @param hri
 * @param result
 * @param assignmentManager
 * @param catalogTracker
 * @return Returns true if specified region should be assigned, false if not.
 * @throws IOException
 */
public static boolean processDeadRegion(HRegionInfo hri, Result result,
    AssignmentManager assignmentManager, CatalogTracker catalogTracker)
throws IOException {
  // If table is not disabled but the region is offlined,
  boolean disabled = assignmentManager.getZKTable().isDisabledTable(
      hri.getTableNameAsString());
  if (disabled) return false;
  if (hri.isOffline() && hri.isSplit()) {
    LOG.debug("Offlined and split region " + hri.getRegionNameAsString() +
      "; checking daughter presence");
    fixupDaughters(result, assignmentManager, catalogTracker);
    return false;
  }
  return true;
}
 
开发者ID:lifeng5042,项目名称:RStore,代码行数:26,代码来源:ServerShutdownHandler.java

示例14: fixupDaughter

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
/**
 * Check individual daughter is up in .META.; fixup if its not.
 * @param result The contents of the parent row in .META. - not used
 * @param daughter Which daughter to check for.
 * @return 1 if the daughter is missing and fixed. Otherwise 0
 * @throws IOException
 */
static int fixupDaughter(final Result result, HRegionInfo daughter,
    final AssignmentManager assignmentManager,
    final CatalogTracker catalogTracker)
throws IOException {
  if (daughter == null) return 0;
  if (isDaughterMissing(catalogTracker, daughter)) {
    LOG.info("Fixup; missing daughter " + daughter.getRegionNameAsString());
    MetaEditor.addDaughter(catalogTracker, daughter, null);

    // TODO: Log WARN if the regiondir does not exist in the fs.  If its not
    // there then something wonky about the split -- things will keep going
    // but could be missing references to parent region.

    // And assign it.
    assignmentManager.assign(daughter, true, true);
    return 1;
  } else {
    LOG.debug("Daughter " + daughter.getRegionNameAsString() + " present");
  }
  return 0;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:29,代码来源:ServerShutdownHandler.java

示例15: checkRegionInTransition

import org.apache.hadoop.hbase.master.AssignmentManager; //导入依赖的package包/类
private boolean checkRegionInTransition(ObserverContext<MasterCoprocessorEnvironment> ctx,
    HRegionInfo hri) {
  MasterServices master = ctx.getEnvironment().getMasterServices();
  AssignmentManager am = master.getAssignmentManager();
  boolean isRegionInTransition = false;
  String tableName = hri.getTableNameAsString();
  if (false == IndexUtils.isIndexTable(tableName)) {
    NavigableMap<String, RegionState> regionsInTransition = am.getRegionsInTransition();
    RegionState regionState = regionsInTransition.get(hri.getEncodedName());
    if (regionState != null) {
      isRegionInTransition = true;
    } else {
      String indexTableName = IndexUtils.getIndexTableName(tableName);
      for (Entry<String, RegionState> region : regionsInTransition.entrySet()) {
        HRegionInfo regionInfo = region.getValue().getRegion();
        if (indexTableName.equals(regionInfo.getTableNameAsString())) {
          if (Bytes.compareTo(hri.getStartKey(), regionInfo.getStartKey()) == 0) {
            isRegionInTransition = true;
            break;
          }
        }
      }
    }
  }
  return isRegionInTransition;
}
 
开发者ID:Huawei-Hadoop,项目名称:hindex,代码行数:27,代码来源:IndexMasterObserver.java


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