HDFS-6631. Merging change r1609534 from trunk to branch-2.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1609536 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2014-07-10 18:07:03 +00:00
parent d3f53852bc
commit 4b7196d2ce
4 changed files with 17 additions and 1 deletions

View File

@ -552,6 +552,9 @@ Release 2.5.0 - UNRELEASED
HDFS-5411. Update Bookkeeper dependency to 4.2.3. (Rakesh R via umamahesh) HDFS-5411. Update Bookkeeper dependency to 4.2.3. (Rakesh R via umamahesh)
HDFS-6631. TestPread#testHedgedReadLoopTooManyTimes fails intermittently.
(Liang Xie via cnauroth)
BREAKDOWN OF HDFS-2006 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-2006 SUBTASKS AND RELATED JIRAS
HDFS-6299. Protobuf for XAttr and client-side implementation. (Yi Liu via umamahesh) HDFS-6299. Protobuf for XAttr and client-side implementation. (Yi Liu via umamahesh)

View File

@ -52,4 +52,6 @@ public class DFSClientFaultInjector {
public void startFetchFromDatanode() {} public void startFetchFromDatanode() {}
public void fetchFromDatanodeException() {} public void fetchFromDatanodeException() {}
public void readFromDatanodeDelay() {}
} }

View File

@ -1044,6 +1044,7 @@ implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead,
throw new IOException("truncated return from reader.read(): " + throw new IOException("truncated return from reader.read(): " +
"excpected " + len + ", got " + nread); "excpected " + len + ", got " + nread);
} }
DFSClientFaultInjector.get().readFromDatanodeDelay();
return; return;
} catch (ChecksumException e) { } catch (ChecksumException e) {
String msg = "fetchBlockByteRange(). Got a checksum exception for " String msg = "fetchBlockByteRange(). Got a checksum exception for "

View File

@ -292,11 +292,12 @@ public class TestPread {
DFSClientFaultInjector.instance = Mockito DFSClientFaultInjector.instance = Mockito
.mock(DFSClientFaultInjector.class); .mock(DFSClientFaultInjector.class);
DFSClientFaultInjector injector = DFSClientFaultInjector.instance; DFSClientFaultInjector injector = DFSClientFaultInjector.instance;
final int sleepMs = 100;
Mockito.doAnswer(new Answer<Void>() { Mockito.doAnswer(new Answer<Void>() {
@Override @Override
public Void answer(InvocationOnMock invocation) throws Throwable { public Void answer(InvocationOnMock invocation) throws Throwable {
if (true) { if (true) {
Thread.sleep(hedgedReadTimeoutMillis + 1); Thread.sleep(hedgedReadTimeoutMillis + sleepMs);
if (DFSClientFaultInjector.exceptionNum.compareAndSet(0, 1)) { if (DFSClientFaultInjector.exceptionNum.compareAndSet(0, 1)) {
System.out.println("-------------- throw Checksum Exception"); System.out.println("-------------- throw Checksum Exception");
throw new ChecksumException("ChecksumException test", 100); throw new ChecksumException("ChecksumException test", 100);
@ -305,6 +306,15 @@ public class TestPread {
return null; return null;
} }
}).when(injector).fetchFromDatanodeException(); }).when(injector).fetchFromDatanodeException();
Mockito.doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
if (true) {
Thread.sleep(sleepMs * 2);
}
return null;
}
}).when(injector).readFromDatanodeDelay();
MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2) MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(2)
.format(true).build(); .format(true).build();