/** Copy the new fsimage into the NameNode */ private void putFSImage(CheckpointSignature sig) throws IOException { String fileid = "putimage=1&port=" + infoPort + "&machine=" + InetAddress.getLocalHost().getHostAddress() + "&token=" + sig.toString(); LOG.info("Posted URL " + fsName + fileid); TransferFsImage.getFileClient(fsName, fileid, (File[]) null); }
/** Merge image and edits, and verify consistency with the signature. */ private void doMerge(CheckpointSignature sig) throws IOException { getEditLog().open(); StorageDirectory sdName = null; StorageDirectory sdEdits = null; Iterator<StorageDirectory> it = null; it = dirIterator(NameNodeDirType.IMAGE); if (it.hasNext()) sdName = it.next(); it = dirIterator(NameNodeDirType.EDITS); if (it.hasNext()) sdEdits = it.next(); if ((sdName == null) || (sdEdits == null)) throw new IOException("Could not locate checkpoint directories"); loadFSImage(FSImage.getImageFile(sdName, NameNodeFile.IMAGE)); loadFSEdits(sdEdits); sig.validateStorageInfo(this); saveFSImage(); }
/** Merge image and edits, and verify consistency with the signature. */ private void doMerge(CheckpointSignature sig, boolean loadImage) throws IOException { getEditLog().open(); StorageDirectory sdName = null; StorageDirectory sdEdits = null; Iterator<StorageDirectory> it = null; if (loadImage) { it = dirIterator(NameNodeDirType.IMAGE); if (it.hasNext()) sdName = it.next(); if (sdName == null) throw new IOException("Could not locate checkpoint fsimage"); } it = dirIterator(NameNodeDirType.EDITS); if (it.hasNext()) sdEdits = it.next(); if (sdEdits == null) throw new IOException("Could not locate checkpoint edits"); if (loadImage) { loadFSImage(FSImage.getImageFile(sdName, NameNodeFile.IMAGE)); } loadFSEdits(sdEdits); sig.validateStorageInfo(this); saveNamespace(false); }