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

项目:hadoop    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:hadoop    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:hadoop    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, 1);
  File editsDir = new File(editsUri);
  File editsSegment = new File(new File(editsDir, "current"),
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    int rc = BootstrapStandby.run(
        new String[]{"-force"},
        cluster.getConfiguration(1));
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:hadoop    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(
      getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:aliyun-oss-hadoop-fs    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:aliyun-oss-hadoop-fs    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:aliyun-oss-hadoop-fs    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:aliyun-oss-hadoop-fs    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, maxNNCount - 1);
  File editsDir = new File(editsUri);
  File currentDir = new File(editsDir, "current");
  File editsSegment = new File(currentDir,
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);
  GenericTestUtils.assertExists(currentDir);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, forceBootstrap(1));
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:aliyun-oss-hadoop-fs    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(
      getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:big-c    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:big-c    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:big-c    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:big-c    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:big-c    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, 1);
  File editsDir = new File(editsUri);
  File editsSegment = new File(new File(editsDir, "current"),
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    int rc = BootstrapStandby.run(
        new String[]{"-force"},
        cluster.getConfiguration(1));
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:big-c    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(
      getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, 1);
  File editsDir = new File(editsUri);
  File editsSegment = new File(new File(editsDir, "current"),
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    int rc = BootstrapStandby.run(
        new String[]{"-force"},
        cluster.getConfiguration(1));
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(
      getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:hadoop-EAR    文件:Standby.java   
private void finalizeCheckpoint(CheckpointSignature sig) 
    throws IOException{

  try {
    File imageFile = fsImage.storage.getFsImageName(
        StorageLocationType.LOCAL, sig.mostRecentCheckpointTxId);
    InjectionHandler.processEvent(InjectionEvent.STANDBY_BEFORE_PUT_IMAGE,
        imageFile);

    // start a thread to validate image while uploading the image to primary
    createImageValidation(imageFile);

    // copy image to primary namenode
    uploadImage(sig.mostRecentCheckpointTxId);

    // check if the image is valid
    checkImageValidation();

    // make transaction to primary namenode to switch edit logs
    LOG.info("Standby: Checkpointing - Roll fsimage on primary namenode.");
    InjectionHandler.processEventIO(InjectionEvent.STANDBY_BEFORE_ROLL_IMAGE);

    assertState(
        StandbyIngestState.NOT_INGESTING,
        StandbyIngestState.INGESTING_EDITS);

    primaryNamenode.rollFsImage(new CheckpointSignature(fsImage));
    setLastRollSignature(null);      
    LOG.info("Standby: Checkpointing - Checkpoint done. New Image Size: "
        + fsImage.getFsImageName(StorageLocationType.LOCAL).length());
    checkpointStatus("Completed");
  } finally {
    interruptImageValidation();
  }
}
项目:hadoop-plus    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:hadoop-plus    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:hadoop-plus    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop-plus    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:hadoop-plus    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, 1);
  File editsDir = new File(editsUri);
  File editsSegment = new File(new File(editsDir, "current"),
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    int rc = BootstrapStandby.run(
        new String[]{"-force"},
        cluster.getConfiguration(1));
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:hadoop-plus    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(getStorageInfo(), "bpid",
      100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:FlexMap    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:FlexMap    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:FlexMap    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:FlexMap    文件:NamenodeProtocolTranslatorPB.java   
@Override
public void endCheckpoint(NamenodeRegistration registration,
    CheckpointSignature sig) throws IOException {
  EndCheckpointRequestProto req = EndCheckpointRequestProto.newBuilder()
      .setRegistration(PBHelper.convert(registration))
      .setSignature(PBHelper.convert(sig)).build();
  try {
    rpcProxy.endCheckpoint(NULL_CONTROLLER, req);
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}
项目:FlexMap    文件:TestBootstrapStandby.java   
/**
 * Test for the case where the shared edits dir doesn't have
 * all of the recent edit logs.
 */
@Test
public void testSharedEditsMissingLogs() throws Exception {
  removeStandbyNameDirs();

  CheckpointSignature sig = nn0.getRpcServer().rollEditLog();
  assertEquals(3, sig.getCurSegmentTxId());

  // Should have created edits_1-2 in shared edits dir
  URI editsUri = cluster.getSharedEditsDir(0, 1);
  File editsDir = new File(editsUri);
  File editsSegment = new File(new File(editsDir, "current"),
      NNStorage.getFinalizedEditsFileName(1, 2));
  GenericTestUtils.assertExists(editsSegment);

  // Delete the segment.
  assertTrue(editsSegment.delete());

  // Trying to bootstrap standby should now fail since the edit
  // logs aren't available in the shared dir.
  LogCapturer logs = GenericTestUtils.LogCapturer.captureLogs(
      LogFactory.getLog(BootstrapStandby.class));
  try {
    int rc = BootstrapStandby.run(
        new String[]{"-force"},
        cluster.getConfiguration(1));
    assertEquals(BootstrapStandby.ERR_CODE_LOGS_UNAVAILABLE, rc);
  } finally {
    logs.stopCapturing();
  }
  GenericTestUtils.assertMatches(logs.getOutput(),
      "FATAL.*Unable to read transaction ids 1-3 from the configured shared");
}
项目:FlexMap    文件:TestPBHelper.java   
@Test
public void testConvertCheckpointSignature() {
  CheckpointSignature s = new CheckpointSignature(
      getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1);
  CheckpointSignatureProto sProto = PBHelper.convert(s);
  CheckpointSignature s1 = PBHelper.convert(sProto);
  assertEquals(s.getBlockpoolID(), s1.getBlockpoolID());
  assertEquals(s.getClusterID(), s1.getClusterID());
  assertEquals(s.getCTime(), s1.getCTime());
  assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId());
  assertEquals(s.getLayoutVersion(), s1.getLayoutVersion());
  assertEquals(s.getMostRecentCheckpointTxId(),
      s1.getMostRecentCheckpointTxId());
  assertEquals(s.getNamespaceID(), s1.getNamespaceID());
}
项目:hadoop-TCP    文件:PBHelper.java   
public static CheckpointSignatureProto convert(CheckpointSignature s) {
  return CheckpointSignatureProto.newBuilder()
      .setBlockPoolId(s.getBlockpoolID())
      .setCurSegmentTxId(s.getCurSegmentTxId())
      .setMostRecentCheckpointTxId(s.getMostRecentCheckpointTxId())
      .setStorageInfo(PBHelper.convert((StorageInfo) s)).build();
}
项目:hadoop-TCP    文件:NamenodeProtocolServerSideTranslatorPB.java   
@Override
public RollEditLogResponseProto rollEditLog(RpcController unused,
    RollEditLogRequestProto request) throws ServiceException {
  CheckpointSignature signature;
  try {
    signature = impl.rollEditLog();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return RollEditLogResponseProto.newBuilder()
      .setSignature(PBHelper.convert(signature)).build();
}
项目:hadoop-TCP    文件:NamenodeProtocolTranslatorPB.java   
@Override
public CheckpointSignature rollEditLog() throws IOException {
  try {
    return PBHelper.convert(rpcProxy.rollEditLog(NULL_CONTROLLER,
        VOID_ROLL_EDITLOG_REQUEST).getSignature());
  } catch (ServiceException e) {
    throw ProtobufHelper.getRemoteException(e);
  }
}