protected Map < String , Integer > getLostFiles ( Pattern pattern , String [ ] dfsckArgs ) throws IOException { Map < String , Integer > lostFiles = new HashMap < String , Integer > ( ) ; BufferedReader reader = getLostFileReader ( dfsckArgs ) ; String line = reader . readLine ( ) ; // remove the header line while ( ( line = reader . readLine ( ) ) != null ) { Matcher m = pattern . matcher ( line ) ; if ( ! m . find ( ) ) { continue ; } String fileName = m . group ( 1 ) . trim ( ) ; Integer numLost = lostFiles . get ( fileName ) ; numLost = numLost == null ? 0 : numLost ; numLost += 1 ; lostFiles . put ( fileName , numLost ) ; } LOG . info ( "FSCK returned " + lostFiles . size ( ) + " files with args " + Arrays . toString ( dfsckArgs ) ) ; RaidUtils . filterTrash ( getConf ( ) , lostFiles . keySet ( ) . iterator ( ) ) ; LOG . info ( "getLostFiles returning " + lostFiles . size ( ) + " files with args " + Arrays . toString ( dfsckArgs ) ) ; return lostFiles ; }
Gets a list of lost files from the name node via DFSck