private static BlockLocation [ ] getParityBlocks ( final Path filePath , final long blockSize , final long numStripes , final RaidInfo raidInfo ) throws IOException { FileSystem parityFS = raidInfo . parityPair . getFileSystem ( ) ; // get parity file metadata FileStatus parityFileStatus = raidInfo . parityPair . getFileStatus ( ) ; long parityFileLength = parityFileStatus . getLen ( ) ; if ( parityFileLength != numStripes * raidInfo . parityBlocksPerStripe * blockSize ) { throw new IOException ( "expected parity file of length" + ( numStripes * raidInfo . parityBlocksPerStripe * blockSize ) + " but got parity file of length " + parityFileLength ) ; } BlockLocation [ ] parityBlocks = parityFS . getFileBlockLocations ( parityFileStatus , 0L , parityFileLength ) ; if ( parityFS instanceof DistributedFileSystem || parityFS instanceof DistributedRaidFileSystem ) { long parityBlockSize = parityFileStatus . getBlockSize ( ) ; if ( parityBlockSize != blockSize ) { throw new IOException ( "file block size is " + blockSize + " but parity file block size is " + parityBlockSize ) ; } } else if ( parityFS instanceof HarFileSystem ) { LOG . debug ( "HAR FS found" ) ; } else { LOG . warn ( "parity file system is not of a supported type" ) ; } return parityBlocks ; }
gets the parity blocks corresponding to file returns the parity blocks in case of DFS and the part blocks containing parity blocks in case of HAR FS