Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-14139

FsShell ls and stat command return different Modification Time on display.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: fs, shell
    • Labels:

      Description

      When we run "hdfs dfs -ls" or "hdfs dfs -stat" on the same file/directory, the time of results are different.
      Like this:
      >> $ ./hdfs dfs -stat /user/xxx/collie-pt-canary
      >> 2018-12-10 10:04:57

      >> ./hdfs dfs -ls /user/xxx/collie-pt-canary
      >> rw-rr- 3 xxx supergroup 0 2018-12-10 18:04

      Strangely, we found the time is different(8 hours). The stat command uses UTC timezone, but the Ls command uses system local timezone.
      Why does the stat command use UTC timezone, but Ls not?

      // in Stat.java
      timeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      timeFmt.setTimeZone(TimeZone.getTimeZone("UTC"));

      By the way, in Unix/Linux the ls and stat return the same time on display.
      Should we unify the timezone?

        Attachments

        1. HDFS-14139-01.patch
          2 kB
          Ayush Saxena
        2. HDFS-14139-02.patch
          3 kB
          Ayush Saxena

          Activity

            People

            • Assignee:
              ayushtkn Ayush Saxena
              Reporter:
              pengmq1 Mengqing Peng
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: