FileSystem parityFs, boolean stripeVerified, StripeInfo si)
throws StripeMismatchException {
//setting remoteRackFlag for each of the input streams and verify the stripe
for (int i = 0 ; i < codec.parityLength + codec.stripeLength ; i++) {
if (parallelReader.streams[i] instanceof DFSDataInputStream) {
DFSDataInputStream stream =
(DFSDataInputStream) parallelReader.streams[i];
if (i < codec.parityLength) {
//Dealing with parity blocks
remoteRackFlag[i] =
!(((DistributedFileSystem)parityFs).getClient().
isInLocalRack(NetUtils.createSocketAddr(
stream.getCurrentDatanode().getName())));
if (LOG.isDebugEnabled()) {
LOG.debug("RemoteRackFlag at index " + i + " is " +
remoteRackFlag[i]);
}
// Verify with parity Blocks
if (stripeVerified == false) {
Block currentBlock = stream.getCurrentBlock();
if (!currentBlock.equals(si.parityBlocks.get(i))) {
throw new StripeMismatchException("current block " +
currentBlock.toString() + " in position " + i + " doesn't "
+ "match stripe info:" + si);
}
}
} else {
//Dealing with Source (file) block
remoteRackFlag[i] =
!(((DistributedFileSystem)srcFs).getClient().
isInLocalRack(NetUtils.createSocketAddr(
stream.getCurrentDatanode().getName())));
if (LOG.isDebugEnabled()) {
LOG.debug("RemoteRackFlag at index " + i + " is " +
remoteRackFlag[i]);
}
// Verify with source Blocks
if (stripeVerified == false) {
Block currentBlock = stream.getCurrentBlock();
if (!currentBlock.equals(si.srcBlocks.get(
i - codec.parityLength))) {
throw new StripeMismatchException("current block " +
currentBlock.toString() + " in position " + i + " doesn't "
+ "match stripe info:" + si);