diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/SharedFileDescriptorFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/SharedFileDescriptorFactory.java index 1ef2904b7f4..97d789251a2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/SharedFileDescriptorFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/nativeio/SharedFileDescriptorFactory.java @@ -48,6 +48,16 @@ public class SharedFileDescriptorFactory { private final String prefix; private final String path; + public static String getLoadingFailureReason() { + if (!NativeIO.isAvailable()) { + return "NativeIO is not available."; + } + if (!SystemUtils.IS_OS_UNIX) { + return "The OS is not UNIX."; + } + return null; + } + /** * Create a SharedFileDescriptorFactory. * @@ -56,8 +66,7 @@ public class SharedFileDescriptorFactory { */ public SharedFileDescriptorFactory(String prefix, String path) throws IOException { - Preconditions.checkArgument(NativeIO.isAvailable()); - Preconditions.checkArgument(SystemUtils.IS_OS_UNIX); + Preconditions.checkState(getLoadingFailureReason() == null); this.prefix = prefix; this.path = path; deleteStaleTemporaryFiles0(prefix, path); diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index acd5f15ae89..c3f810c1c3b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -528,6 +528,9 @@ Release 2.4.0 - UNRELEASED HDFS-6047 TestPread NPE inside in DFSInputStream hedgedFetchBlockByteRange (stack) + HDFS-6051. HDFS cannot run on Windows since short-circuit shared memory + segment changes. (cmccabe) + BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ShortCircuitRegistry.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ShortCircuitRegistry.java index ad3bf52508f..2d0b5410362 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ShortCircuitRegistry.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/ShortCircuitRegistry.java @@ -149,23 +149,29 @@ public class ShortCircuitRegistry { SharedFileDescriptorFactory shmFactory = null; DomainSocketWatcher watcher = null; try { - if (!NativeIO.isAvailable()) { - LOG.debug("Disabling ShortCircuitRegistry because NativeIO is " + - "not available."); + String loadingFailureReason = + SharedFileDescriptorFactory.getLoadingFailureReason(); + if (loadingFailureReason != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("Disabling ShortCircuitRegistry because " + + loadingFailureReason); + } return; } String shmPath = conf.get(DFS_DATANODE_SHARED_FILE_DESCRIPTOR_PATH, DFS_DATANODE_SHARED_FILE_DESCRIPTOR_PATH_DEFAULT); if (shmPath.isEmpty()) { - LOG.info("Disabling ShortCircuitRegistry because shmPath was not set."); + LOG.debug("Disabling ShortCircuitRegistry because shmPath was not set."); return; } int interruptCheck = conf.getInt( DFS_SHORT_CIRCUIT_SHARED_MEMORY_WATCHER_INTERRUPT_CHECK_MS, DFS_SHORT_CIRCUIT_SHARED_MEMORY_WATCHER_INTERRUPT_CHECK_MS_DEFAULT); if (interruptCheck <= 0) { - LOG.info("Disabling ShortCircuitRegistry because interruptCheckMs " + - "was set to " + interruptCheck); + if (LOG.isDebugEnabled()) { + LOG.debug("Disabling ShortCircuitRegistry because " + + "interruptCheckMs was set to " + interruptCheck); + } return; } shmFactory = @@ -174,7 +180,7 @@ public class ShortCircuitRegistry { enabled = true; if (LOG.isDebugEnabled()) { LOG.debug("created new ShortCircuitRegistry with interruptCheck=" + - interruptCheck + ", shmPath=" + shmPath); + interruptCheck + ", shmPath=" + shmPath); } } finally { this.enabled = enabled;