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


Java TableName.OLD_ROOT_TABLE_NAME属性代码示例

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


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

示例1: readFields

@Override
public void readFields(DataInput in) throws IOException {
  Version version = Version.UNVERSIONED;
  // HLogKey was not versioned in the beginning.
  // In order to introduce it now, we make use of the fact
  // that encodedRegionName was written with Bytes.writeByteArray,
  // which encodes the array length as a vint which is >= 0.
  // Hence if the vint is >= 0 we have an old version and the vint
  // encodes the length of encodedRegionName.
  // If < 0 we just read the version and the next vint is the length.
  // @see Bytes#readByteArray(DataInput)
  setScopes(null); // writable HLogKey does not contain scopes
  int len = WritableUtils.readVInt(in);
  byte[] tablenameBytes = null;
  if (len < 0) {
    // what we just read was the version
    version = Version.fromCode(len);
    // We only compress V2 of WALkey.
    // If compression is on, the length is handled by the dictionary
    if (compressionContext == null || !version.atLeast(Version.COMPRESSED)) {
      len = WritableUtils.readVInt(in);
    }
  }
  if (compressionContext == null || !version.atLeast(Version.COMPRESSED)) {
    this.encodedRegionName = new byte[len];
    in.readFully(this.encodedRegionName);
    tablenameBytes = Bytes.readByteArray(in);
  } else {
    this.encodedRegionName = Compressor.readCompressed(in, compressionContext.regionDict);
    tablenameBytes = Compressor.readCompressed(in, compressionContext.tableDict);
  }

  this.logSeqNum = in.readLong();
  this.writeTime = in.readLong();

  this.clusterIds.clear();
  if (version.atLeast(Version.INITIAL)) {
    if (in.readBoolean()) {
      // read the older log
      // Definitely is the originating cluster
      clusterIds.add(new UUID(in.readLong(), in.readLong()));
    }
  } else {
    try {
      // dummy read (former byte cluster id)
      in.readByte();
    } catch(EOFException e) {
      // Means it's a very old key, just continue
      if (LOG.isTraceEnabled()) LOG.trace(e);
    }
  }
  try {
    this.tablename = TableName.valueOf(tablenameBytes);
  } catch (IllegalArgumentException iae) {
    if (Bytes.toString(tablenameBytes).equals(TableName.OLD_META_STR)) {
      // It is a pre-namespace meta table edit, continue with new format.
      LOG.info("Got an old .META. edit, continuing with new format ");
      this.tablename = TableName.META_TABLE_NAME;
      this.encodedRegionName = HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes();
    } else if (Bytes.toString(tablenameBytes).equals(TableName.OLD_ROOT_STR)) {
      this.tablename = TableName.OLD_ROOT_TABLE_NAME;
       throw iae;
    } else throw iae;
  }
  // Do not need to read the clusters information as we are using protobufs from 0.95
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:66,代码来源:HLogKey.java


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