You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by as...@apache.org on 2016/12/12 16:09:08 UTC
[32/50] [abbrv] hadoop git commit: HDFS-11140. Directory Scanner
should log startup message time correctly. Contributed by Yiqun Lin.
HDFS-11140. Directory Scanner should log startup message time correctly. Contributed by Yiqun Lin.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0857641f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0857641f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0857641f
Branch: refs/heads/YARN-5085
Commit: 0857641f62778fad64e8158d78320efb0c8b417c
Parents: f54afdb
Author: Akira Ajisaka <aa...@apache.org>
Authored: Thu Dec 8 13:34:45 2016 +0900
Committer: Akira Ajisaka <aa...@apache.org>
Committed: Thu Dec 8 13:34:45 2016 +0900
----------------------------------------------------------------------
.../java/org/apache/hadoop/fs/RawLocalFileSystem.java | 9 +++++++++
.../hadoop/hdfs/server/datanode/DirectoryScanner.java | 12 ++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0857641f/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
index 7bf429e..84863a5 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/RawLocalFileSystem.java
@@ -791,6 +791,15 @@ public class RawLocalFileSystem extends FileSystem {
pathToFile(p).toPath(), BasicFileAttributeView.class);
FileTime fmtime = (mtime >= 0) ? FileTime.fromMillis(mtime) : null;
FileTime fatime = (atime >= 0) ? FileTime.fromMillis(atime) : null;
+
+ // On some macOS environment, BasicFileAttributeView.setTimes
+ // does not set times correctly when the argument of accessTime is null.
+ // TODO: Remove this after the issue is fixed.
+ if (fatime == null && Shell.MAC) {
+ FileStatus f = getFileStatus(p);
+ fatime = FileTime.fromMillis(f.getAccessTime());
+ }
+
view.setTimes(fmtime, fatime, null);
} catch (NoSuchFileException e) {
throw new FileNotFoundException("File " + p + " does not exist");
http://git-wip-us.apache.org/repos/asf/hadoop/blob/0857641f/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
index e2baf32..18188dd 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java
@@ -37,6 +37,8 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
+
+import org.apache.commons.lang.time.FastDateFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
@@ -61,7 +63,7 @@ public class DirectoryScanner implements Runnable {
private static final int MILLIS_PER_SECOND = 1000;
private static final String START_MESSAGE =
"Periodic Directory Tree Verification scan"
- + " starting at %dms with interval of %dms";
+ + " starting at %s with interval of %dms";
private static final String START_MESSAGE_WITH_THROTTLE = START_MESSAGE
+ " and throttle limit of %dms/s";
@@ -268,10 +270,12 @@ public class DirectoryScanner implements Runnable {
String logMsg;
if (throttleLimitMsPerSec < MILLIS_PER_SECOND) {
- logMsg = String.format(START_MESSAGE_WITH_THROTTLE, firstScanTime,
- scanPeriodMsecs, throttleLimitMsPerSec);
+ logMsg = String.format(START_MESSAGE_WITH_THROTTLE,
+ FastDateFormat.getInstance().format(firstScanTime), scanPeriodMsecs,
+ throttleLimitMsPerSec);
} else {
- logMsg = String.format(START_MESSAGE, firstScanTime, scanPeriodMsecs);
+ logMsg = String.format(START_MESSAGE,
+ FastDateFormat.getInstance().format(firstScanTime), scanPeriodMsecs);
}
LOG.info(logMsg);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org