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


Java AssignmentManager.waitOnRegionToClearRegionsInTransition方法代码示例

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


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

示例1: 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

示例2: waitForRITtoBeZero

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
private void waitForRITtoBeZero(HMaster master) throws IOException {
  // wait for assignments to finish
  AssignmentManager mgr = master.getAssignmentManager();
  Collection<AssignmentManager.RegionState> transRegions =
      mgr.getRegionsInTransition().values();
  for (AssignmentManager.RegionState state : transRegions) {
    mgr.waitOnRegionToClearRegionsInTransition(state.getRegion());
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:TestMasterObserver.java

示例3: postAssign

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
public void postAssign(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo regionInfo)
    throws IOException {
  LOG.info("Entering into postAssign of region " + regionInfo.getRegionNameAsString() + '.');

  if (!IndexUtils.isIndexTable(regionInfo.getTable().getName())) {
    MasterServices master = ctx.getEnvironment().getMasterServices();
    LoadBalancer balancer = master.getAssignmentManager().getBalancer();
    AssignmentManager am = master.getAssignmentManager();
    RegionStates regionStates = am.getRegionStates();
    // waiting until user region is removed from transition.
    long timeout =
        master.getConfiguration()
            .getLong("hbase.bulk.assignment.waiton.empty.rit", 5 * 60 * 1000);
    try {
      am.waitOnRegionToClearRegionsInTransition(regionInfo, timeout);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while region in assignment.");
      }
    }
    ServerName sn = regionStates.getRegionServerOfRegion(regionInfo);
    TableName indexTableName =
        TableName.valueOf(IndexUtils.getIndexTableName(regionInfo.getTableName()));
    List<HRegionInfo> tableRegions = regionStates.getRegionsOfTable(indexTableName);
    for (HRegionInfo hRegionInfo : tableRegions) {
      if (0 == Bytes.compareTo(hRegionInfo.getStartKey(), regionInfo.getStartKey())) {
        am.addPlan(hRegionInfo.getEncodedName(), new RegionPlan(hRegionInfo, null, sn));
        LOG.info("Assigning region " + hRegionInfo.getRegionNameAsString() + " to server " + sn
            + '.');
        balancer.regionOnline(hRegionInfo, sn);
        am.assign(hRegionInfo, true, false);
        break;
      }
    }
  }
  LOG.info("Exiting from postAssign " + regionInfo.getRegionNameAsString() + '.');
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:39,代码来源:IndexMasterObserver.java

示例4: postMove

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
public void postMove(ObserverContext<MasterCoprocessorEnvironment> ctx, HRegionInfo regionInfo,
    ServerName srcServer, ServerName destServer) throws IOException {
  LOG.info("Entering into postMove " + regionInfo.getRegionNameAsString() + '.');
  if (!IndexUtils.isIndexTable(regionInfo.getTable().getNameAsString())) {
    MasterServices master = ctx.getEnvironment().getMasterServices();
    AssignmentManager am = master.getAssignmentManager();
    // waiting until user region is removed from transition.
    long timeout =
        master.getConfiguration()
            .getLong("hbase.bulk.assignment.waiton.empty.rit", 5 * 60 * 1000);
    try {
      am.waitOnRegionToClearRegionsInTransition(regionInfo, timeout);
      destServer = am.getRegionStates().getRegionServerOfRegion(regionInfo);
      am.getBalancer().regionOnline(regionInfo, destServer);
    } catch (InterruptedException e) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Interrupted while region in assignment.");
      }
    }
    TableName indexTableName =
        TableName.valueOf(IndexUtils.getIndexTableName(regionInfo.getTable().getNameAsString()));
    List<HRegionInfo> tableRegions = am.getRegionStates().getRegionsOfTable(indexTableName);
    for (HRegionInfo indexRegionInfo : tableRegions) {
      if (0 == Bytes.compareTo(indexRegionInfo.getStartKey(), regionInfo.getStartKey())) {
        LOG.info("Assigning region " + indexRegionInfo.getRegionNameAsString() + "from "
            + srcServer + " to server " + destServer + '.');
        am.getBalancer().regionOnline(indexRegionInfo, destServer);
        am.addPlan(indexRegionInfo.getEncodedName(), new RegionPlan(indexRegionInfo, null,
            destServer));
        am.unassign(indexRegionInfo);
      }
    }
  }
  LOG.info("Exiting from postMove " + regionInfo.getRegionNameAsString() + '.');
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:37,代码来源:IndexMasterObserver.java

示例5: process

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
public void process() throws IOException {
  boolean gotException = true; 
  try {
    AssignmentManager am = this.services.getAssignmentManager();
    this.services.getMasterFileSystem().setLogRecoveryMode();
    boolean distributedLogReplay = 
      (this.services.getMasterFileSystem().getLogRecoveryMode() == RecoveryMode.LOG_REPLAY);
    try {
      if (this.shouldSplitWal) {
        LOG.info("Splitting hbase:meta logs for " + serverName);
        if (distributedLogReplay) {
          Set<HRegionInfo> regions = new HashSet<HRegionInfo>();
          regions.add(HRegionInfo.FIRST_META_REGIONINFO);
          this.services.getMasterFileSystem().prepareLogReplay(serverName, regions);
        } else {
          this.services.getMasterFileSystem().splitMetaLog(serverName);
        }
        am.getRegionStates().logSplit(HRegionInfo.FIRST_META_REGIONINFO);
      }
    } catch (IOException ioe) {
      this.services.getExecutorService().submit(this);
      this.deadServers.add(serverName);
      throw new IOException("failed log splitting for " + serverName + ", will retry", ioe);
    }

    // Assign meta if we were carrying it.
    // Check again: region may be assigned to other where because of RIT
    // timeout
    if (am.isCarryingMeta(serverName)) {
      LOG.info("Server " + serverName + " was carrying META. Trying to assign.");
      am.regionOffline(HRegionInfo.FIRST_META_REGIONINFO);
      verifyAndAssignMetaWithRetries();
    } else if (!server.getMetaTableLocator().isLocationAvailable(this.server.getZooKeeper())) {
      // the meta location as per master is null. This could happen in case when meta assignment
      // in previous run failed, while meta znode has been updated to null. We should try to
      // assign the meta again.
      verifyAndAssignMetaWithRetries();
    } else {
      LOG.info("META has been assigned to otherwhere, skip assigning.");
    }

    try {
      if (this.shouldSplitWal && distributedLogReplay) {
        if (!am.waitOnRegionToClearRegionsInTransition(HRegionInfo.FIRST_META_REGIONINFO,
          regionAssignmentWaitTimeout)) {
          // 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 " + HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()
              + " didn't complete assignment in time");
        }
        this.services.getMasterFileSystem().splitMetaLog(serverName);
      }
    } catch (Exception ex) {
      if (ex instanceof IOException) {
        this.services.getExecutorService().submit(this);
        this.deadServers.add(serverName);
        throw new IOException("failed log splitting for " + serverName + ", will retry", ex);
      } else {
        throw new IOException(ex);
      }
    }

    gotException = false;
  } finally {
    if (gotException){
      // If we had an exception, this.deadServers.finish will be skipped in super.process()
      this.deadServers.finish(serverName);
    }     
  }

  super.process();
  // Clear this counter on successful handling.
  this.eventExceptionCount.set(0);
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:76,代码来源:MetaServerShutdownHandler.java

示例6: process

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
public void process() throws IOException {
  boolean gotException = true; 
  try {
    AssignmentManager am = this.services.getAssignmentManager();
    try {
      if (this.shouldSplitHlog) {
        LOG.info("Splitting hbase:meta logs for " + serverName);
        if (this.distributedLogReplay) {
          Set<HRegionInfo> regions = new HashSet<HRegionInfo>();
          regions.add(HRegionInfo.FIRST_META_REGIONINFO);
          this.services.getMasterFileSystem().prepareLogReplay(serverName, regions);
        } else {
          this.services.getMasterFileSystem().splitMetaLog(serverName);
        }
        am.getRegionStates().logSplit(HRegionInfo.FIRST_META_REGIONINFO);
      }
    } catch (IOException ioe) {
      this.services.getExecutorService().submit(this);
      this.deadServers.add(serverName);
      throw new IOException("failed log splitting for " + serverName + ", will retry", ioe);
    }

    // Assign meta if we were carrying it.
    // Check again: region may be assigned to other where because of RIT
    // timeout
    if (am.isCarryingMeta(serverName)) {
      LOG.info("Server " + serverName + " was carrying META. Trying to assign.");
      am.regionOffline(HRegionInfo.FIRST_META_REGIONINFO);
      verifyAndAssignMetaWithRetries();
    } else if (!this.services.getCatalogTracker().isMetaLocationAvailable()) {
      // the meta location as per master is null. This could happen in case when meta assignment
      // in previous run failed, while meta znode has been updated to null. We should try to
      // assign the meta again.
      verifyAndAssignMetaWithRetries();
    } else {
      LOG.info("META has been assigned to otherwhere, skip assigning.");
    }

    try {
      if (this.shouldSplitHlog && this.distributedLogReplay) {
        if (!am.waitOnRegionToClearRegionsInTransition(HRegionInfo.FIRST_META_REGIONINFO,
          regionAssignmentWaitTimeout)) {
          // 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 " + HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()
              + " didn't complete assignment in time");
        }
        this.services.getMasterFileSystem().splitMetaLog(serverName);
      }
    } catch (Exception ex) {
      if (ex instanceof IOException) {
        this.services.getExecutorService().submit(this);
        this.deadServers.add(serverName);
        throw new IOException("failed log splitting for " + serverName + ", will retry", ex);
      } else {
        throw new IOException(ex);
      }
    }

    gotException = false;
  } finally {
    if (gotException){
      // If we had an exception, this.deadServers.finish will be skipped in super.process()
      this.deadServers.finish(serverName);
    }     
  }

  super.process();
  // Clear this counter on successful handling.
  this.eventExceptionCount.set(0);
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:73,代码来源:MetaServerShutdownHandler.java

示例7: process

import org.apache.hadoop.hbase.master.AssignmentManager; //导入方法依赖的package包/类
@Override
public void process() throws IOException {
  boolean gotException = true; 
  try {
    AssignmentManager am = this.services.getAssignmentManager();
    try {
      if (this.shouldSplitHlog) {
        LOG.info("Splitting hbase:meta logs for " + serverName);
        if (this.distributedLogReplay) {
          Set<HRegionInfo> regions = new HashSet<HRegionInfo>();
          regions.add(HRegionInfo.FIRST_META_REGIONINFO);
          this.services.getMasterFileSystem().prepareLogReplay(serverName, regions);
        } else {
          this.services.getMasterFileSystem().splitMetaLog(serverName);
        }
        am.getRegionStates().logSplit(HRegionInfo.FIRST_META_REGIONINFO);
      }
    } catch (IOException ioe) {
      this.services.getExecutorService().submit(this);
      this.deadServers.add(serverName);
      throw new IOException("failed log splitting for " + serverName + ", will retry", ioe);
    }

    // Assign meta if we were carrying it.
    // Check again: region may be assigned to other where because of RIT
    // timeout
    if (am.isCarryingMeta(serverName)) {
      LOG.info("Server " + serverName + " was carrying META. Trying to assign.");
      am.regionOffline(HRegionInfo.FIRST_META_REGIONINFO);
      verifyAndAssignMetaWithRetries();
    } else if (!this.services.getCatalogTracker().isMetaLocationAvailable()) {
      // the meta location as per master is null. This could happen in case when meta assignment
      // in previous run failed, while meta znode has been updated to null. We should try to
      // assign the meta again.
      verifyAndAssignMetaWithRetries();
    } else {
      LOG.info("META has been assigned to otherwhere, skip assigning.");
    }

    try {
      if (this.shouldSplitHlog && this.distributedLogReplay) {
        if (!am.waitOnRegionToClearRegionsInTransition(HRegionInfo.FIRST_META_REGIONINFO,
          regionAssignmentWaitTimeout)) {
          // 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 " + HRegionInfo.FIRST_META_REGIONINFO.getEncodedName()
              + " didn't complete assignment in time");
        }
        this.services.getMasterFileSystem().splitMetaLog(serverName);
      }
    } catch (Exception ex) {
      if (ex instanceof IOException) {
        this.services.getExecutorService().submit(this);
        this.deadServers.add(serverName);
        throw new IOException("failed log splitting for " + serverName + ", will retry", ex);
      } else {
        throw new IOException(ex);
      }
    }

    gotException = false;
  } finally {
    if (gotException){
      // If we had an exception, this.deadServers.finish will be skipped in super.process()
      this.deadServers.finish(serverName);
    }     
  }
  
  super.process();
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:71,代码来源:MetaServerShutdownHandler.java


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