• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java WALTrailer类的典型用法和代码示例

java 1次浏览

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

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

示例1: writeWALTrailer

点赞 3

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
private void writeWALTrailer() {
  try {
    int trailerSize = 0;
    if (this.trailer == null) {
      // use default trailer.
      LOG.warn("WALTrailer is null. Continuing with default.");
      this.trailer = buildWALTrailer(WALTrailer.newBuilder());
      trailerSize = this.trailer.getSerializedSize();
    } else if ((trailerSize = this.trailer.getSerializedSize()) > this.trailerWarnSize) {
      // continue writing after warning the user.
      LOG.warn("Please investigate WALTrailer usage. Trailer size > maximum size : " +
        trailerSize + " > " + this.trailerWarnSize);
    }
    this.trailer.writeTo(output);
    output.writeInt(trailerSize);
    output.write(ProtobufLogReader.PB_WAL_COMPLETE_MAGIC);
    this.trailerWritten = true;
  } catch (IOException ioe) {
    LOG.warn("Failed to write trailer, non-fatal, continuing...", ioe);
  }
}
 

开发者ID:fengchen8086,
项目名称:ditb,
代码行数:22,
代码来源:ProtobufLogWriter.java

示例2: writeWALTrailer

点赞 3

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
private void writeWALTrailer() {
  try {
    int trailerSize = 0;
    if (this.trailer == null) {
      // use default trailer.
      LOG.warn("WALTrailer is null. Continuing with default.");
      this.trailer = buildWALTrailer(WALTrailer.newBuilder());
      trailerSize = this.trailer.getSerializedSize();
    } else if ((trailerSize = this.trailer.getSerializedSize()) > this.trailerWarnSize) {
      // continue writing after warning the user.
      LOG.warn("Please investigate WALTrailer usage. Trailer size > maximum size : " +
        trailerSize + " > " + this.trailerWarnSize);
    }
    this.trailer.writeTo(output);
    output.writeInt(trailerSize);
    output.write(ProtobufLogReader.PB_WAL_COMPLETE_MAGIC);
    this.trailerWritten = true;
  } catch (IOException ioe) {
    LOG.error("Got IOException while writing trailer", ioe);
  }
}
 

开发者ID:grokcoder,
项目名称:pbase,
代码行数:22,
代码来源:ProtobufLogWriter.java

示例3: writeWALTrailer

点赞 3

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
private void writeWALTrailer() {
  try {
    int trailerSize = 0;
    if (this.trailer == null) {
      // use default trailer.
      LOG.warn("WALTrailer is null. Continuing with default.");
      this.trailer = WALTrailer.newBuilder().build();
      trailerSize = this.trailer.getSerializedSize();
    } else if ((trailerSize = this.trailer.getSerializedSize()) > this.trailerWarnSize) {
      // continue writing after warning the user.
      LOG.warn("Please investigate WALTrailer usage. Trailer size > maximum size : " +
        trailerSize + " > " + this.trailerWarnSize);
    }
    this.trailer.writeTo(output);
    this.output.writeInt(trailerSize);
    this.output.write(ProtobufLogReader.PB_WAL_COMPLETE_MAGIC);
    this.trailerWritten = true;
  } catch (IOException ioe) {
    LOG.error("Got IOException while writing trailer", ioe);
  }
}
 

开发者ID:cloud-software-foundation,
项目名称:c5,
代码行数:22,
代码来源:ProtobufLogWriter.java

示例4: setTrailerIfPresent

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * To check whether a trailer is present in a WAL, it seeks to position (fileLength -
 * PB_WAL_COMPLETE_MAGIC.size() - Bytes.SIZEOF_INT). It reads the int value to know the size of
 * the trailer, and checks whether the trailer is present at the end or not by comparing the last
 * PB_WAL_COMPLETE_MAGIC.size() bytes. In case trailer is not present, it returns false;
 * otherwise, sets the trailer and sets this.walEditsStopOffset variable up to the point just
 * before the trailer.
 * <ul>
 * The trailer is ignored in case:
 * <li>fileLength is 0 or not correct (when file is under recovery, etc).
 * <li>the trailer size is negative.
 * </ul>
 * <p>
 * In case the trailer size > this.trailerMaxSize, it is read after a WARN message.
 * @return true if a valid trailer is present
 * @throws IOException
 */
private boolean setTrailerIfPresent() {
  try {
    long trailerSizeOffset = this.fileLength - (PB_WAL_COMPLETE_MAGIC.length + Bytes.SIZEOF_INT);
    if (trailerSizeOffset <= 0) return false;// no trailer possible.
    this.seekOnFs(trailerSizeOffset);
    // read the int as trailer size.
    int trailerSize = this.inputStream.readInt();
    ByteBuffer buf = ByteBuffer.allocate(ProtobufLogReader.PB_WAL_COMPLETE_MAGIC.length);
    this.inputStream.readFully(buf.array(), buf.arrayOffset(), buf.capacity());
    if (!Arrays.equals(buf.array(), PB_WAL_COMPLETE_MAGIC)) {
      LOG.trace("No trailer found.");
      return false;
    }
    if (trailerSize < 0) {
      LOG.warn("Invalid trailer Size " + trailerSize + ", ignoring the trailer");
      return false;
    } else if (trailerSize > this.trailerWarnSize) {
      // continue reading after warning the user.
      LOG.warn("Please investigate WALTrailer usage. Trailer size > maximum configured size : "
        + trailerSize + " > " + this.trailerWarnSize);
    }
    // seek to the position where trailer starts.
    long positionOfTrailer = trailerSizeOffset - trailerSize;
    this.seekOnFs(positionOfTrailer);
    // read the trailer.
    buf = ByteBuffer.allocate(trailerSize);// for trailer.
    this.inputStream.readFully(buf.array(), buf.arrayOffset(), buf.capacity());
    trailer = WALTrailer.parseFrom(buf.array());
    this.walEditsStopOffset = positionOfTrailer;
    return true;
  } catch (IOException ioe) {
    LOG.warn("Got IOE while reading the trailer. Continuing as if no trailer is present.", ioe);
  }
  return false;
}
 

开发者ID:fengchen8086,
项目名称:ditb,
代码行数:53,
代码来源:ProtobufLogReader.java

示例5: buildWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
WALTrailer buildWALTrailer(WALTrailer.Builder builder) {
  return builder.build();
}
 

开发者ID:fengchen8086,
项目名称:ditb,
代码行数:4,
代码来源:ProtobufLogWriter.java

示例6: setWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
void setWALTrailer(WALTrailer walTrailer) {
  this.trailer = walTrailer;
}
 

开发者ID:fengchen8086,
项目名称:ditb,
代码行数:4,
代码来源:ProtobufLogWriter.java

示例7: getWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
@Override
public WALTrailer getWALTrailer() {
  return trailer;
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:5,
代码来源:ProtobufLogReader.java

示例8: getWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
@Override
public WALTrailer getWALTrailer() {
  return null;
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:5,
代码来源:ReaderBase.java

示例9: buildWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
protected WALTrailer buildWALTrailer(WALTrailer.Builder builder) {
  return builder.build();
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:4,
代码来源:ProtobufLogWriter.java

示例10: setWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
@Override
public void setWALTrailer(WALTrailer walTrailer) {
  this.trailer = walTrailer;
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:5,
代码来源:ProtobufLogWriter.java

示例11: setWALTrailer

点赞 2

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * This method is empty as trailer is added only in Protobuf based hlog readers/writers.
 */
@Override
public void setWALTrailer(WALTrailer walTrailer) {
}
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:7,
代码来源:SequenceFileLogWriter.java

示例12: getWALTrailer

点赞 1

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * @return the WALTrailer of the current HLog. It may be null in case of legacy or corrupt WAL
 *         files.
 */
// TODO: What we need a trailer on WAL for?
WALTrailer getWALTrailer();
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:7,
代码来源:HLog.java

示例13: setWALTrailer

点赞 1

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * Sets HLog's WALTrailer. This trailer is appended at the end of WAL on closing.
 * @param walTrailer trailer to append to WAL.
 */
void setWALTrailer(WALTrailer walTrailer);
 

开发者ID:tenggyut,
项目名称:HIndex,
代码行数:6,
代码来源:HLog.java

示例14: getWALTrailer

点赞 1

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * @return the WALTrailer of the current HLog. It may be null in case of legacy or corrupt WAL
 * files.
 */
// TODO: What we need a trailer on WAL for?  It won't be present on last WAL most of the time.
// What then?
WALTrailer getWALTrailer();
 

开发者ID:shenli-uiuc,
项目名称:PyroDB,
代码行数:8,
代码来源:HLog.java

示例15: setWALTrailer

点赞 1

import org.apache.hadoop.hbase.protobuf.generated.WALProtos.WALTrailer; //导入依赖的package包/类
/**
 * Sets HLog/WAL's WALTrailer. This trailer is appended at the end of WAL on closing.
 * @param walTrailer trailer to append to WAL.
 */
// TODO: Why a trailer on the log?
void setWALTrailer(WALTrailer walTrailer);
 

开发者ID:shenli-uiuc,
项目名称:PyroDB,
代码行数:7,
代码来源:HLog.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)