anuragp010 opened a new pull request, #12213:
URL: https://github.com/apache/ozone/pull/12213

     ## What changes were proposed in this pull request?
   A user could not set the policy of a single key from the shell, although the 
key-level policy is already supported by the client API 
(`CreateKeyOptions#setStoragePolicy`), the Ozone Manager and SCM. 
   
   This PR adds the same option to `ozone sh key put`:
   
   - New option `--storage-policy`, `-s` in `PutKeyHandler`. Accepted values 
are HOT, WARM and COLD.
   - null or an empty value means "no explicit policy". The key then inherits 
the StoragePolicy of its bucket.
   - Any other value fails with `Invalid storage policy: <value>`. 
   - key put now creates the key through `OzoneBucket#createKey(String, 
CreateKeyOptions)`, with the policy set on the options.
   - Note: Two combinations are rejected before any RPC or file read, with 
IllegalArgumentException:
     - `--storage-policy` with `--stream`. The streaming write path of the 
client (`createStreamKey`) cannot carry a StoragePolicy yet. Will be taken up 
as part of HDDS-16679.
     - `--storage-policy` with `--expected-generation`. 
`OzoneBucket#rewriteKey` has no StoragePolicy parameter. Will be taken up as 
part HDDS-17963.
     
     ## What is the link to the Apache JIRA
     https://issues.apache.org/jira/browse/HDDS-16038
     
     ## How was this patch tested?
   - New unit test class `TestPutKeyHandler`:
     - Verifies `--storage-policy` and `-s` with HOT, WARM, COLD (also lower 
case) pass the policy to `OzoneBucket#createKey`.
     - No option, null, NULL and an empty value leave the policy unset.
     - An invalid value fails with the expected message and no key is created.
   - New integration test `TestOzoneStoragePolicy#testShellPutKey`. It runs the 
real `OzoneShell` against a `MiniOzoneCluster` whose datanodes have DISK, SSD 
and ARCHIVE volumes, so the placement can be checked end to end:
     - key put `-s HOT`|`WARM`|`COLD` on a bucket without a policy. The key 
records the policy, SCM allocates the container and pipeline on the creation 
tier of the policy, and the block is on a datanode volume of that tier.
     - On a COLD bucket, key put without `-s` lands on the COLD tier, and key 
put `-s HOT` lands on the HOT tier (override).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to