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


Java ProtobufUtil.toTableName方法代码示例

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


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

示例1: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.TruncateTableStateData state =
    MasterProcedureProtos.TruncateTableStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(state.getUserInfo());
  if (state.hasTableSchema()) {
    hTableDescriptor = HTableDescriptor.convert(state.getTableSchema());
    tableName = hTableDescriptor.getTableName();
  } else {
    tableName = ProtobufUtil.toTableName(state.getTableName());
  }
  preserveSplits = state.getPreserveSplits();
  if (state.getRegionInfoCount() == 0) {
    regions = null;
  } else {
    regions = new ArrayList<HRegionInfo>(state.getRegionInfoCount());
    for (HBaseProtos.RegionInfo hri: state.getRegionInfoList()) {
      regions.add(HRegionInfo.convert(hri));
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:24,代码来源:TruncateTableProcedure.java

示例2: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.DeleteTableStateData state =
    MasterProcedureProtos.DeleteTableStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(state.getUserInfo());
  tableName = ProtobufUtil.toTableName(state.getTableName());
  if (state.getRegionInfoCount() == 0) {
    regions = null;
  } else {
    regions = new ArrayList<HRegionInfo>(state.getRegionInfoCount());
    for (HBaseProtos.RegionInfo hri: state.getRegionInfoList()) {
      regions.add(HRegionInfo.convert(hri));
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:DeleteTableProcedure.java

示例3: getSchemaAlterStatus

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
/**
 * Get the number of regions of the table that have been updated by the alter.
 *
 * @return Pair indicating the number of regions updated Pair.getFirst is the
 *         regions that are yet to be updated Pair.getSecond is the total number
 *         of regions of the table
 * @throws ServiceException
 */
@Override
public GetSchemaAlterStatusResponse getSchemaAlterStatus(
    RpcController controller, GetSchemaAlterStatusRequest req) throws ServiceException {
  // TODO: currently, we query using the table name on the client side. this
  // may overlap with other table operations or the table operation may
  // have completed before querying this API. We need to refactor to a
  // transaction system in the future to avoid these ambiguities.
  TableName tableName = ProtobufUtil.toTableName(req.getTableName());

  try {
    master.checkInitialized();
    Pair<Integer,Integer> pair = master.assignmentManager.getReopenStatus(tableName);
    GetSchemaAlterStatusResponse.Builder ret = GetSchemaAlterStatusResponse.newBuilder();
    ret.setYetToUpdateRegions(pair.getFirst());
    ret.setTotalRegions(pair.getSecond());
    return ret.build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:MasterRpcServices.java

示例4: setQuota

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
public SetQuotaResponse setQuota(final SetQuotaRequest req) throws IOException,
    InterruptedException {
  checkQuotaSupport();

  if (req.hasUserName()) {
    userLocks.lock(req.getUserName());
    try {
      if (req.hasTableName()) {
        setUserQuota(req.getUserName(), ProtobufUtil.toTableName(req.getTableName()), req);
      } else if (req.hasNamespace()) {
        setUserQuota(req.getUserName(), req.getNamespace(), req);
      } else {
        setUserQuota(req.getUserName(), req);
      }
    } finally {
      userLocks.unlock(req.getUserName());
    }
  } else if (req.hasTableName()) {
    TableName table = ProtobufUtil.toTableName(req.getTableName());
    tableLocks.lock(table);
    try {
      setTableQuota(table, req);
    } finally {
      tableLocks.unlock(table);
    }
  } else if (req.hasNamespace()) {
    namespaceLocks.lock(req.getNamespace());
    try {
      setNamespaceQuota(req.getNamespace(), req);
    } finally {
      namespaceLocks.unlock(req.getNamespace());
    }
  } else {
    throw new DoNotRetryIOException(new UnsupportedOperationException(
        "a user, a table or a namespace must be specified"));
  }
  return SetQuotaResponse.newBuilder().build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:MasterQuotaManager.java

示例5: getPriority

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
public int getPriority(RPCProtos.RequestHeader header, Message param, User user) {
  // Yes this is copy pasted from the base class but it keeps from having to look in the
  // annotatedQos table twice something that could get costly since this is called for
  // every single RPC request.
  int priorityByAnnotation = getAnnotatedPriority(header);
  if (priorityByAnnotation >= 0) {
    return priorityByAnnotation;
  }

  // If meta is moving then all the other of reports of state transitions will be
  // un able to edit meta. Those blocked reports should not keep the report that opens meta from
  // running. Hence all reports of meta transitioning should always be in a different thread.
  // This keeps from deadlocking the cluster.
  if (param instanceof RegionServerStatusProtos.ReportRegionStateTransitionRequest) {
    // Regions are moving. Lets see which ones.
    RegionServerStatusProtos.ReportRegionStateTransitionRequest
        tRequest = (RegionServerStatusProtos.ReportRegionStateTransitionRequest) param;
    for (RegionServerStatusProtos.RegionStateTransition rst : tRequest.getTransitionList()) {
      if (rst.getRegionInfoList() != null) {
        for (HBaseProtos.RegionInfo info : rst.getRegionInfoList()) {
          TableName tn = ProtobufUtil.toTableName(info.getTableName());
          if (tn.isSystemTable()) {
            return HConstants.SYSTEMTABLE_QOS;
          }
        }
      }
    }
    return HConstants.NORMAL_QOS;
  }

  // Handle the rest of the different reasons to change priority.
  return getBasePriority(header, param);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:34,代码来源:MasterAnnotationReadingPriorityFunction.java

示例6: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.ModifyColumnFamilyStateData modifyCFMsg =
      MasterProcedureProtos.ModifyColumnFamilyStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(modifyCFMsg.getUserInfo());
  tableName = ProtobufUtil.toTableName(modifyCFMsg.getTableName());
  cfDescriptor = HColumnDescriptor.convert(modifyCFMsg.getColumnfamilySchema());
  if (modifyCFMsg.hasUnmodifiedTableSchema()) {
    unmodifiedHTableDescriptor = HTableDescriptor.convert(modifyCFMsg.getUnmodifiedTableSchema());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:ModifyColumnFamilyProcedure.java

示例7: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.DisableTableStateData disableTableMsg =
      MasterProcedureProtos.DisableTableStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(disableTableMsg.getUserInfo());
  tableName = ProtobufUtil.toTableName(disableTableMsg.getTableName());
  skipTableStateCheck = disableTableMsg.getSkipTableStateCheck();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:DisableTableProcedure.java

示例8: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.AddColumnFamilyStateData addCFMsg =
      MasterProcedureProtos.AddColumnFamilyStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(addCFMsg.getUserInfo());
  tableName = ProtobufUtil.toTableName(addCFMsg.getTableName());
  cfDescriptor = HColumnDescriptor.convert(addCFMsg.getColumnfamilySchema());
  if (addCFMsg.hasUnmodifiedTableSchema()) {
    unmodifiedHTableDescriptor = HTableDescriptor.convert(addCFMsg.getUnmodifiedTableSchema());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:AddColumnFamilyProcedure.java

示例9: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);

  MasterProcedureProtos.EnableTableStateData enableTableMsg =
      MasterProcedureProtos.EnableTableStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(enableTableMsg.getUserInfo());
  tableName = ProtobufUtil.toTableName(enableTableMsg.getTableName());
  skipTableStateCheck = enableTableMsg.getSkipTableStateCheck();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:EnableTableProcedure.java

示例10: deserializeStateData

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public void deserializeStateData(final InputStream stream) throws IOException {
  super.deserializeStateData(stream);
  MasterProcedureProtos.DeleteColumnFamilyStateData deleteCFMsg =
      MasterProcedureProtos.DeleteColumnFamilyStateData.parseDelimitedFrom(stream);
  user = MasterProcedureUtil.toUserInfo(deleteCFMsg.getUserInfo());
  tableName = ProtobufUtil.toTableName(deleteCFMsg.getTableName());
  familyName = deleteCFMsg.getColumnfamilyName().toByteArray();

  if (deleteCFMsg.hasUnmodifiedTableSchema()) {
    unmodifiedHTableDescriptor = HTableDescriptor.convert(deleteCFMsg.getUnmodifiedTableSchema());
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:DeleteColumnFamilyProcedure.java

示例11: reportRegionStateTransition

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
@Override
public ReportRegionStateTransitionResponse reportRegionStateTransition(RpcController c,
    ReportRegionStateTransitionRequest req) throws ServiceException {
  try {
    master.checkServiceStarted();
    RegionStateTransition rt = req.getTransition(0);
    TableName tableName = ProtobufUtil.toTableName(
      rt.getRegionInfo(0).getTableName());
    RegionStates regionStates = master.assignmentManager.getRegionStates();
    if (!(TableName.META_TABLE_NAME.equals(tableName)
        && regionStates.getRegionState(HRegionInfo.FIRST_META_REGIONINFO) != null)
          && !master.assignmentManager.isFailoverCleanupDone()) {
      // Meta region is assigned before master finishes the
      // failover cleanup. So no need this check for it
      throw new PleaseHoldException("Master is rebuilding user regions");
    }
    ServerName sn = ProtobufUtil.toServerName(req.getServer());
    String error = master.assignmentManager.onRegionTransition(sn, rt);
    ReportRegionStateTransitionResponse.Builder rrtr =
      ReportRegionStateTransitionResponse.newBuilder();
    if (error != null) {
      rrtr.setErrorMessage(error);
    }
    return rrtr.build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:29,代码来源:MasterRpcServices.java

示例12: convert

import org.apache.hadoop.hbase.protobuf.ProtobufUtil; //导入方法依赖的package包/类
/**
 * Convert a RegionInfo to a HRegionInfo
 *
 * @param proto the RegionInfo to convert
 * @return the converted HRegionInfho
 */
public static HRegionInfo convert(final RegionInfo proto) {
  if (proto == null) return null;
  TableName tableName =
      ProtobufUtil.toTableName(proto.getTableName());
  if (tableName.equals(TableName.META_TABLE_NAME)) {
    return RegionReplicaUtil.getRegionInfoForReplica(FIRST_META_REGIONINFO,
        proto.getReplicaId());
  }
  long regionId = proto.getRegionId();
  int replicaId = proto.hasReplicaId() ? proto.getReplicaId() : DEFAULT_REPLICA_ID;
  byte[] startKey = null;
  byte[] endKey = null;
  if (proto.hasStartKey()) {
    startKey = proto.getStartKey().toByteArray();
  }
  if (proto.hasEndKey()) {
    endKey = proto.getEndKey().toByteArray();
  }
  boolean split = false;
  if (proto.hasSplit()) {
    split = proto.getSplit();
  }
  HRegionInfo hri = new HRegionInfo(
      tableName,
      startKey,
      endKey, split, regionId, replicaId);
  if (proto.hasOffline()) {
    hri.setOffline(proto.getOffline());
  }
  return hri;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:38,代码来源:HRegionInfo.java


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