From 2d0b340c4739dff11d1c04982d4bd3a4dcd97ce9 Mon Sep 17 00:00:00 2001 From: Eli Collins Date: Sat, 7 Jan 2012 00:17:42 +0000 Subject: [PATCH] HADOOP-7961. Move HA fencing to common. Contributed by Eli Collins git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-1623@1228510 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-common-project/hadoop-common/pom.xml | 4 ++ .../ha/BadFencingConfigurationException.java | 0 .../org/apache/hadoop}/ha/FenceMethod.java | 0 .../org/apache/hadoop}/ha/NodeFencer.java | 0 .../apache/hadoop}/ha/ShellCommandFencer.java | 0 .../apache/hadoop}/ha/SshFenceByTcpPort.java | 45 +++++++------------ .../org/apache/hadoop}/ha/StreamPumper.java | 0 .../org/apache/hadoop}/ha/TestNodeFencer.java | 1 - .../hadoop}/ha/TestShellCommandFencer.java | 8 ++-- .../hadoop}/ha/TestSshFenceByTcpPort.java | 20 +++++---- hadoop-hdfs-project/hadoop-hdfs/pom.xml | 4 -- 11 files changed, 34 insertions(+), 48 deletions(-) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/BadFencingConfigurationException.java (100%) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/FenceMethod.java (100%) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/NodeFencer.java (100%) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/ShellCommandFencer.java (100%) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/SshFenceByTcpPort.java (88%) rename {hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop}/ha/StreamPumper.java (100%) rename {hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop}/ha/TestNodeFencer.java (98%) rename {hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop}/ha/TestShellCommandFencer.java (95%) rename {hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode => hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop}/ha/TestSshFenceByTcpPort.java (88%) diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml index 6a5e56fb48..23d61f825b 100644 --- a/hadoop-common-project/hadoop-common/pom.xml +++ b/hadoop-common-project/hadoop-common/pom.xml @@ -264,6 +264,10 @@ json-simple compile + + com.jcraft + jsch + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BadFencingConfigurationException.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/BadFencingConfigurationException.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/BadFencingConfigurationException.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/BadFencingConfigurationException.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/FenceMethod.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/FenceMethod.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/FenceMethod.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/FenceMethod.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/NodeFencer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/NodeFencer.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/NodeFencer.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/NodeFencer.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ShellCommandFencer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ShellCommandFencer.java similarity index 100% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/ShellCommandFencer.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/ShellCommandFencer.java diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/SshFenceByTcpPort.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/SshFenceByTcpPort.java similarity index 88% rename from hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/SshFenceByTcpPort.java rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/SshFenceByTcpPort.java index bb01d53d03..ecccb4e1f3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/SshFenceByTcpPort.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ha/SshFenceByTcpPort.java @@ -27,7 +27,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configured; -import org.apache.hadoop.hdfs.server.namenode.NameNode; import com.google.common.annotations.VisibleForTesting; import com.jcraft.jsch.ChannelExec; @@ -36,11 +35,11 @@ import com.jcraft.jsch.Session; /** - * This fencing implementation sshes to the target node and uses fuser - * to kill the process listening on the NameNode's TCP port. This is - * more accurate than using "jps" since it doesn't require parsing, - * and will work even if there are multiple NameNodes running on the - * same machine.

+ * This fencing implementation sshes to the target node and uses + * fuser to kill the process listening on the service's + * TCP port. This is more accurate than using "jps" since it doesn't + * require parsing, and will work even if there are multiple service + * processes running on the same machine.

* It returns a successful status code if: *