anuragp010 commented on code in PR #12213:
URL: https://github.com/apache/ozone/pull/12213#discussion_r4765712993
##########
hadoop-ozone/cli-shell/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java:
##########
@@ -69,10 +73,25 @@ public class PutKeyHandler extends KeyHandler {
description = "Store key only if it already exists and its generation
matches the value provided")
private Long expectedGeneration;
+ @Option(names = {"--storage-policy", "-s"},
+ description = "Key StoragePolicy. Allowed values: HOT, WARM, COLD, null.
"
+ + "If not specified, the key inherits the StoragePolicy of the
bucket.")
+ private String storagePolicyStr;
+
+ private static final String NULL_STORAGE_POLICY = "null";
+
@Override
protected void execute(OzoneClient client, OzoneAddress address)
throws IOException {
+ StoragePolicy storagePolicy = parseStoragePolicy(storagePolicyStr);
+ // TODO(HDDS-16679): Streaming writes support StoragePolicy.
+ Preconditions.checkArgument(!(stream && storagePolicy != null),
Review Comment:
You are right about the order: `Handler#call` creates the client before
execute, so with OM down the user sees the connection error first. I kept the
checks in `execute()` on purpose. Both are interim and are removed when
[HDDS-16679 ](https://issues.apache.org/jira/browse/HDDS-16679)(streaming) and
[HDDS-17963](https://issues.apache.org/jira/browse/HDDS-17963) (rewrite) land.
A `call()` override just to run them earlier would be removed with them. The
cost is only which error the user sees first. No key is created and no file is
read. I changed the PR description, which wrongly said "before any RPC".
--
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]