public Path [ ] recover ( String cmd , String argv [ ] , int startindex ) throws IOException { Path [ ] paths = new Path [ ( argv . length - startindex ) / 2 ] ; int j = 0 ; for ( int i = startindex ; i < argv . length ; i = i + 2 ) { String path = argv [ i ] ; long corruptOffset = Long . parseLong ( argv [ i + 1 ] ) ; LOG . info ( "RaidShell recoverFile for " + path + " corruptOffset " + corruptOffset ) ; Path recovered = new Path ( "/tmp/recovered." + System . currentTimeMillis ( ) ) ; FileSystem fs = recovered . getFileSystem ( conf ) ; DistributedFileSystem dfs = ( DistributedFileSystem ) fs ; Configuration raidConf = new Configuration ( conf ) ; raidConf . set ( "fs.hdfs.impl" , "org.apache.hadoop.hdfs.DistributedRaidFileSystem" ) ; raidConf . set ( "fs.raid.underlyingfs.impl" , "org.apache.hadoop.hdfs.DistributedFileSystem" ) ; raidConf . setBoolean ( "fs.hdfs.impl.disable.cache" , true ) ; java . net . URI dfsUri = dfs . getUri ( ) ; FileSystem raidFs = FileSystem . get ( dfsUri , raidConf ) ; FileUtil . copy ( raidFs , new Path ( path ) , fs , recovered , false , conf ) ; paths [ j ] = recovered ; LOG . info ( "Raidshell created recovery file " + paths [ j ] ) ; j ++ ; } return paths ; }
Recovers the specified path from the parity file