HDFS-5857. TestWebHDFS#testNamenodeRestart fails intermittently with NPE. Contributed By Mit Desai.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1574683 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d963b3cd52
commit
b46fbd0275
@ -683,6 +683,9 @@ Release 2.4.0 - UNRELEASED
|
|||||||
HDFS-6051. HDFS cannot run on Windows since short-circuit shared memory
|
HDFS-6051. HDFS cannot run on Windows since short-circuit shared memory
|
||||||
segment changes. (cmccabe)
|
segment changes. (cmccabe)
|
||||||
|
|
||||||
|
HDFS-5857. TestWebHDFS#testNamenodeRestart fails intermittently with NPE.
|
||||||
|
(Mit Desai via wheat9)
|
||||||
|
|
||||||
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
|
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
|
||||||
|
|
||||||
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)
|
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)
|
||||||
|
@ -164,6 +164,15 @@ private void init(final UserGroupInformation ugi,
|
|||||||
response.setContentType(null);
|
response.setContentType(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static NamenodeProtocols getRPCServer(NameNode namenode)
|
||||||
|
throws IOException {
|
||||||
|
final NamenodeProtocols np = namenode.getRpcServer();
|
||||||
|
if (np == null) {
|
||||||
|
throw new IOException("Namenode is in startup mode");
|
||||||
|
}
|
||||||
|
return np;
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static DatanodeInfo chooseDatanode(final NameNode namenode,
|
static DatanodeInfo chooseDatanode(final NameNode namenode,
|
||||||
final String path, final HttpOpParam.Op op, final long openOffset,
|
final String path, final HttpOpParam.Op op, final long openOffset,
|
||||||
@ -188,7 +197,7 @@ static DatanodeInfo chooseDatanode(final NameNode namenode,
|
|||||||
|| op == GetOpParam.Op.GETFILECHECKSUM
|
|| op == GetOpParam.Op.GETFILECHECKSUM
|
||||||
|| op == PostOpParam.Op.APPEND) {
|
|| op == PostOpParam.Op.APPEND) {
|
||||||
//choose a datanode containing a replica
|
//choose a datanode containing a replica
|
||||||
final NamenodeProtocols np = namenode.getRpcServer();
|
final NamenodeProtocols np = getRPCServer(namenode);
|
||||||
final HdfsFileStatus status = np.getFileInfo(path);
|
final HdfsFileStatus status = np.getFileInfo(path);
|
||||||
if (status == null) {
|
if (status == null) {
|
||||||
throw new FileNotFoundException("File " + path + " not found.");
|
throw new FileNotFoundException("File " + path + " not found.");
|
||||||
@ -424,7 +433,7 @@ private Response put(
|
|||||||
|
|
||||||
final Configuration conf = (Configuration)context.getAttribute(JspHelper.CURRENT_CONF);
|
final Configuration conf = (Configuration)context.getAttribute(JspHelper.CURRENT_CONF);
|
||||||
final NameNode namenode = (NameNode)context.getAttribute("name.node");
|
final NameNode namenode = (NameNode)context.getAttribute("name.node");
|
||||||
final NamenodeProtocols np = namenode.getRpcServer();
|
final NamenodeProtocols np = getRPCServer(namenode);
|
||||||
|
|
||||||
switch(op.getValue()) {
|
switch(op.getValue()) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
@ -606,7 +615,7 @@ private Response post(
|
|||||||
}
|
}
|
||||||
case CONCAT:
|
case CONCAT:
|
||||||
{
|
{
|
||||||
namenode.getRpcServer().concat(fullpath, concatSrcs.getAbsolutePaths());
|
getRPCServer(namenode).concat(fullpath, concatSrcs.getAbsolutePaths());
|
||||||
return Response.ok().build();
|
return Response.ok().build();
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -696,7 +705,7 @@ private Response get(
|
|||||||
final BufferSizeParam bufferSize
|
final BufferSizeParam bufferSize
|
||||||
) throws IOException, URISyntaxException {
|
) throws IOException, URISyntaxException {
|
||||||
final NameNode namenode = (NameNode)context.getAttribute("name.node");
|
final NameNode namenode = (NameNode)context.getAttribute("name.node");
|
||||||
final NamenodeProtocols np = namenode.getRpcServer();
|
final NamenodeProtocols np = getRPCServer(namenode);
|
||||||
|
|
||||||
switch(op.getValue()) {
|
switch(op.getValue()) {
|
||||||
case OPEN:
|
case OPEN:
|
||||||
@ -905,7 +914,7 @@ private Response delete(
|
|||||||
switch(op.getValue()) {
|
switch(op.getValue()) {
|
||||||
case DELETE:
|
case DELETE:
|
||||||
{
|
{
|
||||||
final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
|
final boolean b = getRPCServer(namenode).delete(fullpath, recursive.getValue());
|
||||||
final String js = JsonUtil.toJsonString("boolean", b);
|
final String js = JsonUtil.toJsonString("boolean", b);
|
||||||
return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
|
return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user