Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-15477 Enforce ordered snapshot deletion
  3. HDFS-15563

Incorrect getTrashRoot return value when a non-snapshottable dir prefix matches the path of a snapshottable dir

    XMLWordPrintableJSON

Details

    Description

      Note: Only impacts a user if dfs.namenode.snapshot.trashroot.enabled is enabled.

      Root cause analysis:

      SnapshottableDirectoryStatus paths retrived inside DFSClient#getSnapshotRoot aren't appended with '/', causing some directories with the same path prefix to be mistakenly classified as snapshottable directory.

      Thanks shashikant for the test case addition.

      Repro:

      1. snapshottable directory present in the cluster
      hdfs lsSnapshottableDir
      drwx-x-x 0 hrt_2 hrt_2 0 2020-09-08 07:42 0 65536 /user/hrt_2
      drwxr-xr-x 0 hrt_4 hrt_4 0 2020-09-08 13:16 0 65536 /user/hrt_4/newdir/subdir2. Created a new directory outside snapshottable directory
      hdfs dfs -mkdir /user/hrt_4/newdir/subdir23. Tried to delete subdir2 , it failed
      hdfs dfs -rm -r /user/hrt_4/newdir/subdir2
      rm: Failed to move to trash: hdfs://ns1/user/hrt_4/newdir/subdir2: Source /user/hrt_4/newdir/subdir2 and dest /user/hrt_4/newdir/subdir/.Trash/hdfs/Current/user/hrt_4/newdir/subdir2 are not under the same snapshot root.
      

      "/user/hrt_4/newdir/subdir2" , the trash root location is coming to be "/user/hrt_4/newdir/subdir/.Trash"

      as clear from the msg here:

      rm: Failed to move to trash: hdfs://ns1/user/hrt_4/newdir/subdir2: Source /user/hrt_4/newdir/subdir2 and dest /user/hrt_4/newdir/subdir/.Trash/hdfs/Current/user/hrt_4/newdir/subdir2 are not under the same snapshot root.

      Attachments

        Issue Links

          Activity

            People

              siyao Siyao Meng
              nilotpalnandi Nilotpal Nandi
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m