HDFS-4751. TestLeaseRenewer#testThreadName flakes. Contributed by Andrew Wang.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1481160 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4ed1fc58c0
commit
b9a0286223
@ -984,6 +984,8 @@ Release 2.0.5-beta - UNRELEASED
|
||||
HDFS-4799. Corrupt replica can be prematurely removed from
|
||||
corruptReplicas map. (todd via kihwal)
|
||||
|
||||
HDFS-4751. TestLeaseRenewer#testThreadName flakes. (Andrew Wang via atm)
|
||||
|
||||
Release 2.0.4-alpha - 2013-04-25
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -35,6 +35,7 @@
|
||||
import org.apache.hadoop.util.Daemon;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.apache.hadoop.util.Time;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -323,6 +324,11 @@ public String toString() {
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
synchronized void setEmptyTime(long time) {
|
||||
emptyTime = time;
|
||||
}
|
||||
|
||||
/** Close a file. */
|
||||
void closeFile(final String src, final DFSClient dfsc) {
|
||||
dfsc.removeFileBeingWritten(src);
|
||||
|
@ -182,8 +182,6 @@ public void testThreadName() throws Exception {
|
||||
renewer.isRunning());
|
||||
|
||||
// Pretend to open a file
|
||||
Mockito.doReturn(false)
|
||||
.when(MOCK_DFSCLIENT).isFilesBeingWrittenEmpty();
|
||||
renewer.put(filePath, mockStream, MOCK_DFSCLIENT);
|
||||
|
||||
Assert.assertTrue("Renewer should have started running",
|
||||
@ -194,9 +192,8 @@ public void testThreadName() throws Exception {
|
||||
Assert.assertEquals("LeaseRenewer:myuser@hdfs://nn1/", threadName);
|
||||
|
||||
// Pretend to close the file
|
||||
Mockito.doReturn(true)
|
||||
.when(MOCK_DFSCLIENT).isFilesBeingWrittenEmpty();
|
||||
renewer.closeFile(filePath, MOCK_DFSCLIENT);
|
||||
renewer.setEmptyTime(Time.now());
|
||||
|
||||
// Should stop the renewer running within a few seconds
|
||||
long failTime = Time.now() + 5000;
|
||||
|
Loading…
Reference in New Issue
Block a user