code: boolean doCheckpoint() throws IOException {
  
      LOG.info("Checkpoint starting");
  
      // Do the required initialization of the merge work area.
      startCheckpoint();
  
      checkpointImage.ensureCurrentDirExists();
      NNStorage dstStorage = checkpointImage.storage;
  
      // Tell the namenode to start logging transactions in a new edit file
      // Returns a token that would be used to upload the merged image.
      CheckpointSignature sig = namenode.rollEditLog();
  
      // Make sure we're talking to the same NN!
      if (checkpointImage.getNamespaceID() != 0) {
        // If the image actually has some data, make sure we're talking
        // to the same NN as we did before.
        sig.validateStorageInfo(checkpointImage.storage);
      } else {
        // if we're a fresh 2NN, just take the storage info from the server
        // we first talk to.
        dstStorage.setStorageInfo(sig);
      }
  
      // error simulation code for junit test
      InjectionHandler.processEventIO(InjectionEvent.SECONDARYNAMENODE_CHECKPOINT0);
  
      RemoteEditLogManifest manifest = namenode
          .getEditLogManifest(sig.mostRecentCheckpointTxId + 1);
  
      boolean loadImage = downloadCheckpointFiles(fsName, checkpointImage, sig,
          manifest); // Fetch fsimage and edits
      doMerge(sig, manifest, loadImage, checkpointImage);
  
      //
      // Upload the new image into the NameNode. Then tell the Namenode
      // to make this new uploaded image as the most current image.
      //
      long txid = checkpointImage.getLastAppliedTxId();
      TransferFsImage.uploadImageFromStorage(fsName, InetAddress.getLocalHost()
          .getHostAddress(), infoPort, dstStorage, txid);
  
      // error simulation code for junit test
      InjectionHandler.processEventIO(InjectionEvent.SECONDARYNAMENODE_CHECKPOINT1);
  
      namenode.rollFsImage(new CheckpointSignature(checkpointImage));
  
      LOG.warn("Checkpoint done. New Image Size: "
          + dstStorage.getFsImageName(StorageLocationType.LOCAL, txid).length());
  
      // Since we've successfully checkpointed, we can remove some old
      // image files
      checkpointImage.purgeOldStorage();
  
      return loadImage;
    }
docs: Create a new checkpoint