Java 类org.apache.hadoop.hdfs.server.namenode.FsImageProto.NameSystemSection 实例源码

项目:hadoop    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(blockIdManager.getGenerationStampV1())
      .setGenstampV1Limit(blockIdManager.getGenerationStampV1Limit())
      .setGenstampV2(blockIdManager.getGenerationStampV2())
      .setLastAllocatedBlockId(blockIdManager.getLastAllocatedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  blockIdManager.setGenerationStampV1(s.getGenstampV1());
  blockIdManager.setGenerationStampV2(s.getGenstampV2());
  blockIdManager.setGenerationStampV1Limit(s.getGenstampV1Limit());
  blockIdManager.setLastAllocatedContiguousBlockId(s.getLastAllocatedBlockId());
  if (s.hasLastAllocatedStripedBlockId()) {
    blockIdManager.setLastAllocatedStripedBlockId(
        s.getLastAllocatedStripedBlockId());
  }
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:big-c    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(blockIdManager.getGenerationStampV1())
      .setGenstampV1Limit(blockIdManager.getGenerationStampV1Limit())
      .setGenstampV2(blockIdManager.getGenerationStampV2())
      .setLastAllocatedBlockId(blockIdManager.getLastAllocatedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(fsn.getGenerationStampV1())
      .setGenstampV1Limit(fsn.getGenerationStampV1Limit())
      .setGenstampV2(fsn.getGenerationStampV2())
      .setLastAllocatedBlockId(fsn.getLastAllocatedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:FlexMap    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(fsn.getGenerationStampV1())
      .setGenstampV1Limit(fsn.getGenerationStampV1Limit())
      .setGenstampV2(fsn.getGenerationStampV2())
      .setLastAllocatedBlockId(fsn.getLastAllocatedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:hadoop-on-lustre2    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(fsn.getGenerationStampV1())
      .setGenstampV1Limit(fsn.getGenerationStampV1Limit())
      .setGenstampV2(fsn.getGenerationStampV2())
      .setLastAllocatedBlockId(fsn.getLastAllocatedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:hadoop    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  blockIdManager.setGenerationStampV1(s.getGenstampV1());
  blockIdManager.setGenerationStampV2(s.getGenstampV2());
  blockIdManager.setGenerationStampV1Limit(s.getGenstampV1Limit());
  blockIdManager.setLastAllocatedBlockId(s.getLastAllocatedBlockId());
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:hadoop    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}
项目:aliyun-oss-hadoop-fs    文件:FSImageFormatProtobuf.java   
private void saveNameSystemSection(FileSummary.Builder summary)
    throws IOException {
  final FSNamesystem fsn = context.getSourceNamesystem();
  OutputStream out = sectionOutputStream;
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  NameSystemSection.Builder b = NameSystemSection.newBuilder()
      .setGenstampV1(blockIdManager.getGenerationStampV1())
      .setGenstampV1Limit(blockIdManager.getGenerationStampV1Limit())
      .setGenstampV2(blockIdManager.getGenerationStampV2())
      .setLastAllocatedBlockId(blockIdManager.getLastAllocatedContiguousBlockId())
      .setLastAllocatedStripedBlockId(blockIdManager.getLastAllocatedStripedBlockId())
      .setTransactionId(context.getTxId());

  // We use the non-locked version of getNamespaceInfo here since
  // the coordinating thread of saveNamespace already has read-locked
  // the namespace for us. If we attempt to take another readlock
  // from the actual saver thread, there's a potential of a
  // fairness-related deadlock. See the comments on HDFS-2223.
  b.setNamespaceId(fsn.unprotectedGetNamespaceInfo().getNamespaceID());
  if (fsn.isRollingUpgrade()) {
    b.setRollingUpgradeStartTime(fsn.getRollingUpgradeInfo().getStartTime());
  }
  NameSystemSection s = b.build();
  s.writeDelimitedTo(out);

  commitSection(summary, SectionName.NS_INFO);
}
项目:aliyun-oss-hadoop-fs    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}
项目:big-c    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  BlockIdManager blockIdManager = fsn.getBlockIdManager();
  blockIdManager.setGenerationStampV1(s.getGenstampV1());
  blockIdManager.setGenerationStampV2(s.getGenstampV2());
  blockIdManager.setGenerationStampV1Limit(s.getGenstampV1Limit());
  blockIdManager.setLastAllocatedBlockId(s.getLastAllocatedBlockId());
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:big-c    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}
项目:hadoop-2.6.0-cdh5.4.3    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  fsn.setGenerationStampV1(s.getGenstampV1());
  fsn.setGenerationStampV2(s.getGenstampV2());
  fsn.setGenerationStampV1Limit(s.getGenstampV1Limit());
  fsn.setLastAllocatedBlockId(s.getLastAllocatedBlockId());
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}
项目:FlexMap    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  fsn.setGenerationStampV1(s.getGenstampV1());
  fsn.setGenerationStampV2(s.getGenstampV2());
  fsn.setGenerationStampV1Limit(s.getGenstampV1Limit());
  fsn.setLastAllocatedBlockId(s.getLastAllocatedBlockId());
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:FlexMap    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}
项目:hadoop-on-lustre2    文件:FSImageFormatProtobuf.java   
private void loadNameSystemSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  fsn.setGenerationStampV1(s.getGenstampV1());
  fsn.setGenerationStampV2(s.getGenstampV2());
  fsn.setGenerationStampV1Limit(s.getGenstampV1Limit());
  fsn.setLastAllocatedBlockId(s.getLastAllocatedBlockId());
  imgTxId = s.getTransactionId();
  if (s.hasRollingUpgradeStartTime()
      && fsn.getFSImage().hasRollbackFSImage()) {
    // we set the rollingUpgradeInfo only when we make sure we have the
    // rollback image
    fsn.setRollingUpgradeInfo(true, s.getRollingUpgradeStartTime());
  }
}
项目:hadoop-on-lustre2    文件:PBImageXmlWriter.java   
private void dumpNameSection(InputStream in) throws IOException {
  NameSystemSection s = NameSystemSection.parseDelimitedFrom(in);
  out.print("<NameSection>\n");
  o("genstampV1", s.getGenstampV1()).o("genstampV2", s.getGenstampV2())
      .o("genstampV1Limit", s.getGenstampV1Limit())
      .o("lastAllocatedBlockId", s.getLastAllocatedBlockId())
      .o("txid", s.getTransactionId());
  out.print("</NameSection>\n");
}