HDFS-6051. HDFS cannot run on Windows since short-circuit memory segment changes (cmccabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1574246 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2014-03-04 23:33:29 +00:00
parent c0a903da22
commit 1da076fd13
3 changed files with 27 additions and 9 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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 =