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

WebHdfsFileSystem.getFileStatus() won't return correct "snapshot enabled" status

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.0, 3.0.3
    • Fix Version/s: 3.2.0, 3.0.4, 3.1.2
    • Component/s: hdfs, webhdfs
    • Labels:
      None

      Description

      "Snapshot enabled" status has been added in HDFS-12455 by Ajay Kumar.

      However, it is found by Wei-Chiu Chuang that WebHdfsFileSystem.getFileStatus() won't return the correct "snapshot enabled" status. The reason is that JsonUtilClient.toFileStatus() did not check and append the "snapshot enabled" flag to the resulting HdfsFileStatus object.

      Proof:

      In TestWebHDFS#testWebHdfsAllowandDisallowSnapshots(), add the following lines indicated by prepending "+":

      // allow snapshots on /bar using webhdfs
      webHdfs.allowSnapshot(bar);
      +// check if snapshot status is enabled
      +assertTrue(dfs.getFileStatus(bar).isSnapshotEnabled());
      +assertTrue(webHdfs.getFileStatus(bar).isSnapshotEnabled());
      

       
      The first assertion will pass, as expected, while the second assertion will fail because of the reason above.

      Update:

      A further investigation shows that FSOperations.toJsonInner() also doesn't check the "snapshot enabled" bit. Therefore, "fs.getFileStatus(path).isSnapshotEnabled()" will always return false for fs type HttpFSFileSystem/WebHdfsFileSystem/SWebhdfsFileSystem. This will be addressed in a separate jira HDFS-13886.

        Attachments

        1. HDFS-13838.004.patch
          3 kB
          Siyao Meng
        2. HDFS-13838.003.patch
          4 kB
          Siyao Meng
        3. HDFS-13838.002.patch
          3 kB
          Siyao Meng
        4. HDFS-13838.001.patch
          3 kB
          Siyao Meng

          Issue Links

            Activity

              People

              • Assignee:
                smeng Siyao Meng
                Reporter:
                smeng Siyao Meng
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: