• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java RemoteEditLogManifest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rollForwardByApplyingLogs

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void rollForwardByApplyingLogs(
    RemoteEditLogManifest manifest,
    FSImage dstImage,
    FSNamesystem dstNamesystem) throws IOException {
  NNStorage dstStorage = dstImage.getStorage();

  List<EditLogInputStream> editsStreams = Lists.newArrayList();    
  for (RemoteEditLog log : manifest.getLogs()) {
    if (log.getEndTxId() > dstImage.getLastAppliedTxId()) {
      File f = dstStorage.findFinalizedEditsFile(
          log.getStartTxId(), log.getEndTxId());
      editsStreams.add(new EditLogFileInputStream(f, log.getStartTxId(), 
                                                  log.getEndTxId(), true));
    }
  }
  LOG.info("Checkpointer about to load edits from " +
      editsStreams.size() + " stream(s).");
  dstImage.loadEdits(editsStreams, dstNamesystem);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:Checkpointer.java


示例2: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
/**
 * @see QJournalProtocol#getEditLogManifest(String, long, boolean)
 */
public RemoteEditLogManifest getEditLogManifest(long sinceTxId,
    boolean inProgressOk) throws IOException {
  // No need to checkRequest() here - anyone may ask for the list
  // of segments.
  checkFormatted();
  
  List<RemoteEditLog> logs = fjm.getRemoteEditLogs(sinceTxId, inProgressOk);
  
  if (inProgressOk) {
    RemoteEditLog log = null;
    for (Iterator<RemoteEditLog> iter = logs.iterator(); iter.hasNext();) {
      log = iter.next();
      if (log.isInProgress()) {
        iter.remove();
        break;
      }
    }
    if (log != null && log.isInProgress()) {
      logs.add(new RemoteEditLog(log.getStartTxId(), getHighestWrittenTxId(),
          true));
    }
  }
  
  return new RemoteEditLogManifest(logs);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:Journal.java


示例3: rollForwardByApplyingLogs

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void rollForwardByApplyingLogs(
    RemoteEditLogManifest manifest,
    FSImage dstImage) throws IOException {
  NNStorage dstStorage = dstImage.storage;

  List<EditLogInputStream> editsStreams = new ArrayList<EditLogInputStream>();    
  for (RemoteEditLog log : manifest.getLogs()) {
    if (log.inProgress())
      break;
    File f = dstStorage.findFinalizedEditsFile(
        log.getStartTxId(), log.getEndTxId());
    if (log.getStartTxId() > dstImage.getLastAppliedTxId()) {
      editsStreams.add(new EditLogFileInputStream(f, log.getStartTxId(), 
                                                  log.getEndTxId(), false));
     }
  }
  dstImage.loadEdits(editsStreams);
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:19,代码来源:FSImage.java


示例4: doMerge

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
/**
 * Merge image and edits, and verify consistency with the signature.
 */
private void doMerge(CheckpointSignature sig,
    RemoteEditLogManifest manifest, boolean loadImage) throws IOException {
  NNStorage dstStorage = this.storage;
  dstStorage.setStorageInfo(sig);

  if (loadImage) {
    File file = dstStorage.findImageFile(sig.mostRecentCheckpointTxId);
    if (file == null) {
      throw new IOException("Couldn't find image file at txid "
          + sig.mostRecentCheckpointTxId + " even though it should have "
          + "just been downloaded");
    }
    loadFSImage(new ImageInputStream(sig.mostRecentCheckpointTxId,
        new FileInputStream(file), null, "image", file.length()));
  }
  FSImage.rollForwardByApplyingLogs(manifest, this);
  this.saveFSImageInAllDirs(this.getLastAppliedTxId(), false);
  dstStorage.writeAll();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:23,代码来源:SecondaryNameNode.java


示例5: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public GetEditLogManifestResponseProto getEditLogManifest(byte[] jid,
    long sinceTxId) throws IOException {
  
  RemoteEditLogManifest manifest = jn.getOrCreateJournal(jid)
      .getEditLogManifest(sinceTxId);
  
  GetEditLogManifestResponseProto ret = new GetEditLogManifestResponseProto();
  ret.setLogs(manifest.getLogs());
  ret.setHttpPort(jn.getBoundHttpAddress().getPort());
  
  if (JournalNode.LOG.isDebugEnabled()) {
    JournalNode.LOG.info("Returning manifest " + manifest.toString());
  }

  return ret;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:18,代码来源:JournalNodeRpcServer.java


示例6: rollForwardByApplyingLogs

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void rollForwardByApplyingLogs(
    RemoteEditLogManifest manifest,
    FSImage dstImage,
    FSNamesystem dstNamesystem) throws IOException {
  NNStorage dstStorage = dstImage.getStorage();

  List<EditLogInputStream> editsStreams = Lists.newArrayList();    
  for (RemoteEditLog log : manifest.getLogs()) {
    if (log.getEndTxId() > dstImage.getLastAppliedTxId()) {
      File f = dstStorage.findFinalizedEditsFile(
          log.getStartTxId(), log.getEndTxId());
      editsStreams.add(new EditLogFileInputStream(f, log.getStartTxId(), 
                                                  log.getEndTxId(), true));
    }
  }
  LOG.info("Checkpointer about to load edits from " +
      editsStreams.size() + " stream(s).");
  dstImage.loadEdits(editsStreams, dstNamesystem, null);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:20,代码来源:Checkpointer.java


示例7: doMerge

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void doMerge(
    CheckpointSignature sig, RemoteEditLogManifest manifest,
    boolean loadImage, FSImage dstImage, FSNamesystem dstNamesystem)
    throws IOException {   
  NNStorage dstStorage = dstImage.getStorage();
  
  dstStorage.setStorageInfo(sig);
  if (loadImage) {
    File file = dstStorage.findImageFile(sig.mostRecentCheckpointTxId);
    if (file == null) {
      throw new IOException("Couldn't find image file at txid " + 
          sig.mostRecentCheckpointTxId + " even though it should have " +
          "just been downloaded");
    }
    dstImage.reloadFromImageFile(file, dstNamesystem);
    dstNamesystem.dir.imageLoadComplete();
  }
  // error simulation code for junit test
  CheckpointFaultInjector.getInstance().duringMerge();   

  Checkpointer.rollForwardByApplyingLogs(manifest, dstImage, dstNamesystem);
  // The following has the side effect of purging old fsimages/edit logs.
  dstImage.saveFSImageInAllDirs(dstNamesystem, dstImage.getLastAppliedTxId());
  dstStorage.writeAll();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:SecondaryNameNode.java


示例8: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public ListenableFuture<RemoteEditLogManifest> getEditLogManifest(
    final long fromTxnId, final boolean forReading, 
    final boolean inProgressOk) {
  return executor.submit(new Callable<RemoteEditLogManifest>() {
    @Override
    public RemoteEditLogManifest call() throws IOException {
      GetEditLogManifestResponseProto ret = getProxy().getEditLogManifest(
          journalId, fromTxnId, forReading, inProgressOk);
      // Update the http port, since we need this to build URLs to any of the
      // returned logs.
      httpPort = ret.getHttpPort();
      return PBHelper.convert(ret.getManifest());
    }
  });
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:17,代码来源:IPCLoggerChannel.java


示例9: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
/**
 * @see QJournalProtocol#getEditLogManifest(String, long, boolean)
 */
public RemoteEditLogManifest getEditLogManifest(long sinceTxId,
    boolean inProgressOk) throws IOException {
  // No need to checkRequest() here - anyone may ask for the list
  // of segments.
  checkFormatted();
  
  List<RemoteEditLog> logs = fjm.getRemoteEditLogs(sinceTxId, inProgressOk);
  
  if (inProgressOk) {
    RemoteEditLog log = null;
    for (Iterator<RemoteEditLog> iter = logs.iterator(); iter.hasNext();) {
      log = iter.next();
      if (log.isInProgress()) {
        iter.remove();
        break;
      }
    }
    if (log != null && log.isInProgress()) {
      logs.add(new RemoteEditLog(log.getStartTxId(), getHighestWrittenTxId()));
    }
  }
  
  return new RemoteEditLogManifest(logs);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:28,代码来源:Journal.java


示例10: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override // NamenodeProtocol
public RemoteEditLogManifest getEditLogManifest(long sinceTxId)
    throws IOException {
  checkNNStartup();
  namesystem.checkOperation(OperationCategory.READ);
  namesystem.checkSuperuserPrivilege();
  return namesystem.getEditLog().getEditLogManifest(sinceTxId);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:NameNodeRpcServer.java


示例11: doMerge

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void doMerge(
    CheckpointSignature sig, RemoteEditLogManifest manifest,
    boolean loadImage, FSImage dstImage, FSNamesystem dstNamesystem)
    throws IOException {   
  NNStorage dstStorage = dstImage.getStorage();
  
  dstStorage.setStorageInfo(sig);
  if (loadImage) {
    File file = dstStorage.findImageFile(NameNodeFile.IMAGE,
        sig.mostRecentCheckpointTxId);
    if (file == null) {
      throw new IOException("Couldn't find image file at txid " + 
          sig.mostRecentCheckpointTxId + " even though it should have " +
          "just been downloaded");
    }
    dstNamesystem.writeLock();
    try {
      dstImage.reloadFromImageFile(file, dstNamesystem);
    } finally {
      dstNamesystem.writeUnlock();
    }
    dstNamesystem.imageLoadComplete();
  }
  // error simulation code for junit test
  CheckpointFaultInjector.getInstance().duringMerge();   

  Checkpointer.rollForwardByApplyingLogs(manifest, dstImage, dstNamesystem);
  // The following has the side effect of purging old fsimages/edit logs.
  dstImage.saveFSImageInAllDirs(dstNamesystem, dstImage.getLastAppliedTxId());
  dstStorage.writeAll();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:SecondaryNameNode.java


示例12: convert

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
public static RemoteEditLogManifestProto convert(
    RemoteEditLogManifest manifest) {
  RemoteEditLogManifestProto.Builder builder = RemoteEditLogManifestProto
      .newBuilder();
  for (RemoteEditLog log : manifest.getLogs()) {
    builder.addLogs(convert(log));
  }
  return builder.build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:PBHelper.java


示例13: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public GetEditLogManifestResponseProto getEditLogManifest(
    RpcController unused, GetEditLogManifestRequestProto request)
    throws ServiceException {
  RemoteEditLogManifest manifest;
  try {
    manifest = impl.getEditLogManifest(request.getSinceTxId());
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return GetEditLogManifestResponseProto.newBuilder()
      .setManifest(PBHelper.convert(manifest)).build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:NamenodeProtocolServerSideTranslatorPB.java


示例14: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public RemoteEditLogManifest getEditLogManifest(long sinceTxId)
    throws IOException {
  GetEditLogManifestRequestProto req = GetEditLogManifestRequestProto
      .newBuilder().setSinceTxId(sinceTxId).build();
  try {
    return PBHelper.convert(rpcProxy.getEditLogManifest(NULL_CONTROLLER, req)
        .getManifest());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:NamenodeProtocolTranslatorPB.java


示例15: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
public QuorumCall<AsyncLogger, RemoteEditLogManifest> getEditLogManifest(
    long fromTxnId, boolean inProgressOk) {
  Map<AsyncLogger,
      ListenableFuture<RemoteEditLogManifest>> calls
      = Maps.newHashMap();
  for (AsyncLogger logger : loggers) {
    ListenableFuture<RemoteEditLogManifest> future =
        logger.getEditLogManifest(fromTxnId, inProgressOk);
    calls.put(logger, future);
  }
  return QuorumCall.create(calls);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:AsyncLoggerSet.java


示例16: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public ListenableFuture<RemoteEditLogManifest> getEditLogManifest(
    final long fromTxnId, final boolean inProgressOk) {
  return parallelExecutor.submit(new Callable<RemoteEditLogManifest>() {
    @Override
    public RemoteEditLogManifest call() throws IOException {
      GetEditLogManifestResponseProto ret = getProxy().getEditLogManifest(
          journalId, fromTxnId, inProgressOk);
      // Update the http port, since we need this to build URLs to any of the
      // returned logs.
      constructHttpServerURI(ret);
      return PBHelper.convert(ret.getManifest());
    }
  });
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:IPCLoggerChannel.java


示例17: selectInputStreams

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Override
public void selectInputStreams(Collection<EditLogInputStream> streams,
    long fromTxnId, boolean inProgressOk) throws IOException {

  QuorumCall<AsyncLogger, RemoteEditLogManifest> q =
      loggers.getEditLogManifest(fromTxnId, inProgressOk);
  Map<AsyncLogger, RemoteEditLogManifest> resps =
      loggers.waitForWriteQuorum(q, selectInputStreamsTimeoutMs,
          "selectInputStreams");
  
  LOG.debug("selectInputStream manifests:\n" +
      Joiner.on("\n").withKeyValueSeparator(": ").join(resps));
  
  final PriorityQueue<EditLogInputStream> allStreams = 
      new PriorityQueue<EditLogInputStream>(64,
          JournalSet.EDIT_LOG_INPUT_STREAM_COMPARATOR);
  for (Map.Entry<AsyncLogger, RemoteEditLogManifest> e : resps.entrySet()) {
    AsyncLogger logger = e.getKey();
    RemoteEditLogManifest manifest = e.getValue();
    
    for (RemoteEditLog remoteLog : manifest.getLogs()) {
      URL url = logger.buildURLToFetchLogs(remoteLog.getStartTxId());

      EditLogInputStream elis = EditLogFileInputStream.fromUrl(
          connectionFactory, url, remoteLog.getStartTxId(),
          remoteLog.getEndTxId(), remoteLog.isInProgress());
      allStreams.add(elis);
    }
  }
  JournalSet.chainAndMakeRedundantStreams(streams, allStreams, fromTxnId);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:QuorumJournalManager.java


示例18: getEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public GetEditLogManifestResponseProto getEditLogManifest(String jid,
    long sinceTxId, boolean inProgressOk)
    throws IOException {
  
  RemoteEditLogManifest manifest = jn.getOrCreateJournal(jid)
      .getEditLogManifest(sinceTxId, inProgressOk);
  
  return GetEditLogManifestResponseProto.newBuilder()
      .setManifest(PBHelper.convert(manifest))
      .setHttpPort(jn.getBoundHttpAddress().getPort())
      .setFromURL(jn.getHttpServerURI())
      .build();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:JournalNodeRpcServer.java


示例19: testConvertRemoteEditLogManifest

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
@Test
public void testConvertRemoteEditLogManifest() {
  List<RemoteEditLog> logs = new ArrayList<RemoteEditLog>();
  logs.add(new RemoteEditLog(1, 10));
  logs.add(new RemoteEditLog(11, 20));
  RemoteEditLogManifest m = new RemoteEditLogManifest(logs);
  RemoteEditLogManifestProto mProto = PBHelper.convert(m);
  RemoteEditLogManifest m1 = PBHelper.convert(mProto);
  
  List<RemoteEditLog> logs1 = m1.getLogs();
  assertEquals(logs.size(), logs1.size());
  for (int i = 0; i < logs.size(); i++) {
    compare(logs.get(i), logs1.get(i));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestPBHelper.java


示例20: doMerge

import org.apache.hadoop.hdfs.server.protocol.RemoteEditLogManifest; //导入依赖的package包/类
static void doMerge(
    CheckpointSignature sig, RemoteEditLogManifest manifest,
    boolean loadImage, FSImage dstImage, FSNamesystem dstNamesystem)
    throws IOException {   
  NNStorage dstStorage = dstImage.getStorage();
  
  dstStorage.setStorageInfo(sig);
  if (loadImage) {
    File file = dstStorage.findImageFile(NameNodeFile.IMAGE,
        sig.mostRecentCheckpointTxId);
    if (file == null) {
      throw new IOException("Couldn't find image file at txid " + 
          sig.mostRecentCheckpointTxId + " even though it should have " +
          "just been downloaded");
    }
    dstNamesystem.writeLock();
    try {
      dstImage.reloadFromImageFile(file, dstNamesystem);
    } finally {
      dstNamesystem.writeUnlock();
    }
    dstNamesystem.imageLoadComplete();
  }
  // error simulation code for junit test
  CheckpointFaultInjector.getInstance().duringMerge();   

  Checkpointer.rollForwardByApplyingLogs(manifest, dstImage, dstNamesystem);
  // The following has the side effect of purging old fsimages/edit logs.
  dstImage.saveFSImageInAllDirs(dstNamesystem, dstImage.getLastAppliedTxId());
  if (!dstNamesystem.isRollingUpgrade()) {
    dstStorage.writeAll();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:34,代码来源:SecondaryNameNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConverterFactory类代码示例发布时间:2022-05-22
下一篇:
Java AxesOrder类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap