HDFS-13895. EC: Fix Intermittent Failure in TestDFSStripedOutputStreamWithFailureWithRandomECPolicy. Contributed by Ayush Saxena.

This commit is contained in:
Vinayakumar B 2018-09-10 09:22:59 +05:30
parent 30eceec342
commit eef3bafae8
1 changed files with 22 additions and 19 deletions

View File

@ -244,26 +244,29 @@ public class TestDFSStripedOutputStreamWithFailure extends
// Full stripe and a partial on non-cell boundary // Full stripe and a partial on non-cell boundary
(cellSize * dataBlocks) + 123, (cellSize * dataBlocks) + 123,
}; };
try { // select the two DNs with partial block to kill
for (int length: fileLengths) { int[] dnIndex = null;
// select the two DNs with partial block to kill if (parityBlocks > 1) {
final int[] dnIndex = {dataBlocks - 2, dataBlocks - 1}; dnIndex = new int[] {dataBlocks - 2, dataBlocks - 1};
final int[] killPos = getKillPositions(length, dnIndex.length); } else {
try { dnIndex = new int[] {dataBlocks - 1};
LOG.info("runTestWithMultipleFailure2: length==" + length }
+ ", killPos=" + Arrays.toString(killPos) for (int length : fileLengths) {
+ ", dnIndex=" + Arrays.toString(dnIndex)); final int[] killPos = getKillPositions(length, dnIndex.length);
setup(conf); try {
runTest(length, killPos, dnIndex, false); LOG.info("runTestWithMultipleFailure2: length==" + length + ", killPos="
} catch (Throwable e) { + Arrays.toString(killPos) + ", dnIndex="
final String err = "failed, killPos=" + Arrays.toString(killPos) + Arrays.toString(dnIndex));
+ ", dnIndex=" + Arrays.toString(dnIndex) + ", length=" + length; setup(conf);
LOG.error(err); runTest(length, killPos, dnIndex, false);
throw e; } catch (Throwable e) {
} final String err = "failed, killPos=" + Arrays.toString(killPos)
+ ", dnIndex=" + Arrays.toString(dnIndex) + ", length=" + length;
LOG.error(err);
throw e;
} finally {
tearDown();
} }
} finally {
tearDown();
} }
} }