hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cnaur...@apache.org
Subject [3/3] git commit: HDFS-6934. Revert files accidentally committed.
Date Mon, 27 Oct 2014 19:59:21 GMT
HDFS-6934. Revert files accidentally committed.

(cherry picked from commit 5b1dfe78b8b06335bed0bcb83f12bb936d4c021b)
(cherry picked from commit 5dbd27f8b4923daea6e70b0bfe5cd3063a5f1f57)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e8d77593
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e8d77593
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e8d77593

Branch: refs/heads/branch-2.6
Commit: e8d77593fa6f4cd18e11c4d637cd9ff6997be925
Parents: a9f31af
Author: cnauroth <cnauroth@apache.org>
Authored: Mon Oct 27 12:15:03 2014 -0700
Committer: cnauroth <cnauroth@apache.org>
Committed: Mon Oct 27 12:18:48 2014 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/io/nativeio/NativeIO.java |   3 +-
 .../main/java/org/apache/hadoop/util/Shell.java | 111 -------------------
 .../java/org/apache/hadoop/util/TestShell.java  |  20 ----
 3 files changed, 1 insertion(+), 133 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e8d77593/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java
index f0aca3a..2400958 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/NativeIO.java
@@ -869,8 +869,7 @@ public class NativeIO {
    * @throws IOException
    */
   public static void copyFileUnbuffered(File src, File dst) throws IOException {
-    if ((nativeLoaded) &&
-        (Shell.WINDOWS || (Shell.isLinuxSendfileAvailable))) {
+    if ((nativeLoaded) && (Shell.WINDOWS || Shell.LINUX)) {
       copyFileUnbuffered0(src.getAbsolutePath(), dst.getAbsolutePath());
     } else {
       FileUtils.copyFile(src, dst);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e8d77593/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
index 9b2a824..3aac27b 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/Shell.java
@@ -377,117 +377,6 @@ abstract public class Shell {
     return winUtilsPath;
   }
 
-  public static class LinuxKernelVersion implements Comparable<LinuxKernelVersion>{
-    private final short major;
-    private final short minor;
-    private final short revision;
-
-    public LinuxKernelVersion(short major, short minor, short revision) {
-      this.major = major;
-      this.minor = minor;
-      this.revision = revision;
-    }
-
-    /**
-     * Parse Linux kernel version string from output of POSIX command 'uname -r'
-     * @param version version string from POSIX command 'uname -r'
-     * @return LinuxKernelVersion
-     * @throws IllegalArgumentException
-     *
-     * Note:
-     * On CentOS 5.8: '2.6.18-308.24.1.el5'
-     * On Ubuntu 14:  '3.13.0-32-generic'
-     */
-    public static LinuxKernelVersion parseLinuxKernelVersion(String version)
-        throws IllegalArgumentException {
-      if (version == null) {
-        throw new IllegalArgumentException();
-      }
-      String parts[] = version.split("-")[0].split("\\.");
-      if (parts.length != 3) {
-        throw new IllegalArgumentException(version);
-      }
-      short major = Short.parseShort(parts[0]);
-      short minor = Short.parseShort(parts[1]);
-      short revision = Short.parseShort(parts[2]);
-      return new LinuxKernelVersion(major, minor, revision);
-    }
-
-    @Override
-    public int compareTo(LinuxKernelVersion o) {
-      if (this.major == o.major) {
-        if (this.minor == o.minor) {
-          return this.revision - o.revision;
-        } else {
-          return this.minor - o.minor;
-        }
-      } else {
-        return this.major - o.major;
-      }
-    }
-
-    @Override
-    public boolean equals(Object other) {
-      if (this == other) {
-        return true;
-      }
-      if (!(other instanceof LinuxKernelVersion)) {
-        return false;
-      }
-      return compareTo((LinuxKernelVersion) other) == 0;
-    }
-
-    @Override
-    public String toString() {
-      return String.format("%d.%d.%d", major, minor, revision);
-    }
-
-    @Override
-    public int hashCode(){
-      int hash = 41;
-      hash = (19 * hash) + major;
-      hash = (53 * hash) + minor;
-      hash = (29 * hash) + revision;
-      return hash;
-    }
-  }
-
-  /*
-   * sendfile() API between two file descriptors
-   * is only supported on Linux Kernel version 2.6.33+
-   * according to http://man7.org/linux/man-pages/man2/sendfile.2.html
-   */
-  public static final boolean isLinuxSendfileAvailable = isLinuxSendfileSupported();
-  private static LinuxKernelVersion minLkvSupportSendfile =
-      new LinuxKernelVersion((short)2, (short)6, (short)33);
-
-  private static boolean isLinuxSendfileSupported() {
-    if (!Shell.LINUX) {
-      return false;
-    }
-    ShellCommandExecutor shexec = null;
-    boolean sendfileSupported = false;
-    try {
-      String[] args = {"uname", "bash", "-r"};
-      shexec = new ShellCommandExecutor(args);
-      shexec.execute();
-      String version = shexec.getOutput();
-      LinuxKernelVersion lkv =
-          LinuxKernelVersion.parseLinuxKernelVersion(version);
-      if (lkv.compareTo(minLkvSupportSendfile) > 0) {
-        sendfileSupported = true;
-      }
-    } catch (Exception e) {
-      LOG.warn("isLinuxSendfileSupported() failed unexpected: " + e);
-    } finally {
-      if (LOG.isDebugEnabled()) {
-        LOG.debug("uname exited with exit code "
-            + (shexec != null ? shexec.getExitCode() : "(null executor)"));
-      }
-    }
-    return sendfileSupported;
-  }
-
   public static final boolean isSetsidAvailable = isSetsidSupported();
   private static boolean isSetsidSupported() {
     if (Shell.WINDOWS) {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e8d77593/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java
index 19589f8..d9dc9ef 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/TestShell.java
@@ -165,24 +165,4 @@ public class TestShell extends TestCase {
       assertEquals(2, command.getRunCount());
     }
   }
-
-  public void testLinuxKernelVersion() throws IOException {
-    Shell.LinuxKernelVersion v2_6_18 =
-        new Shell.LinuxKernelVersion((short)2, (short)6, (short)18);
-    Shell.LinuxKernelVersion v2_6_32 =
-        new Shell.LinuxKernelVersion((short)2, (short)6, (short)32);
-    assertTrue(v2_6_18.compareTo(v2_6_32) < 0);
-  }
-
-  public void testParseLinuxKernelVersion() throws Exception {
-    String centOs58Ver = new String("2.6.18-308.24.1.el5");
-    String ubuntu14Ver = new String("3.13.0-32-generic");
-    Shell.LinuxKernelVersion lkvCentOs58 =
-        Shell.LinuxKernelVersion.parseLinuxKernelVersion(centOs58Ver);
-    Shell.LinuxKernelVersion lkvUnbuntu14 =
-        Shell.LinuxKernelVersion.parseLinuxKernelVersion(ubuntu14Ver);
-    assertTrue(lkvUnbuntu14.compareTo(lkvCentOs58) > 0);
-    assertFalse(lkvUnbuntu14.equals(lkvCentOs58));
-  }
-
 }


Mime
View raw message