diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java index 1dafdd0da4..495035e3f9 100755 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BPServiceActor.java @@ -797,11 +797,16 @@ void register(NamespaceInfo nsInfo) throws IOException { } catch(EOFException e) { // namenode might have just restarted LOG.info("Problem connecting to server: " + nnAddr + " :" + e.getLocalizedMessage()); - sleepAndLogInterrupts(1000, "connecting to server"); } catch(SocketTimeoutException e) { // namenode is busy LOG.info("Problem connecting to server: " + nnAddr); - sleepAndLogInterrupts(1000, "connecting to server"); + } catch(RemoteException e) { + LOG.warn("RemoteException in register", e); + throw e; + } catch(IOException e) { + LOG.warn("Problem connecting to server: " + nnAddr); } + // Try again in a second + sleepAndLogInterrupts(1000, "connecting to server"); } if (bpRegistration == null) { @@ -908,6 +913,15 @@ boolean processCommand(DatanodeCommand[] cmds) { if (bpos.processCommandFromActor(cmd, this) == false) { return false; } + } catch (RemoteException re) { + String reClass = re.getClassName(); + if (UnregisteredNodeException.class.getName().equals(reClass) || + DisallowedDatanodeException.class.getName().equals(reClass) || + IncorrectVersionException.class.getName().equals(reClass)) { + LOG.warn(this + " is shutting down", re); + shouldServiceRun = false; + return false; + } } catch (IOException ioe) { LOG.warn("Error processing datanode Command", ioe); }