public static String [ ] getListOfDataDirs ( Configuration conf ) { String [ ] configFilePath = conf . getStrings ( "dfs.datadir.confpath" ) ; String [ ] dataDirs = null ; if ( configFilePath != null && ( configFilePath . length != 0 ) ) { try { DataDirFileReader reader = new DataDirFileReader ( configFilePath [ 0 ] ) ; dataDirs = reader . getArrayOfCurrentDataDirectories ( ) ; if ( dataDirs == null ) { LOG . warn ( "File is empty, using dfs.data.dir directories" ) ; } } catch ( Exception e ) { LOG . warn ( "Could not read file, using directories from dfs.data.dir" + " Exception: " , e ) ; } } else { LOG . warn ( "No dfs.datadir.confpath not defined, now using default " + "directories" ) ; } if ( dataDirs == null ) { dataDirs = conf . getStrings ( "dfs.data.dir" ) ; } return dataDirs ; }
Returns a list of data directories from the file provided by the dfs . datadir . confpath . If it cannot get the list of data directories then the method will return the default dataDirs from dfs . data . dir .