Revert "HDFS-14135. TestWebHdfsTimeouts Fails intermittently in trunk. Contributed by Ayush Saxena."
This reverts commit 3bfae20e946e40f6936aab54b79fc85df8d3b0b2.
This commit is contained in:
parent
c0fd09c42c
commit
653951e1f7
@ -35,7 +35,6 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeoutException;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
@ -48,7 +47,6 @@
|
|||||||
import org.apache.hadoop.security.authentication.client.ConnectionConfigurator;
|
import org.apache.hadoop.security.authentication.client.ConnectionConfigurator;
|
||||||
import org.apache.hadoop.test.GenericTestUtils;
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AssumptionViolatedException;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
@ -86,7 +84,6 @@ public HttpURLConnection configure(HttpURLConnection conn) throws IOException {
|
|||||||
return conn;
|
return conn;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
private volatile boolean failedToConsumeBacklog;
|
|
||||||
|
|
||||||
public enum TimeoutSource { ConnectionFactory, Configuration };
|
public enum TimeoutSource { ConnectionFactory, Configuration };
|
||||||
|
|
||||||
@ -125,7 +122,6 @@ public void setUp() throws Exception {
|
|||||||
|
|
||||||
clients = new ArrayList<SocketChannel>();
|
clients = new ArrayList<SocketChannel>();
|
||||||
serverThread = null;
|
serverThread = null;
|
||||||
failedToConsumeBacklog = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -215,7 +211,6 @@ public void testRedirectConnectTimeout() throws Exception {
|
|||||||
fs.getFileChecksum(new Path("/file"));
|
fs.getFileChecksum(new Path("/file"));
|
||||||
fail("expected timeout");
|
fail("expected timeout");
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
assumeBacklogConsumed();
|
|
||||||
GenericTestUtils.assertExceptionContains(
|
GenericTestUtils.assertExceptionContains(
|
||||||
fs.getUri().getAuthority() + ": connect timed out", e);
|
fs.getUri().getAuthority() + ": connect timed out", e);
|
||||||
}
|
}
|
||||||
@ -249,7 +244,6 @@ public void testTwoStepWriteConnectTimeout() throws Exception {
|
|||||||
os = fs.create(new Path("/file"));
|
os = fs.create(new Path("/file"));
|
||||||
fail("expected timeout");
|
fail("expected timeout");
|
||||||
} catch (SocketTimeoutException e) {
|
} catch (SocketTimeoutException e) {
|
||||||
assumeBacklogConsumed();
|
|
||||||
GenericTestUtils.assertExceptionContains(
|
GenericTestUtils.assertExceptionContains(
|
||||||
fs.getUri().getAuthority() + ": connect timed out", e);
|
fs.getUri().getAuthority() + ": connect timed out", e);
|
||||||
} finally {
|
} finally {
|
||||||
@ -363,28 +357,6 @@ private void consumeConnectionBacklog() throws IOException {
|
|||||||
client.connect(nnHttpAddress);
|
client.connect(nnHttpAddress);
|
||||||
clients.add(client);
|
clients.add(client);
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
GenericTestUtils.waitFor(() -> {
|
|
||||||
try (SocketChannel c = SocketChannel.open()) {
|
|
||||||
c.socket().connect(nnHttpAddress, 100);
|
|
||||||
} catch (SocketTimeoutException e) {
|
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
LOG.debug("unexpected exception: " + e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}, 100, 10000);
|
|
||||||
} catch (TimeoutException | InterruptedException e) {
|
|
||||||
failedToConsumeBacklog = true;
|
|
||||||
assumeBacklogConsumed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void assumeBacklogConsumed() {
|
|
||||||
if (failedToConsumeBacklog) {
|
|
||||||
throw new AssumptionViolatedException(
|
|
||||||
"failed to fill up connection backlog.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user