void downloadSnapshotFiles ( SnapshotStorage ssStore ) throws IOException { CheckpointSignature start = namenode . getCheckpointSignature ( ) ; ssStore . storage . setStorageInfo ( start ) ; CheckpointSignature end = null ; boolean success ; do { // Clear temp files prepareDownloadDirs ( ) ; // get fsimage File [ ] srcNames = ssStore . getImageFiles ( ) ; assert srcNames . length == 1 : "No snapshot temporary dir." ; TransferFsImage . downloadImageToStorage ( fileServer , HdfsConstants . INVALID_TXID , ssStore , true , srcNames ) ; LOG . info ( "Downloaded file " + srcNames [ 0 ] . getName ( ) + " size " + srcNames [ 0 ] . length ( ) + " bytes." ) ; // get edits file srcNames = ssStore . getEditsFiles ( ) ; assert srcNames . length == 1 : "No snapshot temporary dir." ; TransferFsImage . downloadEditsToStorage ( fileServer , new RemoteEditLog ( ) , ssStore , false ) ; LOG . info ( "Downloaded file " + srcNames [ 0 ] . getName ( ) + " size " + srcNames [ 0 ] . length ( ) + " bytes." ) ; // get edits.new file (only if in the middle of ckpt) try { srcNames = ssStore . getEditsNewFiles ( ) ; assert srcNames . length == 1 : "No snapshot temporary dir." ; TransferFsImage . downloadEditsToStorage ( fileServer , new RemoteEditLog ( ) , ssStore , true ) ; LOG . info ( "Downloaded file " + srcNames [ 0 ] . getName ( ) + " size " + srcNames [ 0 ] . length ( ) + " bytes." ) ; } catch ( FileNotFoundException e ) { // do nothing } end = namenode . getCheckpointSignature ( ) ; // Are the downloaded files consistent? success = end . checkpointTime == start . checkpointTime && end . checkpointState != CheckpointStates . UPLOAD_DONE ; start = end ; } while ( ! success ) ; }
Download fsimage edits and edits . new files from the name - node . Files will be downloaded in CURRENT_DIR