Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-9398

[snapshot] Prevent key writes with name .snapshot

    XMLWordPrintableJSON

Details

    Description

      Prevent key writes with name .snapshot

      Steps -

      • Create volume, bucket, key
      • Create snapshot of above bucket
      # ozone sh snapshot create vol1/buck1 snap1 
      • List .snapshot path of bucket
      # ozone fs -ls -R ofs://ozone1/vol1/buck1/
      -rw-rw-rw-   3 om om        670 2023-10-06 07:17 ofs://ozone1/vol1/buck1/key1
      # ozone fs -ls -R ofs://ozone1/vol1/buck1/.snapshot
      drwxrwxrwx   - om om          0 2023-10-06 07:17 ofs://ozone1/vol1/buck1/.snapshot/snap1
      -rw-rw-rw-   3 om om        670 2023-10-06 07:17 ofs://ozone1/vol1/buck1/.snapshot/snap1/key1
      • Create new file with .snapshot name 
        # ozone sh key put vol1/buck1/.snapshot /etc/hosts
        23/10/06 07:19:34 WARN impl.MetricsConfig: Cannot locate configuration: tried hadoop-metrics2-xceiverclientmetrics.properties,hadoop-metrics2.properties
        23/10/06 07:19:34 INFO impl.MetricsSystemImpl: Scheduled Metric snapshot period at 10 second(s).
        23/10/06 07:19:34 INFO impl.MetricsSystemImpl: XceiverClientMetrics metrics system started
        23/10/06 07:19:34 INFO metrics.MetricRegistries: Loaded MetricRegistries class org.apache.ratis.metrics.impl.MetricRegistriesImpl
      • List keys in bucket
        # ozone fs -ls -R ofs://ozone1/vol1/buck1/
        -rw-rw-rw-   3 om om        670 2023-10-06 07:19 ofs://ozone1/vol1/buck1/.snapshot
        -rw-rw-rw-   3 om om        670 2023-10-06 07:17 ofs://ozone1/vol1/buck1/key1 

      Expected behaviour - Key with name .snapshot should fail as it conflicts with snapshot dir path

      Note - Creating of directories or any keys under .snapshot path fails with appropriate error from https://issues.apache.org/jira/browse/HDDS-7168 

      # ozone fs -mkdir ofs://ozone1/vol1/buck1/.snapshot
      mkdir: `ofs://ozone1/vol1/buck1/.snapshot': File exists
      # ozone sh key put vol1/buck1/.snapshot/keytest /etc/hosts
      INVALID_KEY_NAME Cannot create key under path reserved for snapshot: .snapshot/ 

      Attachments

        Issue Links

          Activity

            People

              jyosin Jyotirmoy Sinha
              jyosin Jyotirmoy Sinha
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: